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

[Trigger] Damage Trigger

Status
Not open for further replies.
Level 4
Joined
Apr 26, 2008
Messages
67
Okay, so i have this multi board and i want it to display the Damage done by a unit, like overall damage. When a unit attacks another unit i want it to "add" all the damage up on the multiboard. This is what i have so far and i cant seem to find an action to make this work. Here is that i have so far.

  • Red Damage Done
    • Events
      • Unit - A unit Is attacked
    • Conditions
      • ((Triggering unit) is A Hero) Equal to True
      • (Owner of (Attacking unit)) Equal to Player 1 (Red)
    • Actions
      • Set Multi_Board_Damage1[(Player number of (Owner of (Attacking unit)))] = ((Owner of (Attacking unit)) Total Overall Score)
      • Multiboard - Set the text for Multi_Board item in column 3, row (1 + (Player number of (Owner of (Killing unit)))) to (String(Multi_Board_Damage1[(Player number of (Owner of (Attacking unit)))]))
Any help on the matter is much appreciated.

Thanks,

-Melthal
 
Level 4
Joined
May 4, 2008
Messages
113
What you need is a damage detection system. Heres how to do a simple one in GUI:

There's an event called 'Unit takes Damage' and also an event response ' Damage Taken'. So where is the Takes damage event? Answer: It's not a generic unit even. "Unit takes damage" is a specific unit event, which makes using it in general spells and such quite tricky. So this is how we get around adding the event to a trigger.

Code:
Events
 Unit - A unit enters (Playable map area)

Actions
 Trigger - Add to <YOUR TRIGGER> the event (Entering unit (Takes damage))

NOTE: If a unit enters the playable map area twice, the event will be added twice, and that means the trigger will run twice. If it is possible for units to enter the map twice (being ressurected and such will trigger this), you can adjust that trigger a little:

Code:
Events
 Unit - A unit enters (Playable map area)

Conditions
 (Entering unit) is in DamageTaken Equal to False

Actions
 Add (Entering unit) to DamageTaken
 Add to <YOUR TRIGGER> the event (Entering unit (Takes damage))

DamageTaken is a Unit group variable.

Now, change <YOUR TRIGGER> to the trigger you want to have the 'damage taken' event. Add your conditions and actions and you're done! Now you can use the "Damage taken" event response to do your trigger. Just set the Total Damage variable to "variable + Damage Taken" and update the multiboard! :)

2 notes:
1. If you need to get the integer of how much damage was dealt, when entering integers there is a field "Event Response - Damage Taken" in the dropdown menu. Select that.
2. With the "Damage Taken" event, Triggering unit = the unit taking the damage, and Damage source = the unit dealing it.

Hope that helped!
 
Level 4
Joined
Apr 26, 2008
Messages
67
Were would i set the integer? In the actions with the multi board or with the trigger you said?

Wow, im dumb. Nvm i know were the variable goes lol

Is Damage taken a Variable on the conditions?
 
