IPGetIsMeleeWeapon(object)
Checks if an item is a melee weapon.
int IPGetIsMeleeWeapon( object oItem );
Parameters
oItem
Object to check whether is a melee weapon.
Description
Returns TRUE if oItem is a melee weapon.
Remarks
Checks the base item type against the list of types that are known to be melee weapons.
Previously noted was that !GetWeaponRanged() could be used. Of course, this can only be used if the object tested is definatly a weapon of some sort (for example, the object right hand). In some cases (for example, the left hand) this cannot be always tested sucessfully, and this function can be used instead.
Requirements
#include "x2_inc_itemprop"
Version
1.62
Example
// Speak something if the PC speaker has a melee weapon // equipped. // Conversation action. #include "x2_inc_itemprop" void main() { // Get PC Speaker object oPC = GetPCSpeaker(); // Get object in right hand object oObject = GetItemInSlot(INVENTORY_SLOT_RIGHTHAND, oPC); // Check if melee weapon, or not. if(IPGetIsMeleeWeapon(oItem)) { // Speak a (not at all witty) response SpeakString("Armed for melee fights eh? Well good luck to you! You'll need it!"); } }
See Also
functions: | GetWeaponRanged | IPGetIsBludgeoningWeapon | IPGetIsProjectile | IPGetIsRangedWeapon |
categories: | Get Data from Object Functions | Item Properties Functions |
author: Lilac Soul, editor: Jasperre, additional contributor(s): wyrmwood