[Trigger] TD Template only wave 1 spawns?

Level 14
Joined
May 9, 2021
Messages
281
Hey, so I've been editing this TD Template for a really long time (on and off), and I've kind of hit a roadblock here because I don't 100% understand the Triggers.

I'm not sure exactly where I went wrong, but enemies don't spawn beyond wave 1, the spawn timer doesn't start, either.

The only thing I actually changed, as far as I can remember, was the "RB Wave Monsters" trigger (by changing the numbers in a few of the SetEnemyCount parts).

Everything important is under the Round Based Wave System.

This is probably really vague but I genuinely don't know what I changed before it stopped working.

If someone can point me in the right direction as to how ro fix this, I'd really appreciate it.
 

Attachments

Your own map is telling you why nothing spawns during gameplay :D
In "RB Next Round" trigger you set "TotalEnemies" this way:
  • Set VariableSet TotalEnemies = (EnemyCount[CurrentLevel] x 10)
The EnemyCount[xx] is initialized to value 15, so TotalEnemies is 150. Your "RB Total Enemies" checks if value of TotalEnemies is 0 in order to run next wave. You never create 150 enemies in a wave, only 15, so TotalEnemies never reaches zero and new wave does not spawn.
The in-game leaderboard is showing enemies left as 135 after killing the entire wave :)
So to fix this you will need to update your logic so that TotalEnemies variable actually reflects the amount of units in wave.

---
Since I checked your other triggers, let me point out some other unrelated stuff:

1. Map Initialization
It is a good practice to have only a single "Map Initialization" trigger. One of the reasons is because how all your "Map Initialization" triggers are executed depends on their order in the trigger tree view (the left side panel), with the top-most trigger executing first. I don't think you have any issues there at the moment, but if later on one init trigger was depending on values initialized by other init trigger and you decided to reorder triggers in the tree view, you could encounter bugs.
You don't need to put all actions into a single "Map Initialization" trigger, instead have only one trigger with such event and have that trigger run other triggers, e.g.
  • Map Init
    • Events
      • Map initialization
    • Conditions
    • Actions
      • Trigger - Run Settings <gen> (checking conditions)
      • Trigger - Run RB Wave Monsters <gen> (checking conditions)
  • Settings
    • Events
    • Conditions
    • Actions
      • Game - Turn the day/night cycle Off
      • Game - Set the time of day to 18.00
      • Visibility - Disable fog of war
      • ...
  • RB Wave Monsters
    • Events
    • Conditions
    • Actions
      • -------- Level 1 --------
      • Set VariableSet Level = 1
      • Set VariableSet MonsterType[Level] = Barbed Arachnathid [Wave 1] (Ground)
      • Set VariableSet EnemyCount[Level] = 15
      • -------- Level 2 --------
      • Set VariableSet Level = (Level + 1)
      • ...
Notice that only the first trigger now uses "Map Initialization" event and it runs other init triggers. This gives you control over the execution order, single entry point, etc.

2. Player Init
I see in many "Map Initialization" triggers you check player status. I think this is wrong for multiplayer games, as Map Initialization is running when you start loading the map, not when all players loaded it. Instead, use the following event, as that runs after all players loaded map:
  • Time - Elapsed game time is 0.00 seconds
3. Player groups
Instead of checking player status all over the place, simply create a player group that you populate with active players (for example with the above mentioned "Elapsed game time 0.00 seconds" event) and have another trigger that removes a player from the group when given player leaves game, e.g.:
  • Player Left
    • Events
      • Player - Player 1 (Red) leaves the game
    • Conditions
    • Actions
      • Player Group - Remove (Triggering player) from ActivePlayers.
The advantage of such approach is that you don't need to check player status over and over everywhere, the "ActivePlayers" player group already contains active players and clears inactive players.

