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

Damage Split Trigger

Status
Not open for further replies.
Level 7
Joined
May 15, 2009
Messages
192
So, I've been trying to create what I thought was a simple damage-splitting system.
What it does is, when a unit (the Depthlord unit type) takes damage, the damage is divided by the number of Depthlords controlled by the player, and the damage is then split amongst these Depth Lords.
Problem is, nothing really appears to be happening, aside from the fact that the Depthlord under attack takes less damage, but no other Depthlords take any damage.

  • Soul Bound Depth Lords
    • Events
      • Game - DamageModifierEvent becomes Equal to 1.00
    • Conditions
      • (Unit-type of DamageEventTarget) Equal to Depth Lord
    • Actions
      • Set DamageEventAmount = (DamageEventAmount / (Real((Number of living Depth Lord units owned by (Owner of DamageEventTarget)))))
      • Custom script: set bj_wantDestroyGroup = true
      • Trigger - Turn off Damage Engine <gen>
      • Unit Group - Pick every unit in (Units in (Playable map area) matching (((Unit-type of (Matching unit)) Equal to Depth Lord) and ((((Matching unit) is dead) Equal to True) and ((Matching unit) Not equal to DamageEventTarget)))) and do (Actions)
        • Loop - Actions
          • Unit - Cause DamageEventSource to damage (Picked unit), dealing DamageEventAmount damage of attack type Hero and damage type Normal
      • Trigger - Turn on Damage Engine <gen>
Help much appreciated.

-Battlehound/Woodenplank
 
Level 7
Joined
May 15, 2009
Messages
192
I'll optimize it by using the same unit group, thx.

Thought I was checking for "matching unit is alive equal to true", turns out I was wrong - stupid of me not to notice that, thank you for pointing it out.

And I figured that I had to turn off the damage detection, else I should get an infinite loop right?
When a Depthlord takes damage - a Depthlord is damage
That could get out of hand fast.

+rep
 
Last edited:
Level 7
Joined
May 15, 2009
Messages
192
Yes, but maybe you want other damage events to trigger. In that case you may consider deactivating this trigger instead of the damage engine.

Right, I'll do that.

Still doesn't work though... Trigger as per changes (it seems that the second Depthlord (there are only 2 atm) only takes damage once).
  • Soul Bound Depth Lords
    • Events
      • Game - DamageModifierEvent becomes Equal to 1.00
    • Conditions
      • (Unit-type of DamageEventTarget) Equal to Depth Lord
    • Actions
      • Unit Group - Pick every unit in (Units in (Playable map area) matching (((Unit-type of (Matching unit)) Equal to Depth Lord) and ((((Matching unit) is dead) Not equal to True) and ((Matching unit) Not equal to DamageEventTarget)))) and do (Actions)
        • Loop - Actions
          • Unit Group - Add (Picked unit) to Tempug
      • Set DamageEventAmount = (DamageEventAmount / (Real((Number of units in Tempug))))
      • Trigger - Turn off (This trigger)
      • Unit Group - Pick every unit in Tempug and do (Actions)
        • Loop - Actions
          • Unit - Cause DamageEventSource to damage (Picked unit), dealing DamageEventAmount damage of attack type Hero and damage type Normal
      • Trigger - Turn on (This trigger)
      • Custom script: call DestroyGroup(udg_Tempug)
 
Level 7
Joined
May 15, 2009
Messages
192
Thx for the help, the trigger seems to be working now. Here's the end result
+rep

  • Soul Bound Depth Lords
    • Events
      • Game - DamageModifierEvent becomes Equal to 1.00
    • Conditions
      • (Unit-type of DamageEventTarget) Equal to Depth Lord
    • Actions
      • Set Tempug = (Units in (Playable map area) matching (((Unit-type of (Matching unit)) Equal to Depth Lord) and ((((Matching unit) is dead) Not equal to True) and (DamageEventTarget Not equal to (Matching unit)))))
      • Set DamageEventAmount = (DamageEventAmount / (Real((Number of units in Tempug))))
      • Trigger - Turn off (This trigger)
      • Unit Group - Pick every unit in Tempug and do (Actions)
        • Loop - Actions
          • Unit - Cause DamageEventSource to damage (Picked unit), dealing DamageEventAmount damage of attack type Hero and damage type Normal
      • Trigger - Turn on (This trigger)
      • Game - Display to (All players) the text: (Living: + (String((Number of living Depth Lord units owned by Player 7 (Green)))))
      • Game - Display to (All players) the text: (Group: + (String((Number of units in Tempug))))
      • Custom script: call DestroyGroup(udg_Tempug)
 
Status
Not open for further replies.
Top