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

Status
Not open for further replies.
Level 10
Joined
Mar 17, 2012
Messages
582
Hello my dear friends!
Explain to a noob how to calculate a damage that hero deals?..
I mean if I want to make lifesteal without any buffs and auras...
give hero life equal to 0.25*(damage) - how to find this damage in triggers???
 
Level 28
Joined
Jan 26, 2007
Messages
4,789
Too hard for my level %)
You just have to copy the triggers (Damage Engine and Unit Indexer) to your map and then you can use any damage event like this:

  • On Damage
    • Events
      • Game - DamageEvent becomes Equal to 1.00
    • Conditions
    • Actions
      • Game - Display to (All players) the text: (Damage Dealt: + (String(DamageEventAmount)))
      • Game - Display to (All players) the text: (Damage Dealer: + (Name of DamageEventSource))
      • Game - Display to (All players) the text: (Damaged Unit: + (Name of DamageEventTarget))
I hope that made sense :).
It's pretty damn easy once you understand how to use it.
 
Level 10
Joined
Mar 17, 2012
Messages
582
You just have to copy the triggers (Damage Engine and Unit Indexer) to your map and then you can use any damage event like this:

  • On Damage
    • Events
      • Game - DamageEvent becomes Equal to 1.00
    • Conditions
    • Actions
      • Game - Display to (All players) the text: (Damage Dealt: + (String(DamageEventAmount)))
      • Game - Display to (All players) the text: (Damage Dealer: + (Name of DamageEventSource))
      • Game - Display to (All players) the text: (Damaged Unit: + (Name of DamageEventTarget))
I hope that made sense :).
It's pretty damn easy once you understand how to use it.

maybe you are right))) but I can't get why do you need to make a massage everytime someone hits smb?))))
 
Level 12
Joined
Sep 11, 2011
Messages
1,176
  • Lifesteal
    • Events
      • Game - DamageEvent becomes Equal to 1.00
    • Conditions
      • Level of (Lifesteal) for (DamageEventSource) Greater than 0
    • Actions
      • Set Lifesteal = (0.25 x (DamageEventAmount))
      • Unit - Set life of (DamageEventSource) to (Life of (DamageEventSource)) + Lifesteal)
 
Level 4
Joined
Dec 12, 2012
Messages
96
it gets very simple if you take more than a second to look at it, gui was made for n00bs :thumbs_up:

I'm a noob and I'd say that ain't for noobs. I had trouble figuring that out myself.

Here is more simpler Trigger for converting DAMAGE INFLICTED into HP. I just recently encountered this problem and just made some changes to use it for Lifesteal. :)

(1) Set the unit into variable
  • Set Lifestealer
    • Events
      • Time - Elapsed game time is 1.00 seconds
    • Conditions
    • Actions
      • Set LifeStealer = Paladin 0000 <gen>

(2) When a unit is attacked by lifestealer
  • When A Unit is Attacked by LifeStealer
    • Events
      • Unit - A unit Is attacked
      • Conditions
        • (Attacking unit) Equal to LifeStealer
      • Actions
        • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
          • If - Conditions
            • Temp_int Equal to 0
          • Then - Actions
            • Trigger - Add to Give Lifestealer HP using Damage <gen> the event (Unit - (Attacked unit) Takes damage)
          • Else - Actions
            • Set Temp_int = 0
(3)Gain HP with Damage Inflicted
  • Give Lifestealer HP using Damage
    • Events
    • Conditions
      • (Damage source) Equal to LifeStealer
    • Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • Temp_int Equal to 0
        • Then - Actions
          • Set Victim_Unit = (Attacked unit)
          • Set Damage_Inflicted = (Integer((Damage taken)))
          • -------- ---------(1)Convert Damage into HP---------- --------
          • Unit - Set life of LifeStealer to ((Life of LifeStealer) + (Real(Damage_Inflicted)))
          • -------- ----------(2)You can add Special Effect here as Life Steal---------- --------
          • -------- ----------(3)Displays the damage you Inflict---------- --------
          • Game - Display to (All players) the text: (String(Damage_Inflicted))
          • Set Temp_int = 1
        • Else - Actions
Temp_int is used to avoid increasing leakage.
I also had provided a test map for you. Hope it works well.
 

Attachments

  • TEST.w3x
    22.8 KB · Views: 117
Level 12
Joined
Sep 11, 2011
Messages
1,176
I found it very hilarious that there is anyone who is having a problem using damage engine, since it's just copying abilities, copying triggers, fixing disabled actions. then you can use it to however you want, gorillabull was right, it's really simple and is intended for those who is unexperienced with world editor, that's why there is some small tutorials in the damage engine thread.

and yet it's clearly stated with a title of "HOW TO INSTALL"
How to install

Copy & paste the Unit Indexer trigger into your map (I recommend replacing it if you have an older version of it as it has new features)
Copy & paste the Damage Engine trigger into your map
Copy the Cheat Death Ability from Object Editor, and set it to the variable DamageBlockingAbility.
It's installed

