I need some major trigger help : ( I have triggers that spawn units for all active players if they have a certain building. I also have a trigger that makes the removes a player from active players if his building is destroyed. My problem is that randomly the spawn trigger will stop working after a building is destroyed. Say Player 5's building is destroyed, then player 6 will stop spawning... Any idea what might cause this?
Player Group - Pick each player in (Active Players) and do (Actions)
Actions
General - If (Conditions) then do (Actions) else do (Actions)
If
(Tier Zero count for player (Player (Picked player) from (Active Players)), counting Queued Or Better) == 1
Then
Unit - Create 1 Spawn - Zealot for player (Picked player) at (Start location of player (Picked player)) facing 270.0 degrees (No Options)
Else
- Lose Trigger -
Player Loses
Events
Unit - Any Unit dies
Local Variables
Conditions
Or
Conditions
(Unit type of (Triggering unit)) == Tier Zero
(Unit type of (Triggering unit)) == Protoss Tier 1
(Unit type of (Triggering unit)) == Protoss Tier 2
(Unit type of (Triggering unit)) == Protoss Tier 3
(Unit type of (Triggering unit)) == Protoss Tier 4
(Unit type of (Triggering unit)) == Protoss Tier 5
(Unit type of (Triggering unit)) == Terran Tier 1
(Unit type of (Triggering unit)) == Terran Tier 2
(Unit type of (Triggering unit)) == Terran Tier 3
(Unit type of (Triggering unit)) == Terran Tier 4
(Unit type of (Triggering unit)) == Terran Tier 5
(Unit type of (Triggering unit)) == Zerg Tier 1
(Unit type of (Triggering unit)) == Zerg Tier 2
(Unit type of (Triggering unit)) == Zerg Tier 3
(Unit type of (Triggering unit)) == Zerg Tier 4
(Unit type of (Triggering unit)) == Zerg Tier 5
Actions
Unit Group - Pick each unit in (Any units in (Entire map) owned by player (Owner of (Triggering unit)) matching Excluded: Missile, Dead, Hidden, with at most Any Amount) and do (Actions)
Actions
Unit - Kill (Picked unit)
UI - Display "A player has been defeated!" for (All players) to Chat area
Game - End game in Defeat for player (Owner of (Triggering unit)) (Show dialogs, Show score screen)
- Leave Trigger -
Player Leaves
Events
Player - Player Any Player leaves the game with Any
Local Variables
Conditions
Actions
UI - Display "A player has left the game!" for (All players) to Chat area
Unit Group - Pick each unit in (Any units in (Entire map) owned by player (Triggering player) matching Excluded: Missile, Dead, Hidden, with at most Any Amount) and do (Actions)
Array Indicies start at 0 (aka, a 5 element array is 0-4)
Player Indicies start at 1 (aka, 5 players means player 1-5)
I wrote my own little function for (pickedPlayerMinusOne) since you have to decrement things like "pick each player in player group" to stick them in arrays.
you just put a function with return type int, parameter "PlayerNumber" and spit out arithmatic PlayerNumber - 1...
Then when coding just remember any time you call a function, you make sure to always ask for PlayerNumber and when ever you are modifying an array variable to use PlayerIndex so you don't start getting it confused where you used each.(If that makes sense)
I'm not sure how that would work with the trigger I'm using... It checks all active players and if each have the right unit it spawns a unit every 11 secs for that player. I'm not using numbers for each player... Unless I read that totally wrong.
I didn't want to try to figure out your posted trigger, hehe...
Is is 3 triggers? It looks like there is a looped trigger on 11 second timer that spawns a unit for all active players. the list of "active players" automatically updates when a player is gone from the game.
And then a lose trigger if they lose ANY unit it kills all of their units...
and then a trigger to kill all of a players units if they leave...
Well I spent 4 hours rewriting all my triggers and I think I fixed it.
I have spawning triggers that spawn units if a player owns a certain building. That was only 1 of them but the others are all the same, just with different units.
The lose trigger kills all the players units if a certain unit dies. The problem was with the spawning triggers. It would work perfectly... Until someone leaves or dies. When that happened some players units would stop spawning while others would continue unaffected.
Like I said though, I fixed it now... hopefully. I rewrote all the spawn triggers for each individual player, instead of using player groups. I think maybe players were getting removed from the player group? I don't really know...
Array Indicies start at 0 (aka, a 5 element array is 0-4)
Player Indicies start at 1 (aka, 5 players means player 1-5)
I wrote my own little function for (pickedPlayerMinusOne) since you have to decrement things like "pick each player in player group" to stick them in arrays.
you just put a function with return type int, parameter "PlayerNumber" and spit out arithmatic PlayerNumber - 1...
Then when coding just remember any time you call a function, you make sure to always ask for PlayerNumber and when ever you are modifying an array variable to use PlayerIndex so you don't start getting it confused where you used each.(If that makes sense)
I thought an array of 5 was 0-5 :/. All my arrays of size 15 work if I have all players working and use '<variable>[Triggering player]'
Rollback Post to RevisionRollBack
To post a comment, please login or register a new account.
I need some major trigger help : ( I have triggers that spawn units for all active players if they have a certain building. I also have a trigger that makes the removes a player from active players if his building is destroyed. My problem is that randomly the spawn trigger will stop working after a building is destroyed. Say Player 5's building is destroyed, then player 6 will stop spawning... Any idea what might cause this?
No, but it would be much easier to help if you posted your triggers.
Sorry, haha completely forgot...
- Spawn Trigger -
Tier Zero Spawn
Events
Timer - Every 11.0 seconds of Game Time
Local Variables
Conditions
Actions
Player Group - Pick each player in (Active Players) and do (Actions)
Actions
General - If (Conditions) then do (Actions) else do (Actions)
If
(Tier Zero count for player (Player (Picked player) from (Active Players)), counting Queued Or Better) == 1
Then
Unit - Create 1 Spawn - Zealot for player (Picked player) at (Start location of player (Picked player)) facing 270.0 degrees (No Options)
Else
- Lose Trigger -
Player Loses
Events
Unit - Any Unit dies
Local Variables
Conditions
Or
Conditions
(Unit type of (Triggering unit)) == Tier Zero
(Unit type of (Triggering unit)) == Protoss Tier 1
(Unit type of (Triggering unit)) == Protoss Tier 2
(Unit type of (Triggering unit)) == Protoss Tier 3
(Unit type of (Triggering unit)) == Protoss Tier 4
(Unit type of (Triggering unit)) == Protoss Tier 5
(Unit type of (Triggering unit)) == Terran Tier 1
(Unit type of (Triggering unit)) == Terran Tier 2
(Unit type of (Triggering unit)) == Terran Tier 3
(Unit type of (Triggering unit)) == Terran Tier 4
(Unit type of (Triggering unit)) == Terran Tier 5
(Unit type of (Triggering unit)) == Zerg Tier 1
(Unit type of (Triggering unit)) == Zerg Tier 2
(Unit type of (Triggering unit)) == Zerg Tier 3
(Unit type of (Triggering unit)) == Zerg Tier 4
(Unit type of (Triggering unit)) == Zerg Tier 5
Actions
Unit Group - Pick each unit in (Any units in (Entire map) owned by player (Owner of (Triggering unit)) matching Excluded: Missile, Dead, Hidden, with at most Any Amount) and do (Actions)
Actions
Unit - Kill (Picked unit)
UI - Display "A player has been defeated!" for (All players) to Chat area
Game - End game in Defeat for player (Owner of (Triggering unit)) (Show dialogs, Show score screen)
- Leave Trigger -
Player Leaves
Events
Player - Player Any Player leaves the game with Any
Local Variables
Conditions
Actions
UI - Display "A player has left the game!" for (All players) to Chat area
Unit Group - Pick each unit in (Any units in (Entire map) owned by player (Triggering player) matching Excluded: Missile, Dead, Hidden, with at most Any Amount) and do (Actions)
Actions
Unit - Kill (Picked unit)
@ndudz: Go
I bet I know without even looking at your code...
Array Indicies start at 0 (aka, a 5 element array is 0-4)
Player Indicies start at 1 (aka, 5 players means player 1-5)
I wrote my own little function for (pickedPlayerMinusOne) since you have to decrement things like "pick each player in player group" to stick them in arrays.
you just put a function with return type int, parameter "PlayerNumber" and spit out arithmatic PlayerNumber - 1...
Then when coding just remember any time you call a function, you make sure to always ask for PlayerNumber and when ever you are modifying an array variable to use PlayerIndex so you don't start getting it confused where you used each.(If that makes sense)
@Anthius: Go
I'm not sure how that would work with the trigger I'm using... It checks all active players and if each have the right unit it spawns a unit every 11 secs for that player. I'm not using numbers for each player... Unless I read that totally wrong.
I didn't want to try to figure out your posted trigger, hehe...
Is is 3 triggers? It looks like there is a looped trigger on 11 second timer that spawns a unit for all active players. the list of "active players" automatically updates when a player is gone from the game.
And then a lose trigger if they lose ANY unit it kills all of their units...
and then a trigger to kill all of a players units if they leave...
In words, what SHoULD this trigger do?
Well I spent 4 hours rewriting all my triggers and I think I fixed it.
I have spawning triggers that spawn units if a player owns a certain building. That was only 1 of them but the others are all the same, just with different units.
The lose trigger kills all the players units if a certain unit dies. The problem was with the spawning triggers. It would work perfectly... Until someone leaves or dies. When that happened some players units would stop spawning while others would continue unaffected.
Like I said though, I fixed it now... hopefully. I rewrote all the spawn triggers for each individual player, instead of using player groups. I think maybe players were getting removed from the player group? I don't really know...
I thought an array of 5 was 0-5 :/. All my arrays of size 15 work if I have all players working and use '<variable>[Triggering player]'