Tar-Quaeron
New Member
- Reaction score
- 0
I have two related questions.
1st: Do triggers which are triggered when something related to a specific unit happens get destroyed when the specific unit gets destroyed? I'm talking about TriggerRegisterUnitEvent and TriggerRegisterUnitInRange. I mean obviously (hopefully) the trigger won't fire if the specific unit in their arguments doesn't exist anymore but the handle trigger to which the event is attached would still exist and take up space in the RAM right? Which means it would be necessary to destroy those triggers if the unit to which they pertain was destroyed.
This brings me to my 2nd question: How much time do ifs statements take to execute? I mean how bad are they in terms of lag/memory usage? The question I'm asking is whether it would be worth it, in order to disable the triggers mentioned above to add a 2nd event in the triggers which would detect when the specific unit is destroyed and then callDestroyTrigger(GetTriggeringTrigger) (because they're local I couldn't find another way). But this would require ifs and else ifs in the actions function which could be called up to several times a second at some moments in the game. So is it worth it to add those ifs?
In one case actually the trigger is TriggerRegisterUnitLeaveRectSimple which would keep firing even after the unit originally used to define the region is gone. I guess in that case it would really be worth it.
1st: Do triggers which are triggered when something related to a specific unit happens get destroyed when the specific unit gets destroyed? I'm talking about TriggerRegisterUnitEvent and TriggerRegisterUnitInRange. I mean obviously (hopefully) the trigger won't fire if the specific unit in their arguments doesn't exist anymore but the handle trigger to which the event is attached would still exist and take up space in the RAM right? Which means it would be necessary to destroy those triggers if the unit to which they pertain was destroyed.
This brings me to my 2nd question: How much time do ifs statements take to execute? I mean how bad are they in terms of lag/memory usage? The question I'm asking is whether it would be worth it, in order to disable the triggers mentioned above to add a 2nd event in the triggers which would detect when the specific unit is destroyed and then callDestroyTrigger(GetTriggeringTrigger) (because they're local I couldn't find another way). But this would require ifs and else ifs in the actions function which could be called up to several times a second at some moments in the game. So is it worth it to add those ifs?
In one case actually the trigger is TriggerRegisterUnitLeaveRectSimple which would keep firing even after the unit originally used to define the region is gone. I guess in that case it would really be worth it.