• 🏆 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!
  • It's time for the first HD Modeling Contest of 2024. Join the theme discussion for Hive's HD Modeling Contest #6! Click here to post your idea!

How to create if a unit never get attacked , the unit life will recover to full after

Status
Not open for further replies.
Level 6
Joined
Mar 9, 2009
Messages
175
How to create if a unit never get attacked , the unit life will recover to full after a few seconds ?? Guys please help me ^__^:vw_death:



Thanks you :vw_sleep:
 
Level 33
Joined
Mar 27, 2008
Messages
8,035
You mean like:
The unit has remaining HP of 33/100
It doesn't get attacked for the last 5 seconds
In and instant after 5 seconds of not getting damaged/hit, his HP straight recover back to 100/100 ?

Tell me, is this unit only available only once per game ?
Or, it can be used as more than one ?
I mean we can buy/create this unit more than 1 in a game
 
Level 5
Joined
Nov 30, 2010
Messages
184
This reminds me of halo's energy shield...
Trigger:
Event: every 1 second
Condition:
Action: pick every unit in playable map area and do actions
---------Loop:
------------load 0 of unit key of picked unit in healhashtable to heal integer
------------set healinteger to healinteger - 1
------------save healinteger as 0 of unit key of picked unit in healhashtable

Trigger2:
Event: unit is attacked
Condition:
Action: load 0 of unit key of attacked unit in healhastable to healreset
---------Set healreset to 10

Trigger3:
Event: every 0.5 seconds
Condtion:
Action: pick every unit in playable map area
---------Loop:
------------load 0 of unit key of picked unit in healhashtable to healnumber
------------if then else multiple functions
------------if healnumber is less than or equal to 0
------------then set life of picked unit to 100%
-----------------set healnumber to 10
-----------------save healnumber as 0 of unit key of picked unit in healhashtable
------------else

The first trigger makes the energy shield cooldown. The second makes the energy shield reset and the third makes the energy shield heal you. The 10 makes the shield cooldown in 10 seconds. You can change it to suit you.
 
Level 5
Joined
Nov 30, 2010
Messages
184
This reminds me of halo's energy shield...
Trigger:
Event: every 1 second
Condition:
Action: pick every unit in playable map area and do actions
---------Loop:
------------load 0 of unit key of picked unit in healhashtable to heal integer
------------set healinteger to healinteger - 1
------------save healinteger as 0 of unit key of picked unit in healhashtable

Trigger2:
Event: unit is attacked
Condition:
Action: load 0 of unit key of attacked unit in healhastable to healreset
---------Set healreset to 10

Trigger3:
Event: every 0.5 seconds
Condtion:
Action: pick every unit in playable map area
---------Loop:
------------load 0 of unit key of picked unit in healhashtable to healnumber
------------if then else multiple functions
------------if healnumber is less than or equal to 0
------------then set life of picked unit to 100%
-----------------set healnumber to 10
-----------------save healnumber as 0 of unit key of picked unit in healhashtable
------------else

The first trigger makes the energy shield cooldown. The second makes the energy shield reset and the third makes the energy shield heal you. The 10 makes the shield cooldown in 10 seconds. You can change it to suit you.
 
Level 5
Joined
Nov 30, 2010
Messages
184
Btw instead of Load 0 of unit key of picked unit in healhashtable to healinteger it is actually set healinteger equal load 0 of unit key of picked unit in healhashtable.
 
Status
Not open for further replies.
Top