Difference between revisions of "ATTACKER"

From SphereWiki
Jump to: navigation, search
(Properties and Functions)
(Properties and Functions)
 
(7 intermediate revisions by 3 users not shown)
Line 4: Line 4:
 
Here is a list of all attacker properties and functions. If a function is marked as readable then it can return a value when used as <KEY>. Click on the name for more detailed information such as usage and examples.
 
Here is a list of all attacker properties and functions. If a function is marked as readable then it can return a value when used as <KEY>. Click on the name for more detailed information such as usage and examples.
  
This parameters must use with ATTACKER. For examples, please go [[#Examples|Examples]].
+
This parameters must use with [[#Properties and Functions|ATTACKER]]. For examples, please go [[#Examples|Examples]].
  
 
{| border="1" cellspacing="4" cellpadding="4"
 
{| border="1" cellspacing="4" cellpadding="4"
Line 12: Line 12:
 
|-
 
|-
 
| ''n'' || R || Gets the UID of the nth opponent who has damaged the character. (zero-based)
 
| ''n'' || R || Gets the UID of the nth opponent who has damaged the character. (zero-based)
 +
|-
 +
| [[CLEAR]] || R || Clears the attacker list
 
|-
 
|-
 
| [[LAST]] || R || Gets the UID of the opponent who most recently damaged the character.
 
| [[LAST]] || R || Gets the UID of the opponent who most recently damaged the character.
Line 17: Line 19:
 
| [[MAX]] || R || Gets the UID of the opponent who has dealt the most damage to the character.
 
| [[MAX]] || R || Gets the UID of the opponent who has dealt the most damage to the character.
 
|-
 
|-
| ''n''.[[DAMAGE]] || R || Gets the amount of damage that the nth opponent has dealt to the character. (zero-based)
+
| [[ID]] || R || Gets the Attacker.number of the specified character, -1 if its not in the attacker list for this character.
 
|-
 
|-
| ''n''.[[ELAPSED]] || R || Gets the length of time since the nth opponent has damaged the character, in seconds. (zero-based)
+
| [[TARGET]] || R || Returns the UID of this character's best target with this priorities (Threat -> Distance -> LOS).
 +
|-
 +
| [[ADD]] || W || Add this uid to the attacker list.
 +
|-
 +
| [[DELETE]] || W || Removes this uid from the attacker list
 +
|-
 +
| ''n''.[[DAMAGE]] || RW || Gets or Sets the amount of damage that the nth opponent has dealt to the character. (zero-based)
 +
|-
 +
| ''n''.[[ELAPSED]] || RW || Gets or Sets the length of time since the nth opponent has damaged the character, in seconds. (zero-based)
 
|-
 
|-
 
| ''n''.[[UID]] || R || Gets the UID of the nth opponent who has damaged the character. (zero-based)
 
| ''n''.[[UID]] || R || Gets the UID of the nth opponent who has damaged the character. (zero-based)
 +
|-
 +
| ''n''.[[THREAT]] || RW || Gets or Sets the Threat generated by the enemy to this character, NPCs will attack the character with most Threat in certain Distance when in LOS (Check for [[TARGET]]).
 +
|-
 +
| ''n''.[[DELETE]] || W || Remove this opponet from the list.
 
|}
 
|}
  
Line 38: Line 52:
 
You will see ''number of attacker'' output to the console.
 
You will see ''number of attacker'' output to the console.
  
 +
'''ATTACKER'''''[.ID]'''
 +
----
 +
<spherescript>
 +
[EVENTS e_example]
 +
ON=@GetHit
 +
Serv.Log <src.name> is the attacker number '<attacker.id <src>>' on my list.
 +
</spherescript>
  
 
'''ATTACKER'''''.n'''''[.UID]'''
 
'''ATTACKER'''''.n'''''[.UID]'''
Line 83: Line 104:
  
 
You will see ''the attacker who dealt the most damage to the character'' output to the console.
 
You will see ''the attacker who dealt the most damage to the character'' output to the console.
 +
 +
'''ATTACKER.TARGET'''
 +
----
 +
<spherescript>
 +
[Events e_example]
 +
On=@Death
 +
ref1=<attacker.target>
 +
SERV.LOG My current target is: <ref1.name>
 +
</spherescript>
 +
 +
This will output in the console the name of the current best target.
 +
 +
Note: Enabling NPC_AI_THREAT in the ini's npc_ai settings will make characters to check for Threat when looking for targets.
  
  
Line 90: Line 124:
 
[Events e_example]
 
[Events e_example]
 
On=@Death
 
On=@Death
SERV.LOG Damage from first player: <attacker.0.damage>
+
SERV.LOG Damage from first player: <attacker.0.dam>
 
</spherescript>
 
</spherescript>
  

Latest revision as of 09:49, 2 May 2014

Help
Available languages


Properties and Functions

Here is a list of all attacker properties and functions. If a function is marked as readable then it can return a value when used as <KEY>. Click on the name for more detailed information such as usage and examples.

This parameters must use with ATTACKER. For examples, please go Examples.

ATTACKER.key Read/Write Description
R Gets the number of opponents who have damaged the character.
n R Gets the UID of the nth opponent who has damaged the character. (zero-based)
CLEAR R Clears the attacker list
LAST R Gets the UID of the opponent who most recently damaged the character.
MAX R Gets the UID of the opponent who has dealt the most damage to the character.
ID R Gets the Attacker.number of the specified character, -1 if its not in the attacker list for this character.
TARGET R Returns the UID of this character's best target with this priorities (Threat -> Distance -> LOS).
ADD W Add this uid to the attacker list.
DELETE W Removes this uid from the attacker list
n.DAMAGE RW Gets or Sets the amount of damage that the nth opponent has dealt to the character. (zero-based)
n.ELAPSED RW Gets or Sets the length of time since the nth opponent has damaged the character, in seconds. (zero-based)
n.UID R Gets the UID of the nth opponent who has damaged the character. (zero-based)
n.THREAT RW Gets or Sets the Threat generated by the enemy to this character, NPCs will attack the character with most Threat in certain Distance when in LOS (Check for TARGET).
n.DELETE W Remove this opponet from the list.

Examples

The following examples are about attacker.


ATTACKER


[Events e_example]
On=@Death
    SERV.LOG Number Of Attacker: <attacker>

You will see number of attacker output to the console.

'ATTACKER[.ID]


[EVENTS e_example]
ON=@GetHit
    Serv.Log <src.name> is the attacker number '<attacker.id <src>>' on my list.

ATTACKER.n[.UID]


[Events e_example]
On=@Death
    SERV.LOG First Attacker: <uid.<attacker.0>.name>
    SERV.LOG Fourth Attacker: <uid.<attacker.3.uid>.name>

You will see first and fourth attackers output to the concole.

OR

[Events e_example]
On=@Death
    for 0 <eval <ATTACKER>-1>
        SERV.LOG <eval <DLOCAL._FOR>+1>. Attacker: <uid.<attacker.<dlocal._for>>.name>
    endfor

You will see all attackers output to the console.


ATTACKER.LAST


[Events e_example]
On=@Death
    SERV.LOG Last Attacker: <uid.<attacker.last>.name>

You will see last attacker output to the console.


ATTACKER.MAX


[Events e_example]
On=@Death
    SERV.LOG Max Attacker: <uid.<attacker.max>.name>

You will see the attacker who dealt the most damage to the character output to the console.

ATTACKER.TARGET


[Events e_example]
On=@Death
    ref1=<attacker.target>
    SERV.LOG My current target is: <ref1.name>

This will output in the console the name of the current best target.

Note: Enabling NPC_AI_THREAT in the ini's npc_ai settings will make characters to check for Threat when looking for targets.


ATTACKER.n.DAMAGE


[Events e_example]
On=@Death
    SERV.LOG Damage from first player: <attacker.0.dam>

You will see amount of damage which first attacker has dealt output to the console.


ATTACKER.n.ELAPSED


[Events e_example]
On=@Death
    SERV.LOG Attack time of the first player: <attacker.0.elapsed>

You will see the length of time since the first opponent has damaged output to the console.