GetLastWeaponUsed(object)

Get the last weapon that oCreature used in an attack.

object GetLastWeaponUsed(
    object oCreature
);

Parameters

oCreature

The creature you wish to examine.


Description

Returns the last weapon object that oCreature used in an attack.
Returns OBJECT_INVALID if oCreature did not attack, or has no weapon equipped.



Remarks

Can be used to determine scripted bonuses/immunities against weapon types or to perform actions against the weapons used against a creature or object (such as destroying them).

GetLastWeaponUsed() returns an object, but now you need to get more information from that object. For example, you can get its tag using the GetTag() function to see if it has the tag you're looking for (good if there's a particular weapon that you're checking for), or you could get its base item type (which is good if you're looking for something like "any handax").


Version

1.22

Example

object oWeapon = GetLastWeaponUsed(oPC)
int iWeapType = GetBaseItemType(oWeapon);
if (iWeapType == BASE_ITEM_HANDAXE)

See Also

functions: GetBaseItemType | GetLastAttacker | GetLastHostileActor | GetLastUsedBy | GetTag
categories: Combat Information Functions | Get Data from Creature Functions
events: OnDamaged Event | OnUsed Event


 author: John Shuell, editor: Maximus, additional contributor(s): Rhone11