Last edited by a moderator:
Level 4
Joined
Apr 26, 2008
Messages
67
Ok here are my triggers:

  • Leader Board
    • Events
      • Time - Elapsed game time is 0.05 seconds
    • Conditions
    • Actions
      • Multiboard - Create a multiboard with 4 columns and 12 rows, titled <Empty String>
      • Set Multi_Board = (Last created multiboard)
      • Multiboard - Set the width for Multi_Board item in column 1, row 1 to 9.00% of the total screen width
      • Multiboard - Set the width for Multi_Board item in column 2, row 1 to 3.00% of the total screen width
      • Multiboard - Set the width for Multi_Board item in column 3, row 1 to 8.00% of the total screen width
      • Multiboard - Set the width for Multi_Board item in column 4, row 1 to 7.00% of the total screen width
      • Multiboard - Set the width for Multi_Board item in column 1, row 2 to 9.00% of the total screen width
      • Multiboard - Set the width for Multi_Board item in column 1, row 3 to 9.00% of the total screen width
      • Multiboard - Set the width for Multi_Board item in column 1, row 4 to 9.00% of the total screen width
      • Multiboard - Set the width for Multi_Board item in column 1, row 5 to 9.00% of the total screen width
      • Multiboard - Set the width for Multi_Board item in column 1, row 6 to 9.00% of the total screen width
      • Multiboard - Set the width for Multi_Board item in column 2, row 1 to 3.00% of the total screen width
      • Multiboard - Set the width for Multi_Board item in column 2, row 2 to 3.00% of the total screen width
      • Multiboard - Set the width for Multi_Board item in column 2, row 3 to 3.00% of the total screen width
      • Multiboard - Set the width for Multi_Board item in column 2, row 4 to 3.00% of the total screen width
      • Multiboard - Set the width for Multi_Board item in column 2, row 5 to 3.00% of the total screen width
      • Multiboard - Set the width for Multi_Board item in column 2, row 6 to 3.00% of the total screen width
      • Multiboard - Set the width for Multi_Board item in column 3, row 2 to 8.00% of the total screen width
      • Multiboard - Set the width for Multi_Board item in column 3, row 3 to 8.00% of the total screen width
      • Multiboard - Set the width for Multi_Board item in column 3, row 4 to 8.00% of the total screen width
      • Multiboard - Set the width for Multi_Board item in column 3, row 5 to 8.00% of the total screen width
      • Multiboard - Set the width for Multi_Board item in column 3, row 6 to 8.00% of the total screen width
      • Multiboard - Set the width for Multi_Board item in column 4, row 2 to 7.00% of the total screen width
      • Multiboard - Set the width for Multi_Board item in column 4, row 3 to 7.00% of the total screen width
      • Multiboard - Set the width for Multi_Board item in column 4, row 4 to 7.00% of the total screen width
      • Multiboard - Set the width for Multi_Board item in column 4, row 5 to 7.00% of the total screen width
      • Multiboard - Set the width for Multi_Board item in column 4, row 6 to 7.00% of the total screen width
      • Multiboard - Set the width for Multi_Board item in column 1, row 7 to 9.00% of the total screen width
      • Multiboard - Set the width for Multi_Board item in column 2, row 7 to 3.00% of the total screen width
      • Multiboard - Set the width for Multi_Board item in column 3, row 7 to 8.00% of the total screen width
      • Multiboard - Set the width for Multi_Board item in column 4, row 7 to 7.00% of the total screen width
      • Multiboard - Set the width for Multi_Board item in column 1, row 8 to 9.00% of the total screen width
      • Multiboard - Set the width for Multi_Board item in column 1, row 9 to 9.00% of the total screen width
      • Multiboard - Set the width for Multi_Board item in column 1, row 10 to 9.00% of the total screen width
      • Multiboard - Set the width for Multi_Board item in column 1, row 11 to 9.00% of the total screen width
      • Multiboard - Set the width for Multi_Board item in column 1, row 12 to 9.00% of the total screen width
      • Multiboard - Set the width for Multi_Board item in column 2, row 8 to 3.00% of the total screen width
      • Multiboard - Set the width for Multi_Board item in column 2, row 9 to 3.00% of the total screen width
      • Multiboard - Set the width for Multi_Board item in column 2, row 10 to 3.00% of the total screen width
      • Multiboard - Set the width for Multi_Board item in column 2, row 11 to 3.00% of the total screen width
      • Multiboard - Set the width for Multi_Board item in column 2, row 12 to 3.00% of the total screen width
      • Multiboard - Set the width for Multi_Board item in column 3, row 8 to 8.00% of the total screen width
      • Multiboard - Set the width for Multi_Board item in column 3, row 9 to 8.00% of the total screen width
      • Multiboard - Set the width for Multi_Board item in column 3, row 10 to 8.00% of the total screen width
      • Multiboard - Set the width for Multi_Board item in column 3, row 11 to 8.00% of the total screen width
      • Multiboard - Set the width for Multi_Board item in column 3, row 12 to 8.00% of the total screen width
      • Multiboard - Set the width for Multi_Board item in column 4, row 8 to 7.00% of the total screen width
      • Multiboard - Set the width for Multi_Board item in column 4, row 9 to 7.00% of the total screen width
      • Multiboard - Set the width for Multi_Board item in column 4, row 10 to 7.00% of the total screen width
      • Multiboard - Set the width for Multi_Board item in column 4, row 11 to 7.00% of the total screen width
      • Multiboard - Set the width for Multi_Board item in column 4, row 12 to 7.00% of the total screen width
      • Multiboard - Set the text for Multi_Board item in column 1, row 2 to (|cffff0000 + ((Name of Player 1 (Red)) + |r))
      • Multiboard - Set the text for Multi_Board item in column 1, row 3 to (|cff0000ff + ((Name of Player 2 (Blue)) + |r))
      • Multiboard - Set the text for Multi_Board item in column 1, row 4 to (|cff00ffff + ((Name of Player 3 (Teal)) + |r))
      • Multiboard - Set the text for Multi_Board item in column 1, row 5 to (|cff550088 + ((Name of Player 4 (Purple)) + |r))
      • Multiboard - Set the text for Multi_Board item in column 1, row 6 to (|cffffff00 + ((Name of Player 5 (Yellow)) + |r))
      • Multiboard - Set the text for Multi_Board item in column 1, row 8 to (|cffff8800 + ((Name of Player 6 (Orange)) + |r))
      • Multiboard - Set the text for Multi_Board item in column 1, row 9 to (|cff00ff00 + ((Name of Player 7 (Green)) + |r))
      • Multiboard - Set the text for Multi_Board item in column 1, row 10 to (|cffee55bb + ((Name of Player 8 (Pink)) + |r))
      • Multiboard - Set the text for Multi_Board item in column 1, row 11 to (|cff999999 + ((Name of Player 9 (Gray)) + |r))
      • Multiboard - Set the text for Multi_Board item in column 1, row 12 to (|cff77bbff + ((Name of Player 10 (Light Blue)) + |r))
      • Multiboard - Set the icon for Multi_Board item in column 1, row 2 to ReplaceableTextures\CommandButtons\BTNLordaeronSignetBlue.blp
      • Multiboard - Set the icon for Multi_Board item in column 1, row 3 to ReplaceableTextures\CommandButtons\BTNLordaeronSignetBlue.blp
      • Multiboard - Set the icon for Multi_Board item in column 1, row 4 to ReplaceableTextures\CommandButtons\BTNLordaeronSignetBlue.blp
      • Multiboard - Set the icon for Multi_Board item in column 1, row 5 to ReplaceableTextures\CommandButtons\BTNLordaeronSignetBlue.blp
      • Multiboard - Set the icon for Multi_Board item in column 1, row 6 to ReplaceableTextures\CommandButtons\BTNLordaeronSignetBlue.blp
      • Multiboard - Set the icon for Multi_Board item in column 1, row 8 to ReplaceableTextures\CommandButtons\BTNArmorUPG1.blp
      • Multiboard - Set the icon for Multi_Board item in column 1, row 9 to ReplaceableTextures\CommandButtons\BTNArmorUPG1.blp
      • Multiboard - Set the icon for Multi_Board item in column 1, row 10 to ReplaceableTextures\CommandButtons\BTNArmorUPG1.blp
      • Multiboard - Set the icon for Multi_Board item in column 1, row 11 to ReplaceableTextures\CommandButtons\BTNArmorUPG1.blp
      • Multiboard - Set the icon for Multi_Board item in column 1, row 12 to ReplaceableTextures\CommandButtons\BTNArmorUPG1.blp
      • Multiboard - Set the text for Multi_Board item in column 1, row 1 to |cff0000ffThe Allia...
      • Multiboard - Set the text for Multi_Board item in column 2, row 1 to |cff0000ffKills:|r
      • Multiboard - Set the text for Multi_Board item in column 3, row 1 to |cff0000ffDamage Do...
      • Multiboard - Set the text for Multi_Board item in column 4, row 1 to |cff0000ffHealing D...
      • Multiboard - Set the text for Multi_Board item in column 1, row 7 to |cffff0000The Horde...
      • Multiboard - Set the text for Multi_Board item in column 2, row 7 to |cffff0000Kills:|r
      • Multiboard - Set the text for Multi_Board item in column 3, row 7 to |cffff0000Damage Do...
      • Multiboard - Set the text for Multi_Board item in column 4, row 7 to |cffff0000Healing D...
      • Multiboard - Set the display style for Multi_Board item in column 1, row 1 to Show text and Hide icons
      • Multiboard - Set the display style for Multi_Board item in column 2, row 1 to Show text and Hide icons
      • Multiboard - Set the display style for Multi_Board item in column 3, row 1 to Show text and Hide icons
      • Multiboard - Set the display style for Multi_Board item in column 4, row 1 to Show text and Hide icons
      • Multiboard - Set the display style for Multi_Board item in column 1, row 7 to Show text and Hide icons
      • Multiboard - Set the display style for Multi_Board item in column 2, row 7 to Show text and Hide icons
      • Multiboard - Set the display style for Multi_Board item in column 3, row 7 to Show text and Hide icons
      • Multiboard - Set the display style for Multi_Board item in column 4, row 7 to Show text and Hide icons
      • Multiboard - Set the display style for Multi_Board item in column 2, row 2 to Show text and Hide icons
      • Multiboard - Set the display style for Multi_Board item in column 2, row 3 to Show text and Hide icons
      • Multiboard - Set the display style for Multi_Board item in column 2, row 4 to Show text and Hide icons
      • Multiboard - Set the display style for Multi_Board item in column 2, row 5 to Show text and Hide icons
      • Multiboard - Set the display style for Multi_Board item in column 2, row 6 to Show text and Hide icons
      • Multiboard - Set the display style for Multi_Board item in column 2, row 8 to Show text and Hide icons
      • Multiboard - Set the display style for Multi_Board item in column 2, row 9 to Show text and Hide icons
      • Multiboard - Set the display style for Multi_Board item in column 2, row 10 to Show text and Hide icons
      • Multiboard - Set the display style for Multi_Board item in column 2, row 11 to Show text and Hide icons
      • Multiboard - Set the display style for Multi_Board item in column 2, row 12 to Show text and Hide icons
      • Multiboard - Set the display style for Multi_Board item in column 3, row 2 to Show text and Hide icons
      • Multiboard - Set the display style for Multi_Board item in column 3, row 3 to Show text and Hide icons
      • Multiboard - Set the display style for Multi_Board item in column 3, row 4 to Show text and Hide icons
      • Multiboard - Set the display style for Multi_Board item in column 3, row 5 to Show text and Hide icons
      • Multiboard - Set the display style for Multi_Board item in column 3, row 6 to Show text and Hide icons
      • Multiboard - Set the display style for Multi_Board item in column 3, row 8 to Show text and Hide icons
      • Multiboard - Set the display style for Multi_Board item in column 3, row 9 to Show text and Hide icons
      • Multiboard - Set the display style for Multi_Board item in column 3, row 10 to Show text and Hide icons
      • Multiboard - Set the display style for Multi_Board item in column 3, row 11 to Show text and Hide icons
      • Multiboard - Set the display style for Multi_Board item in column 3, row 12 to Show text and Hide icons
      • Multiboard - Set the display style for Multi_Board item in column 4, row 2 to Show text and Hide icons
      • Multiboard - Set the display style for Multi_Board item in column 4, row 3 to Show text and Hide icons
      • Multiboard - Set the display style for Multi_Board item in column 4, row 4 to Show text and Hide icons
      • Multiboard - Set the display style for Multi_Board item in column 4, row 5 to Show text and Hide icons
      • Multiboard - Set the display style for Multi_Board item in column 4, row 6 to Show text and Hide icons
      • Multiboard - Set the display style for Multi_Board item in column 4, row 8 to Show text and Hide icons
      • Multiboard - Set the display style for Multi_Board item in column 4, row 9 to Show text and Hide icons
      • Multiboard - Set the display style for Multi_Board item in column 4, row 10 to Show text and Hide icons
      • Multiboard - Set the display style for Multi_Board item in column 4, row 11 to Show text and Hide icons
      • Multiboard - Set the display style for Multi_Board item in column 4, row 12 to Show text and Hide icons
      • Multiboard - Set the text for Multi_Board item in column 2, row 2 to 0
      • Multiboard - Set the text for Multi_Board item in column 2, row 3 to 0
      • Multiboard - Set the text for Multi_Board item in column 2, row 4 to 0
      • Multiboard - Set the text for Multi_Board item in column 2, row 5 to 0
      • Multiboard - Set the text for Multi_Board item in column 2, row 6 to 0
      • Multiboard - Set the text for Multi_Board item in column 2, row 8 to 0
      • Multiboard - Set the text for Multi_Board item in column 2, row 9 to 0
      • Multiboard - Set the text for Multi_Board item in column 2, row 10 to 0
      • Multiboard - Set the text for Multi_Board item in column 2, row 11 to 0
      • Multiboard - Set the text for Multi_Board item in column 2, row 12 to 0
      • Multiboard - Set the text for Multi_Board item in column 3, row 2 to 0
      • Multiboard - Set the text for Multi_Board item in column 3, row 3 to 0
      • Multiboard - Set the text for Multi_Board item in column 3, row 4 to 0
      • Multiboard - Set the text for Multi_Board item in column 3, row 5 to 0
      • Multiboard - Set the text for Multi_Board item in column 3, row 6 to 0
      • Multiboard - Set the text for Multi_Board item in column 3, row 8 to 0
      • Multiboard - Set the text for Multi_Board item in column 3, row 9 to 0
      • Multiboard - Set the text for Multi_Board item in column 3, row 10 to 0
      • Multiboard - Set the text for Multi_Board item in column 3, row 11 to 0
      • Multiboard - Set the text for Multi_Board item in column 3, row 12 to 0
      • Multiboard - Set the text for Multi_Board item in column 4, row 2 to 0
      • Multiboard - Set the text for Multi_Board item in column 4, row 3 to 0
      • Multiboard - Set the text for Multi_Board item in column 4, row 4 to 0
      • Multiboard - Set the text for Multi_Board item in column 4, row 5 to 0
      • Multiboard - Set the text for Multi_Board item in column 4, row 6 to 0
      • Multiboard - Set the text for Multi_Board item in column 4, row 8 to 0
      • Multiboard - Set the text for Multi_Board item in column 4, row 9 to 0
      • Multiboard - Set the text for Multi_Board item in column 4, row 10 to 0
      • Multiboard - Set the text for Multi_Board item in column 4, row 11 to 0
      • Multiboard - Set the text for Multi_Board item in column 4, row 12 to 0
      • Multiboard - Show Multi_Board
  • TakesDamageInit
    • Events
      • Map initialization
    • Conditions
    • Actions
      • Set Temp_Group = (Units in (Playable map area))
      • Unit Group - Pick every unit in Temp_Group and do (Actions)
        • Loop - Actions
          • Unit Group - Add (Picked unit) to DamageGroup
          • -------- IMPORTANT: Add all events here! --------
          • Trigger - Add to Damage Done <gen> the event (Unit - (Picked unit) Takes damage)
      • Custom script: call DestroyGroup (udg_Temp_Group)
  • TakesDamage
    • Events
      • Unit - A unit enters (Playable map area)
    • Conditions
      • ((Triggering unit) is in DamageGroup) Equal to False
    • Actions
      • Unit Group - Add (Triggering unit) to DamageGroup
      • -------- IMPORTANT: Add all events here! --------
      • Trigger - Add to Damage Done <gen> the event (Unit - (Triggering unit) Takes damage)
