Jump to content

Better mage ai


sillirion

Recommended Posts

Hello, guys i'm trying to make a script who make the mage check the weakness to elements before attacking with the good spell but i can't make it work any help?

(compile fine but doesn't work ingame,tryied addspell,equipspell...)

 

Scriptname SmartMageAi extends Actor

SPELL Property Fireball  Auto

SPELL Property IceSpike  Auto  

SPELL Property LightningBolt  Auto

SPELL Property sortpardefault  Auto  

SPELL Property monsort  Auto  

MagicEffect Property AbWeaknessFireConstant  Auto

MagicEffect Property AbWeaknessFrostConstant  Auto  

MagicEffect Property AbWeaknessMagicConstant  Auto  

MagicEffect Property VampireAbWeaknessFireConstant  Auto         

Event OnCombatStateChanged(Actor akTarget, int aeCombatState)

if aeCombatState > 0
     Self.RemoveSpell(monsort)      
     if akTarget.HasmagicEffect(AbWeaknessFireConstan)
        monsort = Fireball
     elseif akTarget.HasmagicEffect(AbWeaknessFrostConstant)
        monsort = IceSpike            
     elseif akTarget.HasmagicEffect(AbWeaknessMagicConstant)
        monsort = LightningBolt
  Elseif akTarget.HasmagicEffect(VampireAbWeaknessFireConstant)
        monsort = Fireball
     Else
        monsort = sortpardefault
     EndIf
     self.addSpell(monsort)

ENDIF
 
ENDEVENT
Link to comment
Share on other sites

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...