TalentMeleeAttacked(object)

Determines best course of action for NPC spell-caster when in melee combat.

int TalentMeleeAttacked(
    object oIntruder = OBJECT_INVALID
);

Parameters

oIntruder

(Default: OBJECT_INVALID)


Description

Function runs through list of TOUCH, RANGED and AREA EFFECT talents that OBJECT_SELF may have, tried to determine the best one, failing that, determines a random talent attack of the above type.

IF OBJECT_SELF currently in combat with more than 1 foe, checks AREA EFFECT, TOUCH and RANGED talents (in that order.) with same checks for validity.



Remarks

ISSUE 1: The check in this function to use a random ability after failing to use best will fail in the following case.

The creature is unable to affect the target with the spell and has only 1 spell of that type.

This can be eliminated with a check in the else to the effect of : else if(!CompareLastSpellCast(GetIdFromTalent(tUse)))

This check was not put in in version 1.0 due to time constraints.

ISSUE 2: Given the Spell Attack is the drop out check the else statements in this talent should be cut.


Requirements

#include "nw_io_generic"

Version

1.29

See Also

functions: TalentMeleeAttack | TalentRangedAttackers | TalentRangedEnemies | TalentSpellAttack
categories: Combat Actions Functions | Core AI Functions
events: OnCombatRoundEnd Event | OnPhysicalAttacked Event


 author: Jody Fletcher
 Send comments on this topic.