You said:
if(GetDistanceBetween(oAssociate, oClicked) > 19.0 ){
AssignCommand(oAssociate, ClearAllActions() );
AssignCommand(oAssociate, ActionMoveToObject(oClicked, FALSE, 19.0) );
}
// hopefully, this will work for all spell-like abilities as well as spells
// currently, it only seems to work when an enemy is within range of their spells
AssignCommand(oAssociate, bchFunctionIgnoreInt(TalentSpellAttack(oClicked) ) );
This line looks questionable to me:
AssignCommand(oAssociate, bchFunctionIgnoreInt(TalentSpellAttack(oClicked) ) );
I'm not sure that it captures the TalentSpellAttack(oClicked) call. It might be trying to call TalentSpellAttack immediately and pass the result into bchFunctionIgnoreInt which is then called later. That would also explain why it only works if you are already within spell range. If you are too far away, then the immediate call to TalentSpellAttack doesn't do anything since it actually happens before the move command.
How about trying these two things.
----------------------------
1) make a new function:
void MyCast( object target )
{
SpeakString("Casting Spell");
ActionCastSpellAtObject(SPELL_MAGIC_MISSILE, target, METAMAGIC_ANY, TRUE );
}
Replace the line:
AssignCommand(oAssociate, bchFunctionIgnoreInt(TalentSpellAttack(oClicked) ) );
with
AssignCommand(oAssociate, MyCast(oClicked) );
See if that runs. Hopefully the speak and the spell will get cast.
--------------------------------------
2) If the first one works then make a new function:
#include "x0_i0_talent"
void MySpellAttack( object target )
{
TalentSpellAttack(target);
}
Replace the line:
AssignCommand(oAssociate, bchFunctionIgnoreInt(TalentSpellAttack(oClicked) ) );
with
AssignCommand(oAssociate, MySpellAttack(oClicked) );
Modifié par Mudeye, 30 septembre 2010 - 04:21 .