This trigger isnt right, i was just editing it to see if i could get it working but i had no luck.
  • Damage Done
    • Events
    • Conditions
      • (Unit-type of (Triggering unit)) Equal to Rogue (Combat)
    • Actions
      • Unit - Cause (Triggering unit) to damage (Damage source), dealing (Damage taken) damage of attack type Spells and damage type Normal
      • Multiboard - Set the text for Multi_Board item in column 3, row (1 + (Player number of (Owner of (Killing unit)))) to (String(Multi_Board_Damage1[(Player number of (Owner of (Attacking unit)))]))
 
Level 4
Joined
May 4, 2008
Messages
113
There are several reasons why your last trigger isn't working.

  • Damage Done
  • Events
  • Conditions
  • ((Triggering unit) is A Hero) Equal to True
  • (Owner of (Damage source)) Equal to Player 1 (Red)
  • Actions
  • Set Multi_Board_Damage1[Player number of (Owner of (Damage source))] = Multi_Board_Damage1[Player number of (Owner of (Damage source))] + (Damage taken)
  • Multiboard - Set the text for Multi_Board item in column 3, row (1 + (Player number of (Owner of (Damage source)))) to (String(Multi_Board_Damage1[(Player number of (Owner of (Damage source)))]))
I copied the conditions from the trigger in the first post and put them here, and then made the necessary adjustments to the trigger.
Now it sets the "multi_board_damage1" variable to the variable + the damage taken, and then updates the multiboard with the new value of the variable.

