How to cast spell using trigger?

Status
Not open for further replies.

hstanley

H

hstanley

Hi

As above, i want to make a hero upon reaching life less than 50 cast spell on attacking unit?

Thanks
 
If you want to make him cast some of his spells just order him to cast the spell his spell was based on. Example if he has a spell called rain of fire which is based on blizzard, order him to human archmage-blizzard. In that case he will cast only if he can (coooldown mana etc)

If you want to make him always cast it(regardless mana and cooldown) create a dummy, give it the spell and order it to cast it the same way.
 
  • Spell Casting
    • Events
      • Unit - A unit Is attacked
    • Conditions
      • (Life of (Triggering unit)) Less than 50.00
    • Actions
      • Unit - Create 1 Dummy for Player 1 (Red) at (Position of (Triggering unit)) facing Default building facing degrees
      • Unit - Add <Some Spell> to (Last created unit)
      • Unit - Order (Last created unit) to <Some Order> (Attacking unit)
      • Unit - Add a 1.50 second Generic expiration timer to (Last created unit)
This would be an example, I know this leaks, but I just wanted to show you how it works
 
Silvenon showed how this works quite well with that trigger above.

Just to help you with how the "Order" action works; Each ability has a "Orderstring", you can find this in the Object Editor:

Text - Order String - Use/Turn On: <"a orderstring here">

The orderstring for, say chainlightning, is "chainlightning", but it is not always that simple.

The orderstring can be changed to another one, example, you can change the chainlightning abilitys' orderstring to "cyklone". But it always has to have the orderstring of an ability which has the same targets. For example, a point targeted orderstring (ex: blink) cant be used for a unit targeted ability (ex chainlightning).

So the only thing you have to worry about is that the trigger uses the same orderstring that the ability you want to use have.

Maybe you knew all this, wasting my time then... :)
 
Status
Not open for further replies.
Back
Top