• Listen to a special audio message from Bill Roper to the Hive Workshop community (Bill is a former Vice President of Blizzard Entertainment, Producer, Designer, Musician, Voice Actor) 🔗Click here to hear his message!
  • Read Evilhog's interview with Gregory Alper, the original composer of the music for WarCraft: Orcs & Humans 🔗Click here to read the full interview.

How to cast spell using trigger?

Status
Not open for further replies.
Level 1
Joined
Jun 7, 2007
Messages
1
Hi

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

Thanks
 
Level 9
Joined
Aug 28, 2005
Messages
271
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.
 
Level 13
Joined
Nov 22, 2006
Messages
1,260
  • 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
 
Level 6
Joined
Feb 25, 2005
Messages
230
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.
Top