• 🏆 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!
  • It's time for the first HD Modeling Contest of 2024. Join the theme discussion for Hive's HD Modeling Contest #6! Click here to post your idea!

[Trigger] 2 units with linked HP

Status
Not open for further replies.
Level 7
Joined
Sep 9, 2007
Messages
253
I was working on this issue about 1 year ago and I had made some progress but the topic was closed so to ask for more help I have to create new topic.
Here is the old one even though I will clearly post my problem here. http://www.hiveworkshop.com/forums/requests-341/complex-ability-request-212761/


The ability I want So I have a Hero unit, a Warlock. She is able to summon a Demon which she can use to tank damage. I want to link the HP of the warlock and the Demon so that they are always at the same percentage of HP. So if the Demon takes a hit which does 10% of HP then the warlock should also lose 10% of her HP. They should also regen HP at the same rate (as a percentage).

So what's the point of using the Demon to tank damage if they both take the damage? well the idea is that the Demon will have more HP and armour than the Warlock. This means that it would be beneficial to have the Demon tank the damage.

This is what I have so far
I am using Bribe's Damage Detection System.
HeroSpecific[4] is the warlock, this is set when the warlock is chosen at the start of the game. there will only be one warlock so there is no need for MUI.
HeroSpecific[13] is the Demon, this is set each time he is summoned.

  • Demon Summoned
    • Events
      • Unit - A unit Spawns a summoned unit
    • Conditions
      • (Unit-type of (Summoning unit)) Equal to Warlock
    • Actions
      • Set HeroSpecific[13] = (Summoned unit)
      • Unit Group - Add HeroSpecific[13] to Hero_UnitGroup
      • Set TempUnit = (Summoning unit)
      • Set Demon_summoned = True
      • Unit - Add W Unsummon Demonic Pact (Dummy) to aaTempUnit
      • Unit - Set level of W Unsummon Demonic Pact (Dummy) for aaTempUnit to (Level of W Demonic Pact for aaTempUnit)
      • Unit - Remove W Demonic Pact from aaTempUnit
      • Trigger - Turn on Tethered Soul <gen>
      • Trigger - Turn on Tethered Soul regen update <gen>
      • Trigger - Turn on Tethered Soul death <gen>
  • Demon unsummon
    • Events
      • Unit - A unit Starts the effect of an ability
    • Conditions
      • (Ability being cast) Equal to W Unsummon Demonic Pact (Dummy)
    • Actions
      • Unit - Add W Demonic Pact to HeroSpecific[4]
      • Unit - Set level of W Demonic Pact for HeroSpecific[4] to (Level of W Unsummon Demonic Pact (Dummy) for HeroSpecific[4])
      • Unit - Remove W Unsummon Demonic Pact (Dummy) from HeroSpecific[4]
      • Trigger - Turn off Tethered Soul <gen>
      • Trigger - Turn off Tethered Soul regen update <gen>
      • Trigger - Turn off Tethered Soul death <gen>
      • Unit Group - Remove HeroSpecific[13] from Hero_UnitGroup
      • Unit - Kill HeroSpecific[13]
  • Tethered Soul
    • Events
      • Game - DamageEvent becomes Equal to 1.00
    • Conditions
      • Or - Any (Conditions) are true
        • Conditions
          • DamageEventTarget Equal to HeroSpecific[4]
          • DamageEventTarget Equal to HeroSpecific[13]
    • Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • DamageEventTarget Equal to HeroSpecific[4]
        • Then - Actions
          • Unit - Set life of HeroSpecific[13] to (Percentage life of HeroSpecific[4])%
        • Else - Actions
          • Unit - Set life of HeroSpecific[13] to (Percentage life of HeroSpecific[4])% (This action is currently disabled, I was using it to update the Demon's health to the right amount, this accounts for any HP regeneration which occurs immediately before the trigger)
          • Trigger - Turn off DamageEventTrigger
          • Unit - Cause DamageEventSource to damage DamageEventTarget, dealing DamageEventAmount damage of attack type Chaos and damage type Normal
          • Trigger - Turn on DamageEventTrigger
          • Unit - Set life of HeroSpecific[4] to (Percentage life of HeroSpecific[13])%
  • Tethered Soul regen update
    • Events
      • Time - Every 0.01 seconds of game time
    • Conditions
    • Actions
      • Unit - Set life of HeroSpecific[13] to (Percentage life of HeroSpecific[4])%
  • Tethered Soul death
    • Events
      • Unit - A unit Dies
    • Conditions
      • Or - Any (Conditions) are true
        • Conditions
          • (Triggering unit) Equal to HeroSpecific[4]
          • (Triggering unit) Equal to HeroSpecific[13]
    • Actions
      • Set Demon_summoned = False
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Unit-type of (Triggering unit)) Equal to Warlock
        • Then - Actions
          • Unit Group - Remove HeroSpecific[13] from Hero_UnitGroup
          • Unit - Remove HeroSpecific[13] from the game
        • Else - Actions
          • Unit - Add W Demonic Pact to HeroSpecific[4]
          • Unit - Set level of W Demonic Pact for HeroSpecific[4] to (Level of W Unsummon Demonic Pact (Dummy) for HeroSpecific[4])
          • Unit - Remove W Unsummon Demonic Pact (Dummy) from HeroSpecific[4]
          • Unit - Kill HeroSpecific[4]
      • Trigger - Turn off Tethered Soul <gen>
      • Trigger - Turn off Tethered Soul regen update <gen>
      • Trigger - Turn off (This trigger)
