Difference between revisions of "GetLastAttacker"

From NWN Lexicon
Jump to: navigation, search
(Created page with " =GetLastAttacker(object)= Determine who last attacked a creature, door or placeable object. object  GetLastAttacker(     [[object | object ]...")
 
 
(2 intermediate revisions by one other user not shown)
Line 7: Line 7:
 
Determine who last attacked a creature, door or placeable object.
 
Determine who last attacked a creature, door or placeable object.
  
[[object | object ]] GetLastAttacker(
+
<nwscript>
    [[object | object ]] oAttackee = OBJECT_SELF
+
object GetLastAttacker(
);
+
    object oAttackee = OBJECT_SELF
 +
);
 +
</nwscript>
  
 
====Parameters====
 
====Parameters====
Line 21: Line 23:
 
====Description====
 
====Description====
  
Returns the last attacker of oAttackee. This should be used ONLY in the OnPhysicalAttacked events for creatures, placeables and doors. <br /> Return OBJECT_INVALID on error.
+
Returns the last attacker of oAttackee. This is usually used in the OnPhysicalAttacked events for creatures, placeables and doors. <br /> Return OBJECT_INVALID on error.
  
 
<br /><br />
 
<br /><br />
  
====Remarks====
+
====Remarks===
  
Remarks: I cannot for the life of me figure out why the description for this function says it should only be called from OnPhysicalAttacked. I’ve tried calling it from all sorts of events, even some not owned by the creature, and all of them work just fine, even a while after I’ve stopped attacking oAttackee.
+
It is most consistent to use this in the [[OnPhysicalAttacked]] event. However any script can call this using the oAtackee parameter. However do not expect it to keep the value in there and it might be cleared at any time outside of the OnPhysicalAttacked event itself.
  
 
<br />
 
<br />

Latest revision as of 12:23, 22 June 2020



GetLastAttacker(object)

Determine who last attacked a creature, door or placeable object.

object GetLastAttacker(
    object oAttackee = OBJECT_SELF
);

Parameters

oAttackee

Attacked object. (Default: OBJECT_SELF)


Description

Returns the last attacker of oAttackee. This is usually used in the OnPhysicalAttacked events for creatures, placeables and doors.
Return OBJECT_INVALID on error.



=Remarks

It is most consistent to use this in the OnPhysicalAttacked event. However any script can call this using the oAtackee parameter. However do not expect it to keep the value in there and it might be cleared at any time outside of the OnPhysicalAttacked event itself.


Version

1.30

See Also

functions: 

GetTotalDamageDealt

events: 

OnPhysicalAttacked Event



 author: Jason Harris, editor: Lilac Soul, additional contributor(s): Lilac Soul