#include "x2_inc_switches"
#include "nw_i0_generic"
void main()
{
SetCreatureOverrideAIScriptFinished(OBJECT_SELF);
object oEnemy = GetNearestEnemy();
if(GetIsObjectValid(oEnemy))
{
ClearAllActions();
float fRange = GetDistanceBetween(OBJECT_SELF,oEnemy);
if(fRange > 8.0)//long distance
{
if(GetHasSpell(SPELLABILITY_BOLT_ACID) && GetHasSpell(SPELLABILITY_BOLT_POISON))
{//has both so choose random one
ActionCastSpellAtObject(d2() == 2 ? SPELLABILITY_BOLT_ACID : SPELLABILITY_BOLT_POISON,oEnemy);
return;
}
else if(GetHasSpell(SPELLABILITY_BOLT_ACID))
{
ActionCastSpellAtObject(SPELLABILITY_BOLT_ACID,oEnemy);
return;
}
else if(GetHasSpell(SPELLABILITY_BOLT_POISON))
{
ActionCastSpellAtObject(SPELLABILITY_BOLT_POISON,oEnemy);
return;
}
}
else//short distance
{
if(GetHasSpell(SPELLABILITY_CONE_ACID) && GetHasSpell(SPELLABILITY_CONE_POISON))
{//has both so choose random one
ActionCastSpellAtObject(d2() == 2 ? SPELLABILITY_CONE_ACID : SPELLABILITY_CONE_POISON,oEnemy);
return;
}
else if(GetHasSpell(SPELLABILITY_CONE_ACID))
{
ActionCastSpellAtObject(SPELLABILITY_CONE_ACID,oEnemy);
return;
}
else if(GetHasSpell(SPELLABILITY_CONE_POISON))
{
ActionCastSpellAtObject(SPELLABILITY_CONE_POISON,oEnemy);
return;
}
}
ActionAttack(oEnemy);
}
}
ok so go into script editor past this script and save it under some name, since I am author it would be kind to use my prefix like "sh_ai_treeimp" and compile it.
so now you must set this script into your "Tree Imp"
'>. Find him in palette or location (if you put him in manually) and set him this variable:
X2_SPECIAL_COMBAT_AI_SCRIPT | string | sh_ai_treeimp
now it should work, test it, I tried it and it worked just fine
Modifié par ShaDoOoW, 06 mars 2011 - 04:08 .