The problem Depending on what type of unit the demon and warlock are fighting there will be different outcomes. Usually it works well but it often doesn't. Sometimes I s the demon take damage but then it's health will jump back almost immediately. Other times it doesn't take damage. He also seems to have more damage reduction than I expect, I have triple checked my values in armour and attack bonuses in gameplay constants.

Any help would be greatly appreciated. I think my problem most likely stems from a lack of understanding of Bribe's Damage detection system.
 
Last edited:
Level 25
Joined
Jul 10, 2006
Messages
3,315
The problem with the event you are using is that it is triggered before the damage is dealt.

When you get
  • (Percentage life of HeroSpecific[4])
, you need to subtract DamageEventAmount from the hero's health.


The system also has a DamageModifier event:
  • Game - DamageModifierEvent becomes Equal to 1.00
In this trigger you can set:
  • Set DamageEventAmount = 0.00
 
Level 7
Joined
Sep 9, 2007
Messages
253
I'm not quite sure I understand... If the summoned unit takes damage I don't want to subtract the same amount from the hero. I want to subtract the same percentage. Keep in mind that it sometimes works and sometimes doesn't.

Let's say the Demon has 600HP and the warlock has 400HP.
If the Demon takes 30 damage then then warlock should only take 20 in order to keep the two unit's at the same HP%. Conversely, If the warlock takes 30 damage then the demon would take 45 damage.

EDIT: updated the first post. I think rulerofiron99 was referring to an action which was disabled in my trigger.
 
Last edited:
Level 7
Joined
Sep 9, 2007
Messages
253
I think you may misunderstand.... let me clarify with comments.... It is also likely that I have misunderstood you, if that's the case do you mind giving me an example? I don't think I completely understand the DDS.

When I use "Game - DamageEvent becomes Equal to 1.00" does it automatically block the damage I'm detecting? I don't understand how it does that just by me detecting the event.

  • Tethered Soul
    • Events
      • Game - DamageEvent becomes Equal to 1.00
    • Conditions
      • Or - Any (Conditions) are true
        • Conditions
          • DamageEventTarget Equal to HeroSpecific[4]
          • DamageEventTarget Equal to HeroSpecific[13]
    • Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • DamageEventTarget Equal to HeroSpecific[4]
        • Then - Actions
          • Unit - Set life of HeroSpecific[13] to (Percentage life of HeroSpecific[4])%
        • Else - Actions
          • -------- -- First, set the Demon's health to the same percentage as the warlock (the warlock may have regenerated HP since the last time the Demon's health was updated) --------
          • Unit - Set life of HeroSpecific[13] to (Percentage life of HeroSpecific[4])%
          • -------- -- Next Damage the warlock with the damage that the detection system detected --------
          • Trigger - Turn off DamageEventTrigger
          • Unit - Cause DamageEventSource to damage DamageEventTarget, dealing DamageEventAmount damage of attack type Chaos and damage type Normal
          • Trigger - Turn on DamageEventTrigger
          • -------- Last, set the warlockHP to same percentage as Demon. --------
          • Unit - Set life of HeroSpecific[4] to (Percentage life of HeroSpecific[13])%
 