Hope that helps.
 
Level 4
Joined
Apr 26, 2008
Messages
67
Umm, one problem. When i attack someone it doesnt update the multiboard to show how much im doing to them. The value stays at 0.
 
Level 4
Joined
Apr 26, 2008
Messages
67
  • TakesDamageInit
    • Events
      • Map initialization
    • Conditions
    • Actions
      • Set Temp_Group = (Units in (Playable map area))
      • Unit Group - Pick every unit in Temp_Group and do (Actions)
        • Loop - Actions
          • Unit Group - Add (Picked unit) to DamageGroup
          • Trigger - Add to Damage Done <gen> the event (Unit - (Picked unit) Takes damage)
      • Custom script: call DestroyGroup (udg_Temp_Group)

  • TakesDamage
    • Events
      • Unit - A unit enters (Playable map area)
    • Conditions
      • ((Triggering unit) is in DamageGroup) Equal to False
    • Actions
      • Unit Group - Add (Triggering unit) to DamageGroup
      • Trigger - Add to Damage Done <gen> the event (Unit - (Entering unit) Takes damage)
Those are my triggers. And yes. I'm adjusting the right spaces in the board.

  • Damage Done
    • Events
    • Conditions
    • Actions
      • Set Multi_Board_Damage1[(Player number of (Owner of (Damage source)))] = Multi_Board_Damage1[(Player number of (Owner of (Damage source)))]
      • Multiboard - Set the text for Multi_Board item in column 3, row (2 + (Player number of (Owner of (Damage source)))) to (String(Multi_Board_Damage1[(Player number of (Owner of (Damage source)))]))
Okay, all triggers are there.
 
Last edited:
Level 2
Joined
Feb 8, 2009
Messages
16
In this part of the trigger:
  • Set Multi_Board_Damage1[Player number of (Owner of (Damage source))] = Multi_Board_Damage1[Player number of (Owner of (Damage source))] + (Damage taken)
I cant get the
  • + (Damage taken)
to my trigger i cant find the action anywhere. :sad:

Can some one guide on how to put this action with the variable? I cant seem to find it anywhere. :(
 
Last edited:
Status
Not open for further replies.
Top