I have a question regarding the efficiency of triggers. I understand that in general, the fewer the triggers the better. I also understand why it is extremely inefficient to have several triggers with the same conditions (especially vague conditions) running at the same time. However, my question is whether it is better to have several very specific triggers with similar conditions, or one trigger with a general condition that leads to a function with a lot of if/else statements?
For example, in my map, every time a worker unit dies it respawns at a given player's spawn point. The map starts out by binding the "Unit Dies" event to that specific unit. The "Unit Dies" trigger disables itself when the worker dies, and then a new "Unit Dies" trigger is created for the replacement worker that spawns. I am trying to figure out whether I should have just an "Any Unit Dies" trigger with if/else statements instead, but I'm not sure whether the game's trigger condition system is more efficient than if/else is.
I have a question regarding the efficiency of triggers. I understand that in general, the fewer the triggers the better. I also understand why it is extremely inefficient to have several triggers with the same conditions (especially vague conditions) running at the same time. However, my question is whether it is better to have several very specific triggers with similar conditions, or one trigger with a general condition that leads to a function with a lot of if/else statements?
For example, in my map, every time a worker unit dies it respawns at a given player's spawn point. The map starts out by binding the "Unit Dies" event to that specific unit. The "Unit Dies" trigger disables itself when the worker dies, and then a new "Unit Dies" trigger is created for the replacement worker that spawns. I am trying to figure out whether I should have just an "Any Unit Dies" trigger with if/else statements instead, but I'm not sure whether the game's trigger condition system is more efficient than if/else is.
Any thoughts?
Fewer events are ALWAYS more optimized and can make a tremendous difference in responsiveness and lag on battle.net.
@DarkRevenantX: Go
Threaded action definition loops with conditional if/then statements make great replacements for events and can help reduce lag.