Level 37
Joined
Mar 6, 2006
Messages
9,240
In this example, we create an invulnerable unit. It it would die from the damage, it's hp will be set to 0.41.


  • Untitled Trigger 003
    • Events
      • Game - DamageModifierEvent becomes Equal to 1.00
    • Conditions
    • Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (DamageEventAmount - (Life of DamageEventTarget)) Greater than or equal to 0.41
        • Then - Actions
          • Set DamageEventAmount = 0.00
          • Unit - Set life of DamageEventTarget to 0.41
        • Else - Actions
 
Level 6
Joined
Nov 24, 2012
Messages
218
Your triggers look fine, except for Tethered Soul.
Change your Tethered Soul trigger to this:


  • Tethered Soul
    • Events
      • Game - DamageEvent becomes Equal to 1.00
    • Conditions
      • Or - Any (Conditions) are true
        • Conditions
          • DamageEventTarget Equal to HeroSpecific[4]
          • DamageEventTarget Equal to HeroSpecific[13]
    • Actions
      • Trigger - Turn off DamageEventTrigger
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • DamageEventTarget Equal to HeroSpecific[4]
        • Then - Actions
          • Unit - Cause DamageEventSource to damage HeroSpecific[13], dealing (DamageEventAmount x ((Max life of HeroSpecific[13]) / (Max life of HeroSpecific[4]))) damage
            • of attack type Hero and damage type Universal
        • Else - Actions
          • Unit - Cause DamageEventSource to damage HeroSpecific[4], dealing (DamageEventAmount x ((Max life of HeroSpecific[4]) / (Max life of HeroSpecific[13]))) damage
            • of attack type Hero and damage type Universal
      • Trigger - Turn on DamageEventTrigger


Much simpler than you imagined most likely, but does absolutely everything you requested.
  • Avoid set life when dealing "damage" with a damage system, especially if your map has bounty gold / kill counts in a multiboard.
  • Here, we get the difference in max life as a multiplier and deal the damage in pure (because DamageEventAmount already accounted for armor)
  • Copy this trigger carefully and don't screw up the arithmetic functions, watch out for the brackets
Any other questions?
 
Last edited:
Level 7
Joined
Sep 9, 2007
Messages
253
I like this. Thanks a lot.

The original issue still seems to remain. It only happens occasionally but it seems to affect a particular unit. The weird thing is it could be a different unit each time I test the map.
 
Level 6
Joined
Nov 24, 2012
Messages
218
OK but I still have the original issue of the Demon not taking damage intermittently.
The original issue still seems to remain. It only happens occasionally but it seems to affect a particular unit.
The weird thing is it could be a different unit each time I test the map.
I don't understand, sorry.
What do you mean by "Demon not taking damage intermittently"?
What do you mean by "It only happens occasionally but it seems to affect a particular unit"?
 
Level 7
Joined
Sep 9, 2007
Messages
253
I use the warlock and Demon to fight some waves of monsters. The trigger system works well most of the time but occasionally I will be using the Demon to tank and he will just stop taking damage or he takes the damage but his health immediately jumps back to the same amount of HP he had just before the attack.

At the moment I am using placeholders for my enemy waves; if I test the map it goes like this:

1. fight some creeps and a boss (custom unit)
2. same again but the boss is an ordinary shadow hunter
3. same with a blademaster as boss,
4. same with a tauren cheiftain as boss.

At the moment I am just testing the first few waves. So if I test the map I might have this issue only while fighting the blademaster. Then if I test it again I might have no problem. Then if I test again I might have the issue with the tauren. Then test again I might have issue with the blademaster again. Usually I will summon the demon during the first wave and fight with him without having to resummon. I have found that If I have the issue it is resolved by unsummoning and resummoning the demon.

edit: I am heading to work atm but later I think I will make a short video for youtube to show you what I mean.
 
Level 6
Joined
Nov 24, 2012
Messages
218
Hm, weird. If there is a jump/mishap in health, it's the Tethered Soul trigger failing to damage Demon/Warlock such that they both have exact same hp %.
May I see your Tethered Soul trigger? -- But what's really weird is it gets fixed from resummoning :eek: idk, sorry.
But like rulerofiron99 said, the DamageEvent actually occurs right before the damage takes place, though this should not affect the trigger.
 
Level 7
Joined
Sep 9, 2007
Messages
253
http://www.youtube.com/watch?v=qVnwGa2OwxM&feature=youtu.be
Here is a quick video I made to show the problem. The fight after the third wave shows the problem, and I resummon after the 4th wave and you can see it fixed. The problem usually occurs with the Blademaster but not always.

