I got a trigger that spawns some units, stores them in unit groups, and then wait untill all units in the unit group is dead. In the meantime while the units are alive, they try to kill a player controlled unit, if the unit dies, the game is lost.
Now my problem is that I got a second trigger that activates when the player controlled unit dies, and I want to skip the remaining actions in the waiting trigger, and run a "The game is lost" sequence in the second trigger.
Is this possible, and how would it come around doing it?
From what I understand, SC2 editor does not support multiple threads. The problem you are describing, from a programming standpoint, seems as if you want function A to stop execution of function B, which sounds a lot like threads.
As previously posted, you may want to rethink your code structure for this. Instead of having the trigger that spawned the hostile units Wait() until they die, create another trigger that activates once they are dead. You might need to have a variable that lets you know when the death checking trigger should activate (if unitsspawned == true AND they are dead, for example) because it might fire off before the hostiles are even spawned if it has no conditions.
The ideal solution would be to create a dynamic trigger that starts checking if the hostiles are dead. This trigger would be created after they have been created in the spawn trigger. (This can only be done in galaxy scripts)
I got a trigger that spawns some units, stores them in unit groups, and then wait untill all units in the unit group is dead. In the meantime while the units are alive, they try to kill a player controlled unit, if the unit dies, the game is lost. Now my problem is that I got a second trigger that activates when the player controlled unit dies, and I want to skip the remaining actions in the waiting trigger, and run a "The game is lost" sequence in the second trigger.
Is this possible, and how would it come around doing it?
why u have the player lost sequence in the second trigger and not in an own trigger ?
@windowssiebenfan: Go
Ehhh.. Lets call the trigger thats spawns and pauses "Trigger 1" and the trigger I want to skip the remaining actions in Trigger 1, "Trigger 2".
Trigger 1 basically looks like this:
I am not able to check if the "PlayerOwnedUnit" dies before the wait action, unless I do it in another trigger, my "Trigger 2".
@Demtrod: Go
From what I understand, SC2 editor does not support multiple threads. The problem you are describing, from a programming standpoint, seems as if you want function A to stop execution of function B, which sounds a lot like threads.
As previously posted, you may want to rethink your code structure for this. Instead of having the trigger that spawned the hostile units Wait() until they die, create another trigger that activates once they are dead. You might need to have a variable that lets you know when the death checking trigger should activate (if unitsspawned == true AND they are dead, for example) because it might fire off before the hostiles are even spawned if it has no conditions.
The ideal solution would be to create a dynamic trigger that starts checking if the hostiles are dead. This trigger would be created after they have been created in the spawn trigger. (This can only be done in galaxy scripts)
@Demtrod: Go
Use action "Stop Trigger". Just like skip remaining actions, but in any trigger you want.
Or you can put a "if then else" before your wait action to check if "PlayerOwnedUnit" is alive or not.
@soulzek: Go Thank you for your suggestion :)
@LaxSalmon: Go I'll use the Stop Trigger, cant belive I havent thought of that. It's exactly the action I was looking for, but couldnt find.
The other options is to use a while loop with the end game actions after and check if the player unit is alive.