• 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.

units energy..

Status
Not open for further replies.
Level 3
Joined
May 10, 2007
Messages
39
hey.
i wanna make a unit lose "energy" (mana) when it moves, runs, attacks.... etc...
how do i do that? oh and i dont want to make its mana regen -... like the destroyer when his losin mana... when just standing... i want it to recover mana when its standin and lose when more etc...
 
Level 19
Joined
Apr 25, 2006
Messages
1,309
If you do this for only one unit, it could be simple.
Initialization: Set Old Point Variable=position of your unit


Event:Every 0.5 seconds or something
Actions:
If Distance between your unit and Old Point Variable more than 0 or something
Then
Unit - remove mana equal to Distance between your unit and Old Point Variable*something
Set Old Point variable=position of your unit
else
Unit - Add mana equal to something

Event:Unit attacks
Condition:Attacking unit equak to your unit
Actions Unit - Remove mana equal to something

Also if you teleport your unit you always need to automatically set Old Point Variable to position of your unit so it would not lose all of it's mana for teleporting across the map.

Basically you can do something like this if you want to.
 
Status
Not open for further replies.
Top