Here are the triggers I was using for this video.

  • Demon Summoned
    • Events
      • Unit - A unit Spawns a summoned unit
    • Conditions
      • (Unit-type of (Summoning unit)) Equal to Warlock
    • Actions
      • Set HeroSpecific[13] = (Summoned unit)
      • Unit Group - Add HeroSpecific[13] to Hero_UnitGroup
      • Unit - Set life of HeroSpecific[13] to (Percentage life of HeroSpecific[4])%
      • Set Demon_summoned = True
      • Unit - Add W Unsummon Demonic Pact (Dummy) to HeroSpecific[4]
      • Unit - Set level of W Unsummon Demonic Pact (Dummy) for HeroSpecific[4] to (Level of W Demonic Pact for HeroSpecific[4])
      • Unit - Remove W Demonic Pact from HeroSpecific[4]
      • Trigger - Turn on Tethered Soul <gen>
      • Trigger - Turn on Tethered Soul regen update <gen>
      • Trigger - Turn on Tethered Soul death <gen>
  • Demon unsummon
    • Events
      • Unit - A unit Starts the effect of an ability
    • Conditions
      • (Ability being cast) Equal to W Unsummon Demonic Pact (Dummy)
    • Actions
      • Unit - Add W Demonic Pact to HeroSpecific[4]
      • Unit - Set level of W Demonic Pact for HeroSpecific[4] to (Level of W Unsummon Demonic Pact (Dummy) for HeroSpecific[4])
      • Unit - Remove W Unsummon Demonic Pact (Dummy) from HeroSpecific[4]
      • Trigger - Turn off Tethered Soul <gen>
      • Trigger - Turn off Tethered Soul regen update <gen>
      • Trigger - Turn off Tethered Soul death <gen>
      • Unit Group - Remove HeroSpecific[13] from Hero_UnitGroup
      • Unit - Kill HeroSpecific[13]
I started using DamageEventTarget instead of DamageEventSource because If one unit was being attacked and the other one was far away it would respond and try to join the fight, this was annoying for testing. The problem was the same using both ways.
  • Tethered Soul
    • Events
      • Game - DamageEvent becomes Equal to 1.00
    • Conditions
      • Or - Any (Conditions) are true
        • Conditions
          • DamageEventTarget Equal to HeroSpecific[4]
          • DamageEventTarget Equal to HeroSpecific[13]
    • Actions
      • Trigger - Turn off DamageEventTrigger
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • DamageEventTarget Equal to HeroSpecific[4]
        • Then - Actions
          • Unit - Cause DamageEventTarget to damage HeroSpecific[13], dealing (DamageEventAmount x ((Max life of HeroSpecific[13]) / (Max life of HeroSpecific[4]))) damage of attack type Chaos and damage type Universal
        • Else - Actions
          • Unit - Cause DamageEventTarget to damage HeroSpecific[4], dealing (DamageEventAmount x ((Max life of HeroSpecific[4]) / (Max life of HeroSpecific[13]))) damage of attack type Chaos and damage type Universal
      • Trigger - Turn on DamageEventTrigger
  • Tethered Soul regen update
    • Events
      • Time - Every 0.01 seconds of game time
    • Conditions
    • Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Percentage life of HeroSpecific[4]) Greater than or equal to (Percentage life of HeroSpecific[13])
        • Then - Actions
          • Unit - Set life of HeroSpecific[13] to (Percentage life of HeroSpecific[4])%
        • Else - Actions
          • Unit - Set life of HeroSpecific[4] to (Percentage life of HeroSpecific[13])%
  • Tethered Soul death
    • Events
      • Unit - A unit Dies
    • Conditions
      • Or - Any (Conditions) are true
        • Conditions
          • (Triggering unit) Equal to HeroSpecific[4]
          • (Triggering unit) Equal to HeroSpecific[13]
    • Actions
      • Set Demon_summoned = False
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Unit-type of (Triggering unit)) Equal to Warlock
        • Then - Actions
          • Unit Group - Remove HeroSpecific[13] from Hero_UnitGroup
          • Unit - Kill HeroSpecific[13]
        • Else - Actions
          • Unit - Add W Demonic Pact to HeroSpecific[4]
          • Unit - Set level of W Demonic Pact for HeroSpecific[4] to (Level of W Unsummon Demonic Pact (Dummy) for HeroSpecific[4])
          • Unit - Remove W Unsummon Demonic Pact (Dummy) from HeroSpecific[4]
          • Unit - Kill HeroSpecific[4]
      • Trigger - Turn off Tethered Soul <gen>
      • Trigger - Turn off Tethered Soul regen update <gen>
      • Trigger - Turn off (This trigger)
