I have 8 units, 4 opposing players controlling 2 each
What I Want
I need a unique action to occur in the event of each unit's death.
My Question
Is it better to use a different trigger for each "variable(unit) dies"
or should I use one trigger "any unit dies" with 8 conditions "if (triggering unit) == variable(unit)"?
Additionally, is there a way to block normal communication between players in the game?
It's better if you use one Trigger with:"Any Unit dies" and a action called:"Switch" with the Depending Value:"Triggering Unit(The unit that was killed)". And create value's in the switch action with the variable(Unit). This makes it look much better than nesting If and Elses.
Well, that depends I guess. If you have lots of other units that die a lot, you might not want "any unit", since the trigger would be called quite often.
In that scenario, it might be better to make a trigger for each team, and add events when you add units (requires custom script). Also, if you have a lot of actions, you might want to split it out into a function to avoid code duplication.
That is just an optimization.. try the simple solution, if you run into performance issues regarding that trigger running too often, this would solve it.
To block communication, you can hide the message log button, and move the chat frame out of screen. Then you would have to make your own chat system to allow players to communicate. The down side is that players wouldn't receive whispers from outside the game anymore.
Use more conditions. A trigger gets invoked even if the conditions aren't met. If you have 10 different "unit dies" triggers and you have a trigger instantly kills 30 units units, you're going to get 300 triggers invoked even if no conditions are met.
Rollback Post to RevisionRollBack
To post a comment, please login or register a new account.
What I Have
I have 8 units, 4 opposing players controlling 2 each
What I Want
I need a unique action to occur in the event of each unit's death.
My Question
Is it better to use a different trigger for each "variable(unit) dies" or should I use one trigger "any unit dies" with 8 conditions "if (triggering unit) == variable(unit)"?
Additionally, is there a way to block normal communication between players in the game?
It's better if you use one Trigger with:"Any Unit dies" and a action called:"Switch" with the Depending Value:"Triggering Unit(The unit that was killed)". And create value's in the switch action with the variable(Unit). This makes it look much better than nesting If and Elses.
Well, that depends I guess. If you have lots of other units that die a lot, you might not want "any unit", since the trigger would be called quite often.
In that scenario, it might be better to make a trigger for each team, and add events when you add units (requires custom script). Also, if you have a lot of actions, you might want to split it out into a function to avoid code duplication.
That is just an optimization.. try the simple solution, if you run into performance issues regarding that trigger running too often, this would solve it.
To block communication, you can hide the message log button, and move the chat frame out of screen. Then you would have to make your own chat system to allow players to communicate. The down side is that players wouldn't receive whispers from outside the game anymore.
See this about moving the chat frame out
http://www.sc2mapster.com/forums/resources/tutorials/20323-ui-sc2layout-files-override-method-aiurchef-method/#posts
@Coexistence: Go
Use more conditions. A trigger gets invoked even if the conditions aren't met. If you have 10 different "unit dies" triggers and you have a trigger instantly kills 30 units units, you're going to get 300 triggers invoked even if no conditions are met.