GetIsWeaponEffective(object, int)
Check whether script owner's equipped weapon is able to damage a given object.
int GetIsWeaponEffective(
object oVersus = OBJECT_INVALID,
int bOffHand = FALSE
);
Parameters
- oVersus
- Object to test weapon against. (Default: OBJECT_INVALID)
- bOffHand
- Check weapon equipped in off-hand? (Default: FALSE)
Description
Returns TRUE if it's possible for the script's owner to damage the given object with its equipped weapon, or the weapon in question has the item property ITEM_PROPERTY_ONHITCASTSPELL.
If bOffHand=TRUE, then the off-hand weapon is tested instead, or if the creature has a double bladed weapon equipped will test that.
Remarks
This function must be called from a script which is "owned" by the creature whose weapon is to be tested.
The oVersus argument need not be a creature. For example, using a chest as the argument would normally return TRUE, but if the chest's plot flag is checked, then this function will return FALSE. What is tested when the object is invalid, who knows? That the weapon deals any kind of damage in general? If so this will always be the case.
Also, an actual weapon need not be present. If no weapon is equipped, the creature's bare-handed attack is tested.
The results of this are similar to what is used to having the player popup "this is not effective" except the item property check. You can replicate this in nwscript now with GetEffectInteger to test effects and item properties and placeable hardness against the item damage amounts.
Version
1.22
See Also
| functions: | ActionEquipMostDamagingMelee, ActionEquipMostDamagingRanged |
author: Jason Harris, editor: Kristian Markon