you don't ever need to know how the triggers bribe's made works, you just need to know how to find use of the system.

why did you need to create 3 triggers, if you can solve it with one trigger?

i'm not trying to be rude.

  • Lifesteal
    • Events
      • Game - DamageEvent becomes Equal to 1.00
    • Conditions
      • Level of (Lifesteal) for (DamageEventSource) Greater than 0
    • Actions
      • Set Lifesteal = (0.25 x (DamageEventAmount))
      • Unit - Set life of (DamageEventSource) to (Life of (DamageEventSource)) + Lifesteal)
 

Attachments

  • Lifesteal.w3x
    28.6 KB · Views: 70
Level 4
Joined
Dec 12, 2012
Messages
96
No offense taken. :p

You're probably right it'll be easy as soon as someone understands how it works or how to use it. But I myself prefer to use triggers that I know exactly how they work.

Yes, these are 3 triggers, but it's definitely more convenient for someone who looks for simpler trigger. :)
 
Level 28
Joined
Jan 26, 2007
Messages
4,789
I can tell you how Bribe's triggers* work, it's pretty easy to understand I believe:
You pick all units in the entire map (ones that are already there and the ones that have yet to spawn) and create a trigger for them. The trigger that gets created detects when that unit receives any damage.
If he does indeed receive damage, a variable is set from 0 to 1 (this is important, because it can be used as an event).
If the unit dies, the trigger is destroyed (so there are no useless triggers left).

The event (from 0 to 1) is therefore used to detect any instance of a damaged unit.
This makes it very easy for any mapper, because that event allows for a very short, but working trigger to detect the damage (and modify it to your needs).

*actually, Weep's damage detection works like this, but Bribe's is based on that one.
I believe one of the differences is that Weep uses regular Indexing, while Bribe uses a unit indexer for that? (Not sure, haven't checked Bribe's system out yet).


Maltheo: your trigger works, but do try to use "Triggering Unit" instead of "Attacked unit" or "Damaged unit" (and so on).
(Also: if the unit dies, you're left with a leaking event).
 
Level 10
Joined
Mar 17, 2012
Messages
582
I'm a noob and I'd say that ain't for noobs. I had trouble figuring that out myself.

Here is more simpler Trigger for converting DAMAGE INFLICTED into HP. I just recently encountered this problem and just made some changes to use it for Lifesteal. :)

(1) Set the unit into variable
  • Set Lifestealer
    • Events
      • Time - Elapsed game time is 1.00 seconds
    • Conditions
    • Actions
      • Set LifeStealer = Paladin 0000 <gen>

(2) When a unit is attacked by lifestealer
  • When A Unit is Attacked by LifeStealer
    • Events
      • Unit - A unit Is attacked
      • Conditions
        • (Attacking unit) Equal to LifeStealer
      • Actions
        • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
          • If - Conditions
            • Temp_int Equal to 0
          • Then - Actions
            • Trigger - Add to Give Lifestealer HP using Damage <gen> the event (Unit - (Attacked unit) Takes damage)
          • Else - Actions
            • Set Temp_int = 0
(3)Gain HP with Damage Inflicted
  • Give Lifestealer HP using Damage
    • Events
    • Conditions
      • (Damage source) Equal to LifeStealer
    • Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • Temp_int Equal to 0
        • Then - Actions
          • Set Victim_Unit = (Attacked unit)
          • Set Damage_Inflicted = (Integer((Damage taken)))
          • -------- ---------(1)Convert Damage into HP---------- --------
          • Unit - Set life of LifeStealer to ((Life of LifeStealer) + (Real(Damage_Inflicted)))
          • -------- ----------(2)You can add Special Effect here as Life Steal---------- --------
          • -------- ----------(3)Displays the damage you Inflict---------- --------
          • Game - Display to (All players) the text: (String(Damage_Inflicted))
          • Set Temp_int = 1
        • Else - Actions
Temp_int is used to avoid increasing leakage.
I also had provided a test map for you. Hope it works well.

From your trigger I'm starting to understand that "Damage Source" is the damage that attacker deals??? If I multiply "damage source" by 2 - I'll get double damage???:ogre_icwydt:
Oh I got it! It's damage taken! Man, that changes a lot!)
 
