Returns the equipped melee weapon of a spell target.

object IPGetTargetedOrEquippedMeleeWeapon();


This function is to be used within a spell script.

If the spell target is an item, the function checks whether the item is a melee weapon and returns the weapon on a successful check. The weapon need not be equipped.

If the spell target is a creature, the function checks whether the creature has a melee weapon equipped and returns it.

If the targeted creature has no melee weapon equipped or the targeted item is not a melee weapon, OBJECT_INVALID is returned.


This function only produces reliable results if called from a spell script. It calls GetSpellTargetObject which only makes sense within a spell script.

The function uses 2da lookups to determine whether the item is a melee weapon, so it might be slow if the relevant 2da file (baseitems.2da) is not cached.

This is an internal function. See the note near the top of #include index for more details.


#include "x2_inc_itemprop"



See Also

functions:  IPGetTargetedOrEquippedArmor
constants:  BASE_ITEM_*
categories:  Get Data from Creature Functions | Get Data from Object Functions | Item Properties Functions

author: motu99, editor: Mistress