• 🏆 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!

Damage Detection System

Status
Not open for further replies.
Level 12
Joined
Nov 3, 2013
Messages
989
Doesn't really look like anybody has answered the OP yet;

Game - GDD_Event becomes Equal to 0.00 = a unit will be damaged

GDD_DamageSource = Unit that deals damage

GDD_DamagedUnit = unit that takes damage

GDD_Damage = how much damage unit will take (after damage reduction)
 
Level 12
Joined
Nov 3, 2013
Messages
989
Game - GDD_Event becomes Equal to 0.00 Happens every time a unit would be damaged so it's fairly easy.

each time a unit gets this absorbtion shield add it to a group.

set variables like how much damage should be absorbed and which unit etc...

set index = index + 1
if index = 1 run trigger first instance created now run the trigger to see if unit's damaged

In the damage trigger check if the damaged unit is in the group

for each integerVar from 1 to index

DamagedUnit == ShieldUnit[integerVar] -> set ShieldAmount = ShieldAmount - Damage

if ShieldAmount[integer] is less than 0.00

set shieldAmount[index] = shield amount [integerVar] (Takes the last created instance and replace the instance which just completed with it)
set ShieldUnit[index] = ShieldUnit[integerVar] Same as before

(do this with all variables)

set integerVar = integerVar - 1 (makes the loop go through this instance again because it's technically a different one now)
set index = index -1 (reduces how many instances are running)

if index = 0 tun off trigger (this trigger) (if no instance is running then no need for this to check)

If the ability can expire after a duration then naturally you must have that too

Also if it's a target ability (like abbadon in dota) then it could be placed on same unit so you need to make it remove the previous and a lot of more stuff than I've explained in detail
 
Status
Not open for further replies.
Top