• 🏆 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] Problem with simple Damage Detection System

Status
Not open for further replies.
Level 9
Joined
Dec 6, 2007
Messages
233
In a map i'm working on, all of the damage is triggered, so I'm using a basic DDS to stop non-triggered attacks from causing damage.

  • DDS Event Adder
    • Events
      • Unit - A unit enters (Playable map area)
    • Conditions
    • Actions
      • Trigger - Add to DDS <gen> the event (Unit - (Triggering unit) Takes damage)
  • DDS
    • Events
    • Conditions
    • Actions
      • Unit - Set life of (Triggering unit) to ((Life of (Triggering unit)) + (Damage taken))
Works, except not the first time a unit receives damage. It doesn't begin activating until after the unit has already been damaged once. Can anyone explain how to fix this?
 
Level 9
Joined
Dec 6, 2007
Messages
233
Grr, I don't like using things I didn't make, but thanks for the help maker. The DDS still works for triggering attack triggers, but the events leak. Is there a custom script function perhaps for clearing the events out? Or must I use the damage engine for that as well?
 

Br0

Br0

Level 4
Joined
May 4, 2012
Messages
102
  • DDS Event Adder
    • Events
      • Unit - A unit enters (Playable map area)
    • Conditions
    • Actions
      • Trigger - Add to DDS <gen> the event (Unit - (Triggering unit) Takes damage)
  • DDS
    • Events
    • Conditions
    • Actions
      • Wait 0.00 seconds
      • Unit - Set life of (Triggering unit) to ((Life of (Triggering unit)) + (Damage taken))
That should fix it, however incase of the same unit able to come back to the map such as being a hero or ressurection or animate dead you should add all units to a unit group, and check to see if they're in that unit group so they don't get added again to the trigger.

Edit: You can't really clean event leaks in GUI I know for sure, but in JASS I do not know however you can avoid the limit where the leaking events cause Wc3 to automatically shutdown since event leaks do not cause lag or anything else besides a limit where it hits then blows up. To do this all you have to do is make dummy triggers I call it which is multiple copies of the same trigger, and you use an integer to detect when that trigger has hit around 8000 then start adding to another trigger with the same actions, and conditions for it. Doesn't take much extra work, and works successfully as far as I know.
 
Level 9
Joined
Dec 6, 2007
Messages
233
I've tested your suggestions Br0
The Dummy trigger idea is great; I feel better about using the DDS for attack detection now. As for damage, It does prevent damage from normal attacks, but it has a noticeable delay before it heals the unit.
 

Br0

Br0

Level 4
Joined
May 4, 2012
Messages
102
I've tested your suggestions Br0
The Dummy trigger idea is great; I feel better about using the DDS for attack detection now. As for damage, It does prevent damage from normal attacks, but it has a noticeable delay before it heals the unit.

Make a life add and removal ability if your worried about the delay killing the unit before the heal can kick in. Glad to help.
 
Status
Not open for further replies.
Top