| 05-05-2006, 11:31 PM | #1 |
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 |
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 |
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 |
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 | |
Quote:
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 |
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 |
I tested with animate dead, ressurection and latest patch and they definitively don't trigger that event |
| 05-06-2006, 12:10 PM | #8 |
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 |
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 |
It is really easy to make these triggers ressurection/animate dead proof without harming performance |
| 05-06-2006, 05:08 PM | #11 | |
Quote:
|
| 05-06-2006, 05:49 PM | #12 |
Animate dead and resurrection are quite different. Animate dead creates new, summoned units. |
| 05-06-2006, 06:33 PM | #13 | |
The animate dead units are the same. Quote:
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 |
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 |
I use WindowWe and Task Manager |
