[Trigger] Could This Bug if Two Players Quit at Same Time?

Level 21
Joined
Mar 16, 2008
Messages
955
Hi, players are reporting some bugs regarding the player cap per team and I think it stems from this trigger, possibly players not being removed from the groups that the caps are calculated off of. Could udg_PN bug out here?

  • Universal Knight Quits
    • Events
      • Player - Player 5 (Yellow) leaves the game
      • Player - Player 6 (Orange) leaves the game
      • Player - Player 7 (Green) leaves the game
      • Player - Player 8 (Pink) leaves the game
      • Player - Player 9 (Gray) leaves the game
      • Player - Player 10 (Light Blue) leaves the game
      • Player - Player 11 (Dark Green) leaves the game
      • Player - Player 12 (Brown) leaves the game
      • Player - Player 17 (Wheat) leaves the game
      • Player - Player 18 (Peach) leaves the game
      • Player - Player 19 (Mint) leaves the game
      • Player - Player 20 (Lavender) leaves the game
    • Conditions
    • Actions
      • Set VariableSet quits_PN = (Player number of (Triggering player))
      • Hero - Drop (Item carried by vault_array[quits_PN] in slot 1) from vault_array[quits_PN].
      • Hero - Drop (Item carried by vault_array[quits_PN] in slot 2) from vault_array[quits_PN].
      • Hero - Drop (Item carried by vault_array[quits_PN] in slot 3) from vault_array[quits_PN].
      • Hero - Drop (Item carried by vault_array[quits_PN] in slot 4) from vault_array[quits_PN].
      • Hero - Drop (Item carried by vault_array[quits_PN] in slot 5) from vault_array[quits_PN].
      • Hero - Drop (Item carried by vault_array[quits_PN] in slot 6) from vault_array[quits_PN].
      • Item - Pick every item in knght_room_region_array[quits_PN] and do (Actions)
        • Loop - Actions
          • Item - Move (Picked item) to (Random point in Center Rally Point <gen>)
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Player_array_var[quits_PN] is in Groups[1].) Equal to True
        • Then - Actions
          • Set VariableSet quitter_gold = (Player_array_var[quits_PN] Current gold)
          • Player - Set Player_array_var[quits_PN].Current gold to 0
          • Player - Set Player 1 (Red).Current gold to ((Player 1 (Red) Current gold) + quitter_gold)
        • Else - Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Player_array_var[quits_PN] is in Groups[2].) Equal to True
        • Then - Actions
          • Set VariableSet quitter_gold = (Player_array_var[quits_PN] Current gold)
          • Player - Set Player_array_var[quits_PN].Current gold to 0
          • Player - Set Player 2 (Blue).Current gold to ((Player 2 (Blue) Current gold) + quitter_gold)
        • Else - Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Player_array_var[quits_PN] is in Groups[3].) Equal to True
        • Then - Actions
          • Set VariableSet quitter_gold = (Player_array_var[quits_PN] Current gold)
          • Player - Set Player_array_var[quits_PN].Current gold to 0
          • Player - Set Player 3 (Teal).Current gold to ((Player 3 (Teal) Current gold) + quitter_gold)
        • Else - Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Player_array_var[quits_PN] is in Groups[4].) Equal to True
        • Then - Actions
          • Set VariableSet quitter_gold = (Player_array_var[quits_PN] Current gold)
          • Player - Set Player_array_var[quits_PN].Current gold to 0
          • Player - Set Player 4 (Purple).Current gold to ((Player 4 (Purple) Current gold) + quitter_gold)
        • Else - Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Player_array_var[quits_PN] is in Groups[5].) Equal to True
        • Then - Actions
          • Set VariableSet quitter_gold = (Player_array_var[quits_PN] Current gold)
          • Player - Set Player_array_var[quits_PN].Current gold to 0
          • Player - Set Player 21 (Coal).Current gold to ((Player 21 (Coal) Current gold) + quitter_gold)
        • Else - Actions
      • Set VariableSet units_owned[quits_PN] = (Units owned by Player_array_var[quits_PN].)
      • Unit Group - Pick every unit in units_owned[quits_PN] and do (Actions)
        • Loop - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • Or - Any (Conditions) are true
                • Conditions
                  • ((Picked unit) has an item of type Midnight Ankh) Equal to True
                  • ((Picked unit) has an item of type Plans: Black Tent) Equal to True
            • Then - Actions
              • Item - Remove (Item carried by (Picked unit) of type Midnight Ankh)
              • Item - Remove (Item carried by (Picked unit) of type Midnight Ankh)
              • Item - Remove (Item carried by (Picked unit) of type Midnight Ankh)
              • Item - Remove (Item carried by (Picked unit) of type Midnight Ankh)
              • Item - Remove (Item carried by (Picked unit) of type Midnight Ankh)
              • Item - Remove (Item carried by (Picked unit) of type Midnight Ankh)
              • Item - Remove (Item carried by (Picked unit) of type Plans: Black Tent)
              • Item - Remove (Item carried by (Picked unit) of type Plans: Black Tent)
              • Item - Remove (Item carried by (Picked unit) of type Plans: Black Tent)
              • Item - Remove (Item carried by (Picked unit) of type Plans: Black Tent)
              • Item - Remove (Item carried by (Picked unit) of type Plans: Black Tent)
              • Item - Remove (Item carried by (Picked unit) of type Plans: Black Tent)
            • Else - Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Unit-type of Knight_Hero_Var[quits_PN]) Equal to Peasant Knight
        • Then - Actions
          • Item - Remove (Item carried by Knight_Hero_Var[quits_PN] of type Plans: Town Hall)
        • Else - Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Knight_Altar_Var[quits_PN] is alive) Equal to True
        • Then - Actions
          • Hero - Drop the item from slot 1 of Knight_Altar_Var[quits_PN].
          • Hero - Drop the item from slot 2 of Knight_Altar_Var[quits_PN].
          • Hero - Drop the item from slot 3 of Knight_Altar_Var[quits_PN].
          • Hero - Drop the item from slot 4 of Knight_Altar_Var[quits_PN].
          • Hero - Drop the item from slot 5 of Knight_Altar_Var[quits_PN].
          • Hero - Drop the item from slot 6 of Knight_Altar_Var[quits_PN].
          • Unit - Move Knight_Altar_Var[quits_PN] instantly to Knight_Altar_Default_Pt[quits_PN]
          • Unit - Remove Knight_Altar_Var[quits_PN] from the game
        • Else - Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Knight_Hero_Var[quits_PN] is dead) Equal to True
        • Then - Actions
          • Hero - Instantly revive Knight_Hero_Var[quits_PN] at blk_default_pt_array[quits_PN], Show revival graphics
          • Unit - Move Knight_Hero_Var[quits_PN] instantly to blk_default_pt_array[quits_PN]
        • Else - Actions
      • Player - Set Player 21 (Coal).Food used to 0
      • Unit - Change ownership of Knight_Hero_Var[quits_PN] to Player 21 (Coal) and Retain color
      • Unit - Order Knight_Hero_Var[quits_PN] to Attack-Move To Center_Point_Var
      • Unit Group - Remove Knight_Hero_Var[quits_PN] from units_owned[quits_PN].
      • Unit Group - Pick every unit in units_owned[quits_PN] and do (Unit - Change ownership of (Picked unit) to Player 21 (Coal) and Change color)
      • Custom script: call DestroyGroup(udg_units_owned[udg_quits_PN])
      • Leaderboard - Remove Player_array_var[quits_PN] from Alliances_Leaderboard.
      • Player Group - Remove Player_array_var[quits_PN] from Groups[0].
      • Player Group - Remove Player_array_var[quits_PN] from Groups[1].
      • Player Group - Remove Player_array_var[quits_PN] from Groups[2].
      • Player Group - Remove Player_array_var[quits_PN] from Groups[3].
      • Player Group - Remove Player_array_var[quits_PN] from Groups[4].
      • Player Group - Remove Player_array_var[quits_PN] from Groups[5].
      • Player Group - Add Player_array_var[quits_PN] to leaver_group
      • Countdown Timer - Start End_Timer as a One-shot timer that will expire in 0.10 seconds
      • Countdown Timer - Start End_Timer_Camera as a One-shot timer that will expire in 1.00 seconds
      • Unit - Remove hire_buttons_red[quits_PN] from the game
      • Unit - Remove hire_buttons_blue[quits_PN] from the game
      • Unit - Remove hire_buttons_teal[quits_PN] from the game
      • Unit - Remove hire_buttons_purp[quits_PN] from the game
      • -------- knight limits --------
      • Player Group - Remove Player_array_var[quits_PN] from Knights_Group_Var.
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • no_knight_cap Equal to False
          • teams_locked Equal to False
        • Then - Actions
          • Countdown Timer - Pause knight_max_calculate_timer
          • Countdown Timer - Start knight_max_calculate_timer as a One-shot timer that will expire in 2.00 seconds
        • Else - Actions
      • -------- ------------------ --------
 