4. Use the "Multiple actions" version of trigger actions
I see that you are using a lot of "If/Then/Else" and "Player Group - Pick every player and do" actions and duplicate them to do 2 things, instead of using their "Multiple actions" versions, e.g.

  • Kick Red
    • Events
      • Player - Player 2 (Blue) types a chat message containing -kick red as An exact match
      • Player - Player 3 (Teal) types a chat message containing -kick red as An exact match
      • Player - Player 4 (Purple) types a chat message containing -kick red as An exact match
      • Player - Player 5 (Yellow) types a chat message containing -kick red as An exact match
      • Player - Player 6 (Orange) types a chat message containing -kick red as An exact match
      • Player - Player 7 (Green) types a chat message containing -kick red as An exact match
      • Player - Player 8 (Pink) types a chat message containing -kick red as An exact match
      • Player - Player 9 (Gray) types a chat message containing -kick red as An exact match
      • Player - Player 10 (Light Blue) types a chat message containing -kick red as An exact match
    • Conditions
    • Actions
      • If ((Triggering player) Equal to Player 2 (Blue)) then do (If (Vote2Blue Equal to True) then do (Set VariableSet Kick1Red = (Kick1Red + 1)) else do (Do nothing)) else do (Do nothing)
      • If ((Triggering player) Equal to Player 2 (Blue)) then do (Set VariableSet Vote2Blue = False) else do (Do nothing)
      • If ((Triggering player) Equal to Player 3 (Teal)) then do (If (Vote3Teal Equal to True) then do (Set VariableSet Kick1Red = (Kick1Red + 1)) else do (Do nothing)) else do (Do nothing)
      • If ((Triggering player) Equal to Player 3 (Teal)) then do (Set VariableSet Vote3Teal = False) else do (Do nothing)
      • If ((Triggering player) Equal to Player 4 (Purple)) then do (If (Vote4Purple Equal to True) then do (Set VariableSet Kick1Red = (Kick1Red + 1)) else do (Do nothing)) else do (Do nothing)
      • If ((Triggering player) Equal to Player 4 (Purple)) then do (Set VariableSet Vote4Purple = False) else do (Do nothing)
      • If ((Triggering player) Equal to Player 5 (Yellow)) then do (If (Vote5Yellow Equal to True) then do (Set VariableSet Kick1Red = (Kick1Red + 1)) else do (Do nothing)) else do (Do nothing)
      • If ((Triggering player) Equal to Player 5 (Yellow)) then do (Set VariableSet Vote5Yellow = False) else do (Do nothing)
      • If ((Triggering player) Equal to Player 6 (Orange)) then do (If (Vote6Orange Equal to True) then do (Set VariableSet Kick1Red = (Kick1Red + 1)) else do (Do nothing)) else do (Do nothing)
      • If ((Triggering player) Equal to Player 6 (Orange)) then do (Set VariableSet Vote6Orange = False) else do (Do nothing)
      • If ((Triggering player) Equal to Player 7 (Green)) then do (If (Vote7Green Equal to True) then do (Set VariableSet Kick1Red = (Kick1Red + 1)) else do (Do nothing)) else do (Do nothing)
      • If ((Triggering player) Equal to Player 7 (Green)) then do (Set VariableSet Vote7Green = False) else do (Do nothing)
      • If ((Triggering player) Equal to Player 8 (Pink)) then do (If (Vote8Pink Equal to True) then do (Set VariableSet Kick1Red = (Kick1Red + 1)) else do (Do nothing)) else do (Do nothing)
      • If ((Triggering player) Equal to Player 8 (Pink)) then do (Set VariableSet Vote8Pink = False) else do (Do nothing)
      • If ((Triggering player) Equal to Player 9 (Gray)) then do (If (Vote9Gray Equal to True) then do (Set VariableSet Kick1Red = (Kick1Red + 1)) else do (Do nothing)) else do (Do nothing)
      • If ((Triggering player) Equal to Player 9 (Gray)) then do (Set VariableSet Vote9Gray = False) else do (Do nothing)
      • If ((Triggering player) Equal to Player 10 (Light Blue)) then do (If (Vote0LightBlue Equal to True) then do (Set VariableSet Kick1Red = (Kick1Red + 1)) else do (Do nothing)) else do (Do nothing)
      • If ((Triggering player) Equal to Player 10 (Light Blue)) then do (Set VariableSet Vote0LightBlue = False) else do (Do nothing)
      • Game - Display to (All players) the text: ((String(Kick1Red)) + (/3 Votes to Kick + (Name of Player 1 (Red))))
      • If (Kick1Red Greater than or equal to 3) then do (Game - Display to (All players) the text: ((Name of Player 1 (Red)) + has been |cffff0000kicked!|r)) else do (Do nothing)
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • Kick1Red Greater than or equal to 3
        • Then - Actions
          • Set VariableSet Vote2Blue = True
          • Set VariableSet Vote3Teal = True
          • Set VariableSet Vote4Purple = True
          • Set VariableSet Vote5Yellow = True
          • Set VariableSet Vote6Orange = True
          • Set VariableSet Vote7Green = True
          • Set VariableSet Vote8Pink = True
          • Set VariableSet Vote9Gray = True
          • Set VariableSet Vote0LightBlue = True
        • Else - Actions

Just replacing the first 2 actions related to Player 2 Blue voting to kick Player 1 Red, you can replace the two single-line If/Then/Else for a single and easier-to-understand "If/Then/Else (Multiple actions)":
  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
    • If - Conditions
      • (Triggering player) Equal to Player 2 (Blue)
      • Vote2Blue Equal to True
    • Then - Actions
      • Set VariableSet Vote2Blue = False
      • Set VariableSet Kick1Red = (Kick1Red + 1)
    • Else - Actions
