im trying to implement player controlled spawning. i have it all pretty much done.
theres one problem with it however that i cannot seem to overcome.
basically player 1 spawns a unit. that unit is spawned for players 2, 3, 4.
it's added to the action queue with a wait time of 0.75.
the problem is. if player 1 has queued up 100 units to spawn in the action queue. nothing by any other player will get spawned until those 100 units have spawned for player 1.
im trying to work out a way to make it possible for units to spawn in ALL lanes at the same time without having double spawns
my action queue trigger for player 1
Player 1 Spawns Unit
Events
Unit - Any Unit Enters Unit Spawner P1
Local Variables
Spawned Unit = No Game Link <Game Link - Unit>
Conditions
Game Started == 1
Mode == 2
Actions
Unit - Remove (Triggering unit) from the game
Variable - Set Spawned Unit = (Unit type of (Triggering unit))
Trigger - Add (Actions) to the action queue
Actions
General - If (Conditions) then do (Actions) else do (Actions)
If
Player Lives[1] > 0
Then
Unit - Create 1 Spawned Unit for player 1 at (Center of Spawn(P2)) using default facing (No Options)
Unit - Change ownership of (Last created unit) to player 14 and Retain Color
Environment - Execute Unit Spawned Effect on (Last created unit) from player 14
Else
General - If (Conditions) then do (Actions) else do (Actions)
If
Player Lives[2] > 0
Then
Unit - Create 1 Spawned Unit for player 1 at (Center of Spawn(P3)) using default facing (No Options)
Unit - Change ownership of (Last created unit) to player 14 and Retain Color
Environment - Execute Unit Spawned Effect on (Last created unit) from player 14
Else
General - If (Conditions) then do (Actions) else do (Actions)
If
Player Lives[3] > 0
Then
Unit - Create 1 Spawned Unit for player 1 at (Center of Spawn(P4)) using default facing (No Options)
Unit - Change ownership of (Last created unit) to player 14 and Retain Color
Environment - Execute Unit Spawned Effect on (Last created unit) from player 14
Else
General - Wait 0.75 Game Time seconds
The best way I think to do this is to make the trigger run an action and to multi-thread the action. This is easy to do in the editor as when you create and action and click on the action type in the top, below it are a list of tick boxes, with the top one being a tick box for Create a thread for this action. This will mean that this will run and can wait forever, which stopping the action of the other units. Therefore, you just have a multi-threading action for each player so that only there one spawned units hold up there own other spawned units and do not effect the others players spawns.
It was 2 days ago, but maybe you see this and it helps.
It locks the command and as all your spawns are in un-multi threaded triggers, it will stop the spawning. But if you have a separate thread for each spawn, then the threads will each one separately and not lock up each other spawn, but you will need to have one for each persons unless you can make the actions generalised, i cant help much on that without seeing what your doing.
Rollback Post to RevisionRollBack
To post a comment, please login or register a new account.
im trying to implement player controlled spawning. i have it all pretty much done.
theres one problem with it however that i cannot seem to overcome.
basically player 1 spawns a unit. that unit is spawned for players 2, 3, 4.
it's added to the action queue with a wait time of 0.75.
the problem is. if player 1 has queued up 100 units to spawn in the action queue. nothing by any other player will get spawned until those 100 units have spawned for player 1.
im trying to work out a way to make it possible for units to spawn in ALL lanes at the same time without having double spawns
my action queue trigger for player 1
Player 1 Spawns Unit
Events
Unit - Any Unit Enters Unit Spawner P1
Local Variables
Spawned Unit = No Game Link <Game Link - Unit>
Conditions
Game Started == 1
Mode == 2
Actions
Unit - Remove (Triggering unit) from the game
Variable - Set Spawned Unit = (Unit type of (Triggering unit))
Trigger - Add (Actions) to the action queue
Actions
General - If (Conditions) then do (Actions) else do (Actions)
If
Player Lives[1] > 0
Then
Unit - Create 1 Spawned Unit for player 1 at (Center of Spawn(P2)) using default facing (No Options)
Unit - Change ownership of (Last created unit) to player 14 and Retain Color
Environment - Execute Unit Spawned Effect on (Last created unit) from player 14
Else
General - If (Conditions) then do (Actions) else do (Actions)
If
Player Lives[2] > 0
Then
Unit - Create 1 Spawned Unit for player 1 at (Center of Spawn(P3)) using default facing (No Options)
Unit - Change ownership of (Last created unit) to player 14 and Retain Color
Environment - Execute Unit Spawned Effect on (Last created unit) from player 14
Else
General - If (Conditions) then do (Actions) else do (Actions)
If
Player Lives[3] > 0
Then
Unit - Create 1 Spawned Unit for player 1 at (Center of Spawn(P4)) using default facing (No Options)
Unit - Change ownership of (Last created unit) to player 14 and Retain Color
Environment - Execute Unit Spawned Effect on (Last created unit) from player 14
Else
General - Wait 0.75 Game Time seconds
The best way I think to do this is to make the trigger run an action and to multi-thread the action. This is easy to do in the editor as when you create and action and click on the action type in the top, below it are a list of tick boxes, with the top one being a tick box for Create a thread for this action. This will mean that this will run and can wait forever, which stopping the action of the other units. Therefore, you just have a multi-threading action for each player so that only there one spawned units hold up there own other spawned units and do not effect the others players spawns.
It was 2 days ago, but maybe you see this and it helps.
Zeragon
Shouldn't that wait command included inside each if case? It seems that wait command is locking the action queue up. Well that's my opinion anyway
It locks the command and as all your spawns are in un-multi threaded triggers, it will stop the spawning. But if you have a separate thread for each spawn, then the threads will each one separately and not lock up each other spawn, but you will need to have one for each persons unless you can make the actions generalised, i cant help much on that without seeing what your doing.