ActionEquipMostDamagingRanged(object)
Causes the calling creature to equip the most damaging ranged weapon in its inventory.
void ActionEquipMostDamagingRanged( object oVersus = OBJECT_INVALID );
Parameters
oVersus
Target object to determine the most damaging type of weapon against. (Default: OBJECT_INVALID)
Description
The creature will equip the ranged weapon in its possession that can do the most damage (specifically against oVersus, if that is not OBJECT_INVALID). If no valid range weapon can be found, it will equip the most damaging melee 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
Example
// Make the NPC in conversation equip the most damaging ranged weapon against the PC, readying for combat! void main() { // Get PC object oPC = GetPCSpeaker(); // Most damaging ranged (or failing ranged, a melee weapon). ActionEquipMostDamagingRanged(oPC); }
See Also
functions: | ActionEquipMostDamagingMelee | ActionEquipMostEffectiveArmor | EquipAppropriateWeapons |
categories: | Action on Object Functions | Combat Actions Functions |
author: Troels Therkelsen, editor: Jasperre, additional contributor(s): Brian O'keefe, Jasperre
Send comments on this topic.