The Damage detection system isn't being used by anything else. The problem seems to begin between fights, I'm beginning to think it may be caused by something which happens during the TD phase which occurs between fights. I use a dummy unit to Silence any hero and the Demon if it exists, the buff is then removed before the fights starts; I don't see how that could cause a problem but I thought I'd mention it just in case.
 
Last edited:
Level 6
Joined
Nov 24, 2012
Messages
218
Can you add a debug message right after the dealing damage lines in Tethered Soul,
See how much damage is being dealt to [4] / [13]
Also throw in cinematic ping, forget leaks and stuff, just make it ping location of [4] and [13] in that tethered soul trigger, i want to see if both are still registered as [4] and [13] when the spell is broken. I think [4] or [13] may have been deregistered somehow.

edit: oh watched vid they both arent taking dmg when glitched
also, does it glitch like this with regen disabled?

Im also very suspicious of turning off and on DamageEventTrigger, try replacing that by Turn off this trigger, TUrn on this trigger, instead.

I think what its doing is the Tethered Soul trigger isn't damaging the other one when glitched, then regen pops in and sets the one that did get damaged back to full (other one's hp).

why resummon fix? i can only imagine [4] [13] got unregistered or something bugged in turning dmg event trigger off and on or bribe's system didn't recycle or something because of turn off turn on damageeventtrigger? i dont really know.

ur right it could be TD phase, im looking at that instant teleport. idk why, but i hate moving units instantly. if it isnt already, try set x/y. i doubt that will fix though.
 
Last edited:
Level 7
Joined
Sep 9, 2007
Messages
253
I think what its doing is the Tethered Soul trigger isn't damaging the other one when glitched, then regen pops in and sets the one that did get damaged back to full (other one's hp).

I had this Idea as well. I tried testing the map with the regen trigger disabled but the problem still happened.

Can you give me an example of the ping and debug message?
 
Level 6
Joined
Nov 24, 2012
Messages
218
I had this Idea as well. I tried testing the map with the regen trigger disabled but the problem still happened.

Can you give me an example of the ping and debug message?

  • Cinematic - Ping minimap for (All players) at (Position of HeroSpecific[4]) for 1.00 seconds
  • Cinematic - Ping minimap for (All players) at (Position of HeroSpecific[13]) for 1.00 seconds
Inside a trigger "every 5 seconds". If it starts pinging middle of map, something broke, but I doubt it now.

The other trigger is a bit longer so here is an empty map that u can copy paste trigger from.
If it still breaks, change event from "DamageEvent to DamageModifierEvent" and see what happens.
Instead of turning off/on the whole damage event trigger I just turned off/on that trigger itself, I think that would be better.
 

Attachments

  • Tethered_Soul.w3x
    12.5 KB · Views: 67
Level 7
Joined
Sep 9, 2007
Messages
253
Thanks very much, I am at work but I will give that a go when I get home and post the outcome.

EDIT:
I tested 3 times. First 2 times there was no problem for the first 4 waves. Third time the problem arose.
The units were still being pinged and tehrefor still registered as HeroSpecific[x].
The debug messages where not being displayed... So seeing as the units are still registered in the array this means that the event must not be firing at all. So does this mean the units lose their index in Bribes indexing system? perhaps theyr indices are being recycled for some reason? idk anything about it so I have no idea...
I resummoned the Demon and he started taking damage again but I noticed something interesting: the warlock continues to not take damage, I must have never checked this before...

