PenUltima Online

It is currently Sun Oct 12, 2008 1:25 am

All times are UTC - 8 hours




Post new topic Reply to topic  [ 3 posts ] 
Author Message
 Post subject: Attackable - player status
PostPosted: Mon May 19, 2008 8:18 am 
Offline

Joined: Tue Mar 20, 2007 7:17 am
Posts: 101
Location: Poland
Can anyone tell me how to set this Attackable status?

As I recall this status gives player an ability to attack another player without getting a criminal status.


Top
 Profile  
 
 Post subject:
PostPosted: Mon May 19, 2008 10:46 am 
Offline
User avatar

Joined: Fri Feb 10, 2006 12:15 am
Posts: 223
I can only think of one real option (others may exist but I cannot recall any):

Use repsys hook introducted in POL 097.

From core-changes.txt:
Code:
08-17 Austin
       Added: repsys.cfg
              New elem called 'HookList' which will support syste hook scripts for the reputation system.
              Currently name (single click) and highlight (health bar) colors are hookable.
              Example:
              repsys.cfg
              HookList HookList
              {
                   NameColor :repsys:hookScript:NameColor
                   HighLightColor :repsys:hookScript:HighLightColor
              }
              :repsys:hookScript.src
              exported function NameColor(mobile, visible_to)
                   return CInt(GetObjProperty(mobile, "NameColor"));
              endfunction

              exported function HighLightColor(mobile, visible_to)
                   return CInt(GetObjProperty(mobile, "HighLightColor"));
              endfunction

              HighLightColor note: The client seems to only accept the following numbers
              0 - None, 1 - Innocent, 2 - Friend, 3 - Attackable,
              4 - Criminal, 5 - Enemy, 6 - Murderer, 7 - Invulnerable
              8 - Unknown (blue gump, pure black mobile)


08-19 Austin
       Added: Three more hooks to repsys.cfg's HookList elem.
              OnAttack Run when a mobile attacks another.
                        - Target with the TGTOPT_HARMFUL flag set.
                        - Mobile goes into warmode and double clicks another.

              OnDamage Run when a mobile damages another.
                        - ApplyDamage() or ApplyRawDamage() is used.

              OnHelp   Run when a mobile helps another.
                        - Target with TGTOPT_HELPFUL is used.


See distro code for example core-like usage of this.

What you'd like to do is give player a Attackable status the way you want (cprop is fine), and in the OnAttack hook check if the defender has such. If so, the attacker did not break the law. Or if you wish to grant the privilege so that player can attack everything without consequences, do the checking for attacker's cprop. I think you'll got the idea.

Note though, there's a bug in the way core handles these hooks. Take a look at this: http://forums.polserver.com/ftopic1061.php. One possible workaround is to use external script launched with Start_Script() for status toggling.


Top
 Profile  
 
 Post subject:
PostPosted: Mon May 19, 2008 12:25 pm 
Offline

Joined: Tue Mar 20, 2007 7:17 am
Posts: 101
Location: Poland
I looked at it... thx,

a little bug in a distro in repsys.inc

a cprop in this function is wrong
Code:
function SetMurderer(mobile, onoff)
   return SetObjProperty(mobile, "%Criminal%", CInt(onoff));
endfunction


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 3 posts ] 

All times are UTC - 8 hours


Who is online

Users browsing this forum: Google [Bot] and 0 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group
Style based on FI Subice by phpBBservice.nl