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

[General] What am i missing in here? (Bribe's Damage Engine)

Status
Not open for further replies.
Level 18
Joined
Jun 2, 2009
Messages
1,233
This trigger not works somehow.

  • Unit - Set life of DamageEventTarget to ((Life of DamageEventTarget) + (5.00 x (Real((Level of Northwind Enchant // brm for Hero_NorthwindBear)))))
I was thinking it is because of the DamageEventModifier

  • Events
    • Game - DamageModifierEvent becomes Equal to 1.00
  • Conditions
    • (DamageEventTarget has buff Northwind Enchant ) Equal to True
And i have decided to set it as Integer just like this

  • NorthwindQ Copy
    • Events
      • Game - DamageModifierEvent becomes Equal to 1.00
    • Conditions
      • (DamageEventTarget has buff Northwind Enchant ) Equal to True
    • Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • DamageEventTarget Equal to Summon_NorthwindBear
        • Then - Actions
          • Set TempInteger = (6 + ((Level of Northwind Enchant // brm for Hero_NorthwindBear) x 4))
          • Unit - Set life of DamageEventTarget to ((Life of DamageEventTarget) + (Real(TempInteger)))
          • Game - Display to (All players) for 1.00 seconds the text: (String(TempInteger))
And this one is not works too. Then i have decided to use TempUnit

  • Events
    • Game - DamageModifierEvent becomes Equal to 1.00
  • Conditions
    • (DamageEventTarget has buff Northwind Enchant ) Equal to True
  • Actions
    • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
      • If - Conditions
        • DamageEventTarget Equal to Summon_NorthwindBear
      • Then - Actions
        • Set TempUnit = DamageEventTarget
        • Set TempInteger = (6 + ((Level of Northwind Enchant // brm for Hero_NorthwindBear) x 4))
        • Unit - Set life of TempUnit to ((Life of TempUnit) + (Real(TempInteger)))
        • Game - Display to (All players) for 1.00 seconds the text: (String(TempInteger))
      • Else - Actions
Still not works. String is correct but it is not adding HP. Still i am thinking about that since 1 hour.
 
Last edited:
Level 45
Joined
Feb 27, 2007
Messages
5,578
I guess you are testing this against units that have full health before they are damaged, otherwise you would see a slightly different issue.

You're using the event wrong. DamageModifierEvent happens before damage occurs, so that you can alter the total damage output how you want before it gets applied to the unit. You can't heal the unit before it has taken the damage. The proper way to use this event is to change DamageEventAmount in a trigger that runs on DamageModifierEvent = 1.0:
  • Events
    • Game - DamageModifierEvent becomes Equal to 1.00
  • Conditions
    • (DamageEventTarget has buff Northwind Enchant) Equal to True
    • DamageEventTarget Equal to Summon_NorthwindBear
  • Actions
    • Set TempInteger = (6 + ((Level of Northwind Enchant // brm for Hero_NorthwindBear) x 4))
    • Set DamageEventAmount = (DamageEventAmount - Real(TempInteger))
 
Level 18
Joined
Jun 2, 2009
Messages
1,233
I think there is misunderstanding in here.
I guess you are testing this against units that have full health before they are damaged, otherwise you would see a slightly different issue.
In my map units have attack damage and hit points. They can take and deal damage to each other.

You're using the event wrong. DamageModifierEvent happens before damage occurs, so that you can alter the total damage output how you want before it gets applied to the unit. You can't heal the unit before it has taken the damage. The proper way to use this event is to change DamageEventAmount in a trigger that runs on DamageModifierEvent = 1.0:
But i have a minimum 50 triggers like this. How they are works? Here is the one example

  • Events
    • Game - DamageModifierEvent becomes Equal to 1.00
  • Conditions
    • (Level of Bane of Arthropod for DamageEventSource) Greater than 0
  • Actions
    • Unit - Set life of DamageEventSource to ((Life of DamageEventSource) + ((Real((Level of Bane of Arthropod for DamageEventSource))) x ((Real((Strength of DamageEventSource (Include bonuses)))) / 10.00)))
How does this trigger works? Only difference i am checking DamageEventSource instead of DamageEventTarget? I am totally confused now.
  • Events
    • Game - DamageModifierEvent becomes Equal to 1.00
  • Conditions
    • (DamageEventTarget has buff Northwind Enchant) Equal to True
    • DamageEventTarget Equal to Summon_NorthwindBear
  • Actions
    • Set TempInteger = (6 + ((Level of Northwind Enchant // brm for Hero_NorthwindBear) x 4))
    • Set DamageEventAmount = (DamageEventAmount - Real(TempInteger))
I will try this when i return home

  • join.gif
    set.gif
    Set TempInteger = (6 + ((Level of Northwind Enchant // brm for Hero_NorthwindBear) x 4))
  • joinbottom.gif
    set.gif
    Set DamageEventAmount = (DamageEventAmount - Real(TempInteger))
By the way i haven't tested it yet but let me ask this. It will heal the unit or ignore the damage? I have to heal the unit.
 
Last edited:
Level 45
Joined
Feb 27, 2007
Messages
5,578
I fully understand what you are doing. There's no reason to belittle me by explaining that units have health and attack damage.
How does this trigger works? Only difference i am checking DamageEventSource instead of DamageEventTarget? I am totally confused now.
The unit whose health you are modifying is not the unit that is taking damage in this example trigger you showed. It doesn't matter if the source heals before or after it deals damage because it isn't the one taking damage so its health (until you modify it) is the same before/after the event.

You are trying to heal a target in response to it taking damage. If you heal it before it takes damage this will work fine as long as the unit wasn't at full health already. Why? Literally imagine the order of operations in your head:
  1. Unit is at 100/100 hp.
  2. Unit is about to take 20 points of damage; hp still 100/100. If you do nothing, the unit will end up with 80/100 hp.
  3. You 'heal' the unit by giving it 5 hp. This would take it to 105/100 but wc3 won't let you do that, so the units current HP does not change; hp still 100/100
  4. The unit takes the 20 damage, leaving it at 80/100 hp.
Now imagine when the unit wasn't at full hp to begin with:
  • Unit is at 50/100 hp.
  • Unit is about to take 20 points of damage; hp still 50/100. If you do nothing, the unit will end up with 30/100 hp.
  • You 'heal' the unit by giving it 5 hp; this takes it to 55/100 hp.
  • The unit takes the 20 damage, leaving it at 35/100 hp. (15 less than it started with because 5 was 'prevented')
To avoid this issue, instead of healing the unit before it takes damage (which might not work if the hp was high enough to begin with), and instead of healing it after it takes damage (because then it's possible the 'bonus' damage that should be prevented actually does kill the unit before it can be healed)... you modify the damage that is about to be done, reducing it by the amount it should be reduced by. That results in the following flow:
  • Unit is at 100/100 hp.
  • Unit is about to take 20 points of damage; hp still 100/100.
  • You modify the damage it's about to take, reducing it by 5 to 15 damage instead of 20.
  • The unit takes the 15 damage, leaving it at 85/100 hp.

It will heal the unit or ignore the damage? I have to heal the unit.
If you wish to allow the full damage to go through and then heal the unit after that has occurred (potentially allowing it to die when it would otherwise live by preventing some of the damage), then just use DamageEvent or AfterDamageEvent. DamageModifierEvent is only to be used when you want to modify the damage before it is dealt. In my opinion the other example trigger you showed should not use DamageModifierEvent, as there is no reason for it to happen then. It can happen after the damage is dealt.
 
Last edited:
Level 18
Joined
Jun 2, 2009
Messages
1,233
Thank you for your explanation. I can barely understand with my English + translate and still i don't fully understand yet. It looks complicated to me. I am sorry about that. By the way i am not trying to underestimate your knowledge. It is about my English. I tought i haven't explained my issue well.

I just need this trigger with DamageEngine.

Unit is attacked
Set life attacked unit to life of attacked unit + 10

Probably i will experiment on AfterDamageEvent and DamageEvent when i return home. Because i have a no idea how it works.
 
Level 45
Joined
Feb 27, 2007
Messages
5,578
It may be helpful for you to find another user on this site (or wc3 modder somewhere) who speaks both English and Turkish to help you translate. I can imagine that there are many English words I use here that do not translate properly back into Turkish because I am using them in nonstandard ways.

I was rude to you, too. I am sorry.
 
Level 18
Joined
Jun 2, 2009
Messages
1,233
Hello again. I have tried but no luck. But at least i have created system for my map. "True" damage block.

  • Events
    • Game - DamageModifierEvent becomes Equal to 1.00
  • Conditions
    • IsDamageSpell Equal to False
  • Actions
    • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
      • If - Conditions
        • (DamageEventTarget has an item of type Claws of Attack +15) Equal to True
      • Then - Actions
        • Set DamageEventAmount = (DamageEventAmount - 10.00)
        • Set DamageEventType = DamageTypeReduced
      • Else - Actions
But my question haven't solved yet. I have made arrangements as you said. It is "blocking" but i want to make them get healed.
And sadly i have created this system as like this.

  • Events
    • Unit - A unit Is attacked
  • Conditions
    • ((Attacked unit) has buff Northwind Enchant ) Equal to True
  • Actions
    • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
      • If - Conditions
        • (Attacked unit) Equal to Summon_NorthwindBear
      • Then - Actions
        • Unit - Set life of (Attacked unit) to ((Life of (Attacked unit)) + (6.00 x (Real((Level of Northwind Enchant // brm for Hero_NorthwindBear)))))
      • Else - Actions
        • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
          • If - Conditions
            • (DamageEventSource is in HerolarALL) Equal to True
          • Then - Actions
            • Unit - Set life of (Attacked unit) to ((Life of (Attacked unit)) + (5.00 x (Real((Level of Northwind Enchant // brm for Hero_NorthwindBear)))))
          • Else - Actions
            • Unit - Set life of (Attacked unit) to ((Life of (Attacked unit)) + (4.00 x (Real((Level of Northwind Enchant // brm for Hero_NorthwindBear)))))
Because at least this is works

  • Unit - Set life of (Attacked unit) to ((Life of (Attacked unit)) + (4.00 x (Real((Level of Northwind Enchant // brm for Hero_NorthwindBear)))))
Now still i am experimenting on this system. It has to be a way to detect hit point of the unit and replenish it's hit points. The only thing is i need, something like this.

  • Unit - Set life of (Attacked unit) to ((Life of (Attacked unit)) + blablablabla
 
Level 45
Joined
Feb 27, 2007
Messages
5,578
I think I misunderstood what this event is for:
  • Game - DamageModifierEvent becomes Less than 1.00
The name implies that it is to be used for modifying damage, but I think actually it runs when damage is modified. @Bribe? If my new understanding is correct you should instead use either of these two events to change incoming damage before it is applied:
  • Game - PreDamageEvent becomes Less than 1.00
  • Game - ArmorDamageEvent becomes Less than 1.00
What is the difference? The first event runs before the damage is reduced by the unit's armor and the interaction between damage types (like normal, siege, magic) and armor types (like fortified, heavy, flesh). The second event runs after damage amount is reduced by WC3's normal armor and damage type interactions.

Why does the difference matter? Imagine Unit A deals 100 damage to Unit B, and Unit B has armor that will reduce the incoming damage by 25%. This means unit B will receive 75 damage. In the first event, checking DamageEventAmount would show 100. In the second event DamageEventAmount would show 75. Now imagine that Unit B also has an ability that reduces incoming damage by 10 points; this probably means Unit B should receive 65 damage (75-10). If you do this modification using the second event this will be true. If you reduce DamageEventAmount by 10 using the first event, the unit will receive 67.5 damage (100-10)x0.75 = 67.5. In that case the actual damage received wasn't reduced by 10, it was actually only reduced by 7.5!

I do not think you need to do this at all:
  • Set DamageEventType = DamageTypeReduced
Because that is just something you can set to mark a particular damage event as involving reduced damage for your own purposes. It does not affect what the DDS does to the damage.
It is "blocking" but i want to make them get healed.
Fundamentally these are almost the same thing. Do you understand? If I block 5 damage (when done properly after armor mitigation is factored in, using the second event I mentioned above), it's the same thing as healing me for 5 after I take the damage. The only exception is that I could potentially die from the damage right before I'm about to be healed. If you want that, then go ahead and modify the unit health after the damage is applied. You would do this in a trigger with this event:
  • Game - AfterDamageEvent becomes Less than 1.00
Unit - A unit Is attacked
I have nothing really to say about this. Many users besides me have explained multiple times why this event is bad and should not be used. The trigger you just showed using this event has exactly the same problem as the first trigger you showed in this thread: if the unit is at full health, it will not be properly healed by this trigger because you're trying to heal it before it takes damage.
 
Last edited:
DamageModifierEvent is still fine if it's equal to 1.00.

In version 5.x, you get a distinction between pre-armor applied damage, and post-armor damage. These two types are distinguished either via a DamageModifierEvent < 4 or PreDamageEvent, or DamageModifierEvent >= 4 or ArmorDamageEvent.

In Damage Engine 3.X, it is all post-armor damage. There is no way in those versions to actually get the raw original damage amount.
 
Level 18
Joined
Jun 2, 2009
Messages
1,233
Ok ok it becomes more and more complicated to me. @Pyrogasm I know "A unit is attacked" a serious problem itself but at least it is not about the attacker. It is about attacked. No one will spam attack and stop.
And about getting healed by 10 and get decreased damage by 10 probably the same thing but it is ok for now.
I just wondered one thing

Why this works
  • Unit - Set life of (Attacked unit) to ((Life of (Attacked unit)) + blablabla
This works
  • Unit - Set life of (DamageEventSource) to ((Life of (DamageEventSource)) + blablabla
And this dont
  • Unit - Set life of (DamageEventTarget) to ((Life of (DamageEventTarget)) + blablabla
I know you tried to explain me but it is difficult to understand for me.

I was thought it was just like this:
DamageEventSource (attacker)
DamageEventTarget (attacked)

We can use this: Unit - Set life of (DamageEventSource) to ((Life of (DamageEventSource)) + blablabla
But we cannot use this: Unit - Set life of (DamageEventTarget) to ((Life of (DamageEventTarget)) + blablabla

Now i am counfused more than ever :)
 
Level 45
Joined
Feb 27, 2007
Messages
5,578
No one will spam attack and stop.
With the trigger you've written, you could spam attack+stop against your own unit to apply the heal without doing any damage to yourself.
We can use this: Unit - Set life of (DamageEventSource) to ((Life of (DamageEventSource)) + blablabla
But we cannot use this: Unit - Set life of (DamageEventTarget) to ((Life of (DamageEventTarget)) + blablabla
You can use that. The problem is that you are trying to heal the Target before it has taken any damage! The event you are using fires before the damage has been done. It doesn't seem to be a problem when healing the Source because the Source isn't about to take the damage and therefore has the same HP before and after the damage is dealt.
I said:
You are trying to heal a target in response to it taking damage. If you heal it before it takes damage this will work fine as long as the unit wasn't at full health already. Why? Literally imagine the order of operations in your head:
  1. Unit is at 100/100 hp.
  2. Unit is about to take 20 points of damage; hp still 100/100. If you do nothing, the unit will end up with 80/100 hp.
  3. You 'heal' the unit by giving it 5 hp. This would take it to 105/100 but wc3 won't let you do that, so the units current HP does not change; hp still 100/100
  4. The unit takes the 20 damage, leaving it at 80/100 hp.
Now imagine when the unit wasn't at full hp to begin with:
  • Unit is at 50/100 hp.
  • Unit is about to take 20 points of damage; hp still 50/100. If you do nothing, the unit will end up with 30/100 hp.
  • You 'heal' the unit by giving it 5 hp; this takes it to 55/100 hp.
  • The unit takes the 20 damage, leaving it at 35/100 hp. (15 less than it started with because 5 was 'prevented')
If you instead use this event it should work ask you expect:
  • Game - AfterDamageEvent becomes Less than 1.00
 
Level 18
Joined
Jun 2, 2009
Messages
1,233
With the trigger you've written, you could spam attack+stop against your own unit to apply the heal without doing any damage to yourself.
I know. This is why i have said no one wants to spam it. It regenerates attacked unit's hit point (enemy runs trigger)

By the way currently i give up but i am tagging it as "solved"
Thanks to everyone who helped me. Best regards.
 
I think the problem you have is that you don't understand the core issue, and get lost in all the other explanations and examples of how to go around it and the technical talk.

Here is what happens in your trigger, in this order:

Damage engine is activated > Unit is healed > unit is damaged. Do you see the problem with this order?

As others have pointed out, DamageModifierEvent happens BEFORE the actual damage happens.

An easy way for you to fix this is to just make a timer at 0 seconds whenever your unit is damaged, and apply the heal after the timer expires like in the example I attached.

  • Damage
    • Events
      • Game - DamageModifierEvent becomes Equal to 1.00
    • Conditions
      • (DamageEventTarget has buff Devotion Aura) Equal to True
    • Actions
      • Countdown Timer - Start DamageTimer as a One-shot timer that will expire in 0.00 seconds
  • DamageTimer
    • Events
      • Time - DamageTimer expires
    • Conditions
    • Actions
      • Unit - Set life of DamageEventTarget to ((Life of DamageEventTarget) + (6.00 + ((Real((Level of Devotion Aura for DamageEventTarget))) x 4.00)))
I tested this and it works just fine. You have to give the Paladin devotion aura to test it, but here are my results from testing:

Paladin starting HP: 1000
Knight damage: 100

Damage at devotion aura levels:
  • Level 0: -100 HP + 0 HP
  • Level 1: -100 HP + 10 HP
  • Level 2: -100 HP + 14 HP
  • Level 3: -100 HP + 18 HP

EDIT: Or if using Pyrogasm's example which is better you just do it in one trigger like so:

  • Damage
    • Events
      • Game - AfterDamageEvent becomes Less than 1.00
    • Conditions
      • (DamageEventTarget has buff Devotion Aura) Equal to True
    • Actions
      • Unit - Set life of DamageEventTarget to ((Life of DamageEventTarget) + (6.00 + ((Real((Level of Devotion Aura for DamageEventTarget))) x 4.00)))
 

Attachments

  • HealingDamage.w3m
    60 KB · Views: 2
Last edited:
Status
Not open for further replies.
Top