HomeUser Control Panel (unavailable in archive)ForumsTutorialsArt GalleryResourcesMaps

Takes Damage Event

05-05-2006, 11:31 PM#1
SuperDuperGuy
I have a trigger that needs to run anytime a unit takes damage. Should I:

A. Have a function of actions, and make a new trigger every time a unit is created, and have the trigger delete itself when a unit dies (I think ressurection would be the only issue here)

or

B. Have a trigger, and any time a unit is created have an event added to that trigger. There is no way to remove events, but I did a test map where 10,000 units are created and killed over time using this method, and im guessing that they are delete automatically when the unit dies. This would be the simplest to implement if this is true.
05-05-2006, 11:54 PM#2
shadow1500
Choice A works best because it doesnt leak events, I have made a function that detects damage for any unit in the map using that method: http://www.wc3jass.com/viewtopic.php?t=2608.
Also, when a unit is ressurected, its cosidered to enter the map.
05-06-2006, 01:06 AM#3
PipeDream
Unfortunately the event is not deleted automatically when the unit dies so Shadow's approach is necessary. Be careful with RemoveDamageTriggers; if you don't manually flush the unit's locals, you will need to add SetHandleHandle(GetTriggerUnit(),"TakeDamageTrigger",null) to that function.
05-06-2006, 04:58 AM#4
SuperDuperGuy
Does this mean that even trigger actions leak? I see that you delete all of the trigger actions before deleting the trigger. Is blizzard really that bad?

EDIT: Plus can't you just do TriggerClearActions to delete all of the trigger actions? I think I am getting sceptical on how people determine how things leak in JASS.......
05-06-2006, 11:29 AM#5
karukef
Quote:
Originally Posted by shadow1500
Choice A works best because it doesnt leak events, I have made a function that detects damage for any unit in the map using that method: http://www.wc3jass.com/viewtopic.php?t=2608.
Also, when a unit is ressurected, its cosidered to enter the map.

Are you sure? Because I could swear I tested this only a few days ago when I made my damage-event system, and there was no way I could detect ressurection or animate dead. Do you have a sample map using that system so I can see that it does work?
05-06-2006, 11:42 AM#6
Vexorian
They probably changed it in patch 1.20 I wonder the reason blizz don't state the changes to the game engine related to modding.


Cause I am sure that in a previous patch I tested and reviving units didn't trigger region events. And I actually think that's logical cause they never leave the region
05-06-2006, 11:54 AM#7
Vexorian
I tested with animate dead, ressurection and latest patch and they definitively don't trigger that event
05-06-2006, 12:10 PM#8
Meanie
Well you can just make an repetive timer function that adds every unit in map to the trigger, but this will damage the performace of the map(Greatly).
05-06-2006, 12:21 PM#9
Anitarf
Surely you can add triggers to ressurection spells that pick all alive units around the caster and add a damage detect trigger to all those that don't have it (=the ones that were ressurected).
05-06-2006, 02:22 PM#10
Vexorian
It is really easy to make these triggers ressurection/animate dead proof without harming performance
05-06-2006, 05:08 PM#11
shadow1500
Quote:
Originally Posted by Chuckle_Brother
Just to clear something up:

1) Heroes reviving counts as entering the map
2) units being raised by Animate Dead(notice that I didn't say animate dead or resurrection because in essence they are one and the same, just a different anim and orderid) also count as entering the map.

Now I will likely be flamed for saying this and called a noob(which I am cause I am only a few months into this jass stuff). But I tested, raised units take damage from my generic damage functions just as well as if they were preplaced or new entering units.
Is this false then?
05-06-2006, 05:49 PM#12
Captain Griffen
Animate dead and resurrection are quite different. Animate dead creates new, summoned units.
05-06-2006, 06:33 PM#13
Vexorian
The animate dead units are the same.

Quote:
Is this false then?

I think there might have been other factors involved in Chuckle's Experiment that made him come to the conclusion cause my test didn't trigger the event
05-06-2006, 06:36 PM#14
SuperDuperGuy
Vexorian, what utilities did you use to test leaks durring games? It would be super helpful, I wouldn't have to ask so many leak questions.
05-06-2006, 06:40 PM#15
Vexorian
I use WindowWe and Task Manager