Last edited:
Level 4
Joined
Dec 12, 2012
Messages
96
Maltheo: your trigger works, but do try to use "Triggering Unit" instead of "Attacked unit" or "Damaged unit" (and so on).
(Also: if the unit dies, you're left with a leaking event).

I used Attacked Unit instead of Triggering Unit because this involves two units, it's the damage source, and the damage taker. Setting Victim_Unit to Triggering Unit might set the Attacking Unit into variable, instead of the attacked unit. Though the variable of attacked unit wasn't used here, it can be used if the editor chooses to add additional actions.
 
Level 4
Joined
Dec 12, 2012
Messages
96
Sorry for the double post.

From your trigger I'm starting to understand that "Damage Source" is the damage that attacker deals??? If I multiply "damage source" by 2 - I'll get double damage???:ogre_icwydt:
Oh I got it! It's damage taken! Man, that changes a lot!)

If you want to multiply it by 2, you just have to change the value of Damage_Inflicted (Integer((Damage taken) x 2))

From the 2nd trigger, the event Unit is Attacked activates when the unit only starts the animation of attack, therefore the trigger will then activate even it hasn't hit the target yet. But adding the Damage Source as condition from 3rd trigger, it verifies that the unit has already attacked and hit the unit.
 
Last edited:
Level 10
Joined
Mar 17, 2012
Messages
582
Sorry for the double post.



If you want to multiply it by 2, you just have to change the value of Damage_Inflicted (Integer((Damage taken) x 2))

From the 2nd trigger, the event Unit is Attacked activates when the unit only starts the animation of attack, therefore the trigger will then activate even it hasn't hit the target yet. But adding the Damage Source as condition from 3rd trigger, it verifies that the unit has already attacked and hit the unit.

You really helped me! I was looking for such an easy task solution for a long time!) +rep :thumbs_up:
---------------------------
Guys I just don't need such a complex system... maybe one day I'll come back for it, but not today :ogre_kawaii:
 
Level 23
Joined
Apr 16, 2012
Messages
4,041
the triggers are very inefficient(is that right word? :D)
because every time unit is about to attack, new event is added to the trigger and ot will eventually crash bcause trigger can only have a finite number of events before crashing the trigger or even the game
Bribes DDS recreates the trigger every 15 new umits registered to the trigger
Also dead units are not cleared from the event and the only way how to remove an event from the trigger is desrroy it and create it again
Also bribes DDS grants a unit that takes damage 50,000 life for a very short time so you can create even spell that prevents dead
 
Level 28
Joined
Jan 26, 2007
Messages
4,789
I used Attacked Unit instead of Triggering Unit because this involves two units, it's the damage source, and the damage taker. Setting Victim_Unit to Triggering Unit might set the Attacking Unit into variable, instead of the attacked unit. Though the variable of attacked unit wasn't used here, it can be used if the editor chooses to add additional actions.
No, you're wrong. Triggering unit is only 1 unit, it never involves 2 (it's sthe subject of the event - "A unit takes damage", "A unit" is the subject --> Triggering unit).
Attacked unit --> Triggering unit
"Triggering Unit" can never be the attacking unit or the damage source.
GUI automatically converts it (attacked unit) to "Triggering Unit" anyway, I'm saying you have to change it so it's more efficient.

JASS:
function GetAttackedUnitBJ takes nothing returns unit
    return GetTriggerUnit()
endfunction

edo said:
the triggers are very inefficient(is that right word? :D)
because every time unit is about to attack, new event is added to the trigger and ot will eventually crash bcause trigger can only have a finite number of events before crashing the trigger or even the game
Bribes DDS recreates the trigger every 15 new umits registered to the trigger
That's the right word, but it's not completely correct.
If you keep attacking a single unit, the event will only be added once.
If you attack a unit, then switch to another target for 2 attacks, then switch back: all units will have the event added once (as they should).

However, the problem is that you need to hit the target twice before the event is added (except for the first time). If you attack it once, then switch target (to a unit that already has an event), another event will be created for the unit that already had one.
So, theoretically, if you keep switching target after 1 attack; 1 unit will have many events added while the other won't have any event.
(Didn't notice this last time).

So it's really not a good system to use (unless I re-created it wrongly, looks correct though).
 
Level 23
Joined
Apr 16, 2012
Messages
4,041
That's the right word, but it's not completely correct.
If you keep attacking a single unit, the event will only be added once.
If you attack a unit, then switch to another target for 2 attacks, then switch back: all units will have the event added once (as they should).

However, the problem is that you need to hit the target twice before the event is added (except for the first time). If you attack it once, then switch target (to a unit that already has an event), another event will be created for the unit that already had one.
So, theoretically, if you keep switching target after 1 attack; 1 unit will have many events added while the other won't have any event.
(Didn't notice this last time).

So it's really not a good system to use (unless I re-created it wrongly, looks correct though).

I meant Maltheo2005's triggers are not great not yours(to me it seems like you think I meant your triggers are inefficient)
 
Level 28
Joined
Jan 26, 2007
Messages
4,789
I meant Maltheo2005's triggers are not great not yours(to me it seems like you think I meant your triggers are inefficient)
Nope, I was talking about Maltheo2005's triggers as well :D.

You say his triggers add an event on every attack, which isn't true. That's just what I wanted to correct.
Sorry for the confusion, I shouldn't just assume that everyone knows what I'm talking about :).
 
Status
Not open for further replies.
Top