• 🏆 Texturing Contest #33 is OPEN! Contestants must re-texture a SD unit model found in-game (Warcraft 3 Classic), recreating the unit into a peaceful NPC version. 🔗Click here to enter!

How do you make a computer player cast spells

Status
Not open for further replies.
Level 4
Joined
Mar 5, 2006
Messages
46
I have a tower defense game and i want spawned creeps to cast spells automatically when they encounter an enemy, how do i do this?

I tried putting an ability on them and setting them to default, i tried turning them into Neutral Hostile controlled but they still wont cast.

If possible i dont want GUI solutions.
 
Level 19
Joined
Feb 25, 2009
Messages
2,004
Erm... try to make the unit cast the ability when its attacked:

  • Trigger Name
    • Events
      • Unit - A unit Is attacked
    • Conditions
      • (Unit-type of (Triggering unit)) Equal to Footman
    • Actions
      • Unit - Order (Attacked unit) to Human Blood Mage - Banish (Attacking unit)
Don't forget to give the unit the order to continue move, or it will only the cast the spell and stay at one point.
And make a condition that checks if the attacking unit already has the buff from the spell or all units will cast it on the first target.
 
Level 9
Joined
Aug 27, 2009
Messages
473
GUI is the only (Of course vJass and Jass, but i think GUI is best for you..)
First make a new trigger, then add this event:

Unit - A unit is attacked

Then add this conditions:
Unit type of attacked unit equal to <unit with spell>

Then add this action:
Order attacking unit to cast <spell> on attacking unit

This is made without opening WE, so this is not 100% how its writen in Trigger Editor, but thats how basic it is. Add new triggers for each spells.. And if you want to add many spells on 1 unit, then ask agein.
 
Status
Not open for further replies.
Top