On a side note, I still have Weep's DDS in the triggers but they are disabled... it's impossible for them to conflict if they are disabled surely....


  • Tethered Soul
    • Events
      • Game - DamageEvent becomes Equal to 1.00
    • Conditions
      • Or - Any (Conditions) are true
        • Conditions
          • DamageEventTarget Equal to HeroSpecific[4]
          • DamageEventTarget Equal to HeroSpecific[13]
    • Actions
      • Cinematic - Clear the screen of text messages for (All players)
      • Trigger - Turn off (This trigger)
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • DamageEventTarget Equal to HeroSpecific[4]
        • Then - Actions
          • Unit - Cause DamageEventTarget to damage HeroSpecific[13], dealing (DamageEventAmount x ((Max life of HeroSpecific[13]) / (Max life of HeroSpecific[4]))) damage of attack type Hero and damage type Universal
          • Game - Display to (All players) the text: Warlock taking this...
          • Game - Display to (All players) the text: (String(DamageEventAmount))
          • Game - Display to (All players) the text: Demon taking this d...
          • Game - Display to (All players) the text: (String((DamageEventAmount x ((Max life of HeroSpecific[13]) / (Max life of HeroSpecific[4])))))
        • Else - Actions
          • Unit - Cause DamageEventTarget to damage HeroSpecific[4], dealing (DamageEventAmount x ((Max life of HeroSpecific[4]) / (Max life of HeroSpecific[13]))) damage of attack type Hero and damage type Universal
          • Game - Display to (All players) the text: Demon taking this d...
          • Game - Display to (All players) the text: (String(DamageEventAmount))
          • Game - Display to (All players) the text: Warlock taking this...
          • Game - Display to (All players) the text: (String((DamageEventAmount x ((Max life of HeroSpecific[4]) / (Max life of HeroSpecific[13])))))
      • Trigger - Turn on (This trigger)

but i hate moving units instantly. if it isnt already, try set x/y. i doubt that will fix though.
I can move by coords instead of to point(middle of region) but it is always instant.... what do you mean exactly?
 
Last edited:
Level 37
Joined
Mar 6, 2006
Messages
9,240
This doesn't sync regen yet, and you need to flush child hashtables when units are deindexed. Otherwise it should work.

I'll finish it afterwards, now it is time to wine and dine with my woman ;)

  • Link Take Damage 2
    • Events
      • Game - DamageEvent becomes Equal to 1.00
    • Conditions
    • Actions
      • Custom script: set udg_i1 = GetHandleId(udg_DamageEventTarget)
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (0 is stored as a Handle of i1 in LinkHT) Equal to True
        • Then - Actions
          • Set u2 = (Load 0 of i1 in LinkHT)
          • Set r1 = (((Life of DamageEventTarget) - DamageEventAmount) / (Max life of DamageEventTarget))
          • Set r1 = ((Life of u2) - (r1 x (Max life of u2)))
          • Trigger - Turn off DamageEventTrigger
          • Custom script: call UnitDamageTarget(udg_DamageEventSource, udg_u2, udg_r1, false, false, ATTACK_TYPE_CHAOS, DAMAGE_TYPE_UNKNOWN, null)
          • Trigger - Turn on DamageEventTrigger
        • Else - Actions
 

Attachments

  • LinkHP.w3x
    26.4 KB · Views: 46
Level 7
Joined
Sep 9, 2007
Messages
253
This seems to work quite well, thank you. I don't understand at all which is probably because I have a shaky knowledge of hashtables. Are you able to briefly explain what each action is doing?

In the meantime I will have another look through some hashtable tutorials.

Thanks.
 
Level 37
Joined
Mar 6, 2006
Messages
9,240

  • Link Take Damage 2
    • Events
      • Game - DamageEvent becomes Equal to 1.00
    • Conditions
    • Actions
      • Custom script: set udg_i1 = GetHandleId(udg_DamageEventTarget) // Gets the handle id of the damaged unit, so we know which unit's data to load
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (0 is stored as a Handle of i1 in LinkHT) Equal to True // checks if there is a linked unit saved for the damaged unit
        • Then - Actions
          • Set u2 = (Load 0 of i1 in LinkHT) // loads the damaged unit
          • Set r1 = (((Life of DamageEventTarget) - DamageEventAmount) / (Max life of DamageEventTarget)) // calculates the percentage life of the damaged unit after damage is applied
          • Set r1 = ((Life of u2) - (r1 x (Max life of u2))) // calculates how much damage the linked unit should take
          • Trigger - Turn off DamageEventTrigger
          • // damages the linked unit with damage that ignores armor
          • Custom script: call UnitDamageTarget(udg_DamageEventSource, udg_u2, udg_r1, false, false, ATTACK_TYPE_CHAOS, DAMAGE_TYPE_UNKNOWN, null)
          • Trigger - Turn on DamageEventTrigger
        • Else - Actions
 