Level 29
Joined
Sep 26, 2009
Messages
2,594
what do you mean by "player cap per team"?

As side note. If I understand it right, this set of actions removes items from vault and moves them to center rally point, right?
  • Hero - Drop (Item carried by vault_array[quits_PN] in slot 1) from vault_array[quits_PN].
  • Hero - Drop (Item carried by vault_array[quits_PN] in slot 2) from vault_array[quits_PN].
  • Hero - Drop (Item carried by vault_array[quits_PN] in slot 3) from vault_array[quits_PN].
  • Hero - Drop (Item carried by vault_array[quits_PN] in slot 4) from vault_array[quits_PN].
  • Hero - Drop (Item carried by vault_array[quits_PN] in slot 5) from vault_array[quits_PN].
  • Hero - Drop (Item carried by vault_array[quits_PN] in slot 6) from vault_array[quits_PN].
  • Item - Pick every item in knght_room_region_array[quits_PN] and do (Actions)
    • Loop - Actions
      • Item - Move (Picked item) to (Random point in Center Rally Point <gen>)
If so, you can move items directly from the unit to some location like so:
  • For each (Integer loopVar) from 1 to 6, do (Actions)
    • Loop - Actions
      • Item - Move (Item carried by vault_array[quits_PN] in slot loopVar) to (Random point in Center Rally Point <gen>)
 
Top