ActionEquipMostDamagingMelee(object, int)

Causes the calling creature to equip its most damaging weapon.

void ActionEquipMostDamagingMelee(
    object oVersus = OBJECT_INVALID,
    int bOffHand = FALSE
);

Parameters

oVersus

Object used to determine the most damaging weapon against. (Default: OBJECT_INVALID)

bOffHand

Determines if an off-hand weapon is equipped. (Default: FALSE)


Description

The creature will equip the melee weapon in its possession that can do the most damage (specifically against oVersus, if it is not OBJECT_INVALID). If no valid melee weapon is found, it will equip the most damaging ranged weapon.

This only takes into account the enchantment bonuses of the weapon - anything such as improved damage, or attack bonuses, seem to be ignored.



Remarks

This function should only ever be called in the EndOfCombatRound (the onCombatRoundEnd script, or uncomment the line with NW_FLAG_END_COMBAT_ROUND_EVENT in the onSpawn script and use the onUserDefined script) scripts, because otherwise it would have to stop the combat round to run simulation.

As with all ActionEquip* functions, it is not necessary to first unequip the current item in the same inventory slot before equipping the new item.


Version

1.61

See Also

functions: ActionEquipMostDamagingRanged | ActionEquipMostEffectiveArmor | EquipAppropriateWeapons
categories: Action on Object Functions | Combat Actions Functions


 author: Troels Therkelsen, editor: Jasperre, additional contributor(s): Jasperre
 Send comments on this topic.