Also, related to just the vote kick system, if you replace all the KickXXX and VoteXXX variables for Kick[] and Vote[] arrays, you can use player numbers as indices, further simplifying your triggers. You could even merge all the "Kick (color)" triggers into a single one (although you would need a bit more actions there to determine which player was voted to be kicked).

For example this is how the Kick Red could look:
  • Kick Red Copy
    • Events
      • Player - Player 2 (Blue) types a chat message containing -kick red as An exact match
      • Player - Player 3 (Teal) types a chat message containing -kick red as An exact match
      • Player - Player 4 (Purple) types a chat message containing -kick red as An exact match
      • Player - Player 5 (Yellow) types a chat message containing -kick red as An exact match
      • Player - Player 6 (Orange) types a chat message containing -kick red as An exact match
      • Player - Player 7 (Green) types a chat message containing -kick red as An exact match
      • Player - Player 8 (Pink) types a chat message containing -kick red as An exact match
      • Player - Player 9 (Gray) types a chat message containing -kick red as An exact match
      • Player - Player 10 (Light Blue) types a chat message containing -kick red as An exact match
    • Conditions
    • Actions
      • Set VariableSet PN = (Player number of (Triggering player))
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • Vote[PN] Equal to True
        • Then - Actions
          • Set VariableSet Vote[PN] = False
          • Set VariableSet Kick[1] = (Kick[1] + 1) // the index number 1 represents number of player 1 red
        • Else - Actions
      • Game - Display to (All players) the text: ((String(Kick[1])) + (/3 Votes to Kick + (Name of Player 1 (Red))))
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • Kick[1] Greater than or equal to 3
        • Then - Actions
          • Game - Display to (All players) the text: ((Name of Player 1 (Red)) + has been |cffff0000kicked!|r)
          • For each (Integer A) from 1 to 10, do (Actions)
            • Loop - Actions
              • Set VariableSet Vote[(Integer A)] = True
        • Else - Actions
Edit:
Actually just made the kick system, I think this could work:

  • Vote Kick Init
    • Events
      • Map initialization
    • Conditions
    • Actions
      • Set VariableSet PlayerColorText[1] = red
      • Set VariableSet PlayerColorText[2] = blue
      • Set VariableSet PlayerColorText[3] = teal
      • Set VariableSet PlayerColorText[4] = purple
      • Set VariableSet PlayerColorText[5] = yellow
      • Set VariableSet PlayerColorText[6] = orange
      • Set VariableSet PlayerColorText[7] = green
      • Set VariableSet PlayerColorText[8] = pink
      • Set VariableSet PlayerColorText[9] = gray
      • Set VariableSet PlayerColorText[10] = light blue
      • -------- ------------------------------------ --------
      • -------- Initialize "-kick <player_color" events --------
      • For each (Integer A) from 1 to 10, do (Actions)
        • Loop - Actions
          • For each (Integer B) from 1 to 10, do (Actions)
            • Loop - Actions
              • -------- (Integer A) must not equal (Integer B), otherwise player would be able to vote kick himself --------
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • (Integer A) Not equal to (Integer B)
                • Then - Actions
                  • Trigger - Add to Vote Kick <gen> the event (Player - (Player((Integer A))) types a chat message containing (-kick + PlayerColorText[(Integer B)]) as An exact match)
                • Else - Actions
  • Vote Kick
    • Events
    • Conditions
    • Actions
      • Set VariableSet PN = (Player number of (Triggering player))
      • -------- --------------------------------------------- --------
      • -------- If Player already voted, skip all remaining actions --------
      • If (Voted[PN] Equal to True) then do (Skip remaining actions) else do (Do nothing)
      • -------- --------------------------------------------- --------
      • Set VariableSet Voted[PN] = True
      • Set VariableSet VotedPlayerColor = (Substring((Entered chat string), 7, 0))
      • For each (Integer A) from 1 to 10, do (Actions)
        • Loop - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • VotedPlayerColor Equal to PlayerColorText[(Integer A)]
            • Then - Actions
              • Set VariableSet TargetPN = (Integer A)
            • Else - Actions
      • Set VariableSet Kick[TargetPN] = (Kick[TargetPN] + 1)
      • Game - Display to (All players) the text: ((String(Kick[TargetPN])) + (/3 Votes to Kick + (Name of (Player(TargetPN)))))
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • Kick[TargetPN] Greater than or equal to 3
        • Then - Actions
          • Game - Display to (All players) the text: ((Name of (Player(TargetPN))) + has been |cffff0000kicked!|r)
          • For each (Integer A) from 1 to 10, do (Actions)
            • Loop - Actions
              • Set VariableSet Voted[(Integer A)] = False
        • Else - Actions
 
Last edited:
Back
Top