Level 7
Joined
Sep 9, 2007
Messages
253
Maker, you won't believe this but even with your triggers I am still having the same issue.... I think the problem has to be something to do with Indexing in the DDS.


When the problem occurs the enemy unit's attacks do not trigger your test-on damage. This must mean that DamageEvent is not becoming equal to 1.

The issue seems to almost always arise when I am fighting wave 3. I have made waves 1 and 2 use the same units as wave 3 but that doesnt change anything. Also I've played up to wave 15 and it doesn't happen again. I've also unsummoned the demon at the end of each wave but it still happened at wave 3.


On a side note...
In Bribe's Damage Detection, in the "Damage Engine" trigger, there is a condition and action which are disabled...

  • (TempUnit is A structure) Equal to False
  • Countdown Timer - Start DmgEvTimer as a One-shot timer that will expire in 0.00 seconds
Why are these disabled? why are they there if not needed?
 
Last edited:
Level 7
Joined
Sep 9, 2007
Messages
253
So I can pretty confidently say that the issue of the Demon and Warlock no longer taking damage seems to begin on wave 3. This is the invariable outcome if I summon the Demon for the first wave and leave him summoned until the problem arises..

I did a different test. This time I did not summon the demon at all, I killed the first wave by myself. I then summoned the Demon during the second wave. There was no issue in the third wave but the problem then happened in the fourth wave.

I did another a different test. This time I used the demon in wave 1 and then unsummoned him before wave 2. I fought wave 2 with only the warlock but then summoned the demon again during wave 3.... no problems up to this point. I then continued fighting until wave 6 when the demon and warlock stopped taking damage, the same issue as normal except this time at wave 6 isntead of wave 3.

Note that when I unsummon the demon and resummon him he will take damage but the warlock still does not take damage. However, in this case the warlock does take triggered damage whenever the demon takes damage. If I let the demon die (and thus the warlock will also be killed) my hero respawn system does not work.... It otherwise works well if i let me hero die before the not taking damage thing starts happening.
 
Last edited:
Level 37
Joined
Mar 6, 2006
Messages
9,240
If you are using my trigger then you need to add this one:
  • Link Die
    • Events
      • Unit - A unit Dies
    • Conditions
    • Actions
      • Custom script: set udg_i1 = GetHandleId(GetTriggerUnit())
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (0 is stored as a Handle of i1 in LinkHT) Equal to True
        • Then - Actions
          • Set u2 = (Load 0 of i1 in LinkHT)
          • Hashtable - Clear all child hashtables of child i1 in LinkHT
          • Custom script: set udg_i1 = GetHandleId(udg_u2)
          • Hashtable - Clear all child hashtables of child i1 in LinkHT
        • Else - Actions
Maybe it solves the issue.
 
Level 7
Joined
Sep 9, 2007
Messages
253
Well the issue is the same with your trigger as it was with my original trigger so I don't think fixing something on your trigger will have any effect. Also, the issue occurs even if the warlock or demon never die. Your trigger seems to be addressing an issue which occurs when units die....

On the other hand I have very little clue as to what that trigger is doing so I'll give it a shot.

EDIT:

no I'm afraid it hasn't fixed the problem... Still the bug occurs on wave 3 where demon and warlock don't take damage.

  • Link Death Makers Fix
    • Events
      • Unit - A unit Dies
    • Conditions
    • Actions
      • Custom script: set udg_i1 = GetHandleId(GetTriggerUnit())
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (0 is stored as a Handle of i1 in LinkHT) Equal to True
        • Then - Actions
          • Set u2 = (Load 0 of i1 in LinkHT)
          • Hashtable - Clear all child hashtables of child i1 in LinkHT
          • Custom script: set udg_i1 = GetHandleId(udg_u2)
          • Hashtable - Clear all child hashtables of child i1 in LinkHT
        • Else - Actions
 
Level 7
Joined
Sep 9, 2007
Messages
253
Sure, thanks again for your help so far...

Look in the folder: Warlock Abilities. The disabled triggers are the ones I was using before you posted your version... both seem to work similarly except that mine wasn't MUI.

I should also mention that there are several resources in here which have not yet made proper credits for or even asked permission to use them. As I have not formally published the map I hope that is not an issue for anyone.

MAP:
http://www.hiveworkshop.com/forums/pastebin.php?id=szo2fs
 
Last edited:
Status
Not open for further replies.
Top