Hello map making community.
I need some help with the trigger I made. So the idea is to have a timed PvP event which picks 2 random players to fight against each other in one out of 3 arenas.
When I tested it with another player (the map is for 2-6 players) it ported me and the other player to different arenas.
The issue is that I can't test it that often because I need another player obviously, so I want it to work next time.
This is the trigger I made:
Is there a better way for picking random players and if - lets say there are only 3 players, the third player has to be a spectator of the PvP match between player 1 and 2?
I'm glad for any answer and help!
I need some help with the trigger I made. So the idea is to have a timed PvP event which picks 2 random players to fight against each other in one out of 3 arenas.
When I tested it with another player (the map is for 2-6 players) it ported me and the other player to different arenas.
The issue is that I can't test it that often because I need another player obviously, so I want it to work next time.
This is the trigger I made:
-
PvP Event
-
Events
- Time - PvP_Timer expires
- Conditions
-
Actions
-
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
-
If - Conditions
- (Number of players in Player_Group_Playing) Greater than or equal to 2
-
Then - Actions
- Trigger - Turn off player dies <gen>
- Countdown Timer - Destroy PvP_Timer_Window
- Sound - Play ClanInvitation <gen>
- Game - Display to Player_Group_Playing the text: PvP Event!
-
Player Group - Pick every player in Player_Group_Playing and do (Actions)
-
Loop - Actions
- Set VariableSet PvP_PN = (Player number of (Picked player))
- Player Group - Add (Picked player) to Player_Group_PvP
- Unit - Remove All except expiration timer buffs from player_unit[PvP_PN]
- Unit - Set life of player_unit[PvP_PN] to 100.00%
- Unit - Set mana of player_unit[PvP_PN] to 100.00%
- Unit - Reset ability cooldowns for player_unit[PvP_PN].
-
Loop - Actions
- Wait 2.00 seconds
- Unit - Pause all units
- Set VariableSet Random_Player_PvP = (Random player from Player_Group_PvP)
- Player Group - Add Random_Player_PvP to PvP_Group1
- Player Group - Remove Random_Player_PvP from Player_Group_PvP.
- Set VariableSet PvP_Rnd_PN = (Player number of Random_Player_PvP)
- Set VariableSet PvP_Fighter = player_unit[PvP_Rnd_PN]
- Set VariableSet Random_Player_PvP_2 = (Random player from Player_Group_PvP)
- Player Group - Add Random_Player_PvP_2 to PvP_Group1
- Player Group - Remove Random_Player_PvP_2 from Player_Group_PvP.
- Set VariableSet PvP_Rnd_PN_2 = (Player number of Random_Player_PvP_2)
- Set VariableSet PvP_Fighter_2 = player_unit[PvP_Rnd_PN_2]
-
Player Group - Pick every player in PvP_Group1 and do (Actions)
-
Loop - Actions
- Player - Make Random_Player_PvP treat Random_Player_PvP_2 as an Enemy with shared vision
- Player - Make Random_Player_PvP_2 treat Random_Player_PvP as an Enemy with shared vision
- Unit - Move PvP_Fighter instantly to (Center of Arena_Region[1]), facing (Center of Arena_Region[2])
- Camera - Pan camera for (Owner of PvP_Fighter) to (Center of Arena_Region[7]) over 0.00 seconds
- Unit - Move PvP_Fighter_2 instantly to (Center of Arena_Region[2]), facing (Center of Arena_Region[1])
- Camera - Pan camera for (Owner of PvP_Fighter_2) to (Center of Arena_Region[7]) over 0.00 seconds
-
Loop - Actions
- Set VariableSet Random_Player_PvP_3 = (Random player from Player_Group_PvP)
- Player Group - Add Random_Player_PvP_3 to PvP_Group2
- Player Group - Remove Random_Player_PvP_3 from Player_Group_PvP.
- Set VariableSet PvP_Rnd_PN_3 = (Player number of Random_Player_PvP_3)
- Set VariableSet PvP_Fighter_3 = player_unit[PvP_Rnd_PN_3]
- Set VariableSet Random_Player_PvP_4 = (Random player from Player_Group_PvP)
- Player Group - Add Random_Player_PvP_4 to PvP_Group2
- Player Group - Remove Random_Player_PvP_4 from Player_Group_PvP.
- Set VariableSet PvP_Rnd_PN_4 = (Player number of Random_Player_PvP_4)
- Set VariableSet PvP_Fighter_4 = player_unit[PvP_Rnd_PN_4]
-
Player Group - Pick every player in PvP_Group2 and do (Actions)
-
Loop - Actions
- Player - Make Random_Player_PvP_3 treat Random_Player_PvP_4 as an Enemy with shared vision
- Player - Make Random_Player_PvP_4 treat Random_Player_PvP_3 as an Enemy with shared vision
- Unit - Move PvP_Fighter_3 instantly to (Center of Arena_Region[3]), facing (Center of Arena_Region[4])
- Camera - Pan camera for (Owner of PvP_Fighter_3) to (Center of Arena_Region[8]) over 0.00 seconds
- Unit - Move PvP_Fighter_4 instantly to (Center of Arena_Region[4]), facing (Center of Arena_Region[3])
- Camera - Pan camera for (Owner of PvP_Fighter_4) to (Center of Arena_Region[8]) over 0.00 seconds
-
Loop - Actions
- Set VariableSet Random_Player_PvP_5 = (Random player from Player_Group_PvP)
- Player Group - Add Random_Player_PvP_5 to PvP_Group3
- Player Group - Remove Random_Player_PvP_5 from Player_Group_PvP.
- Set VariableSet PvP_Rnd_PN_5 = (Player number of Random_Player_PvP_5)
- Set VariableSet PvP_Fighter_5 = player_unit[PvP_Rnd_PN_5]
- Set VariableSet Random_Player_PvP_6 = (Random player from Player_Group_PvP)
- Player Group - Add Random_Player_PvP_6 to PvP_Group3
- Player Group - Remove Random_Player_PvP_6 from Player_Group_PvP.
- Set VariableSet PvP_Rnd_PN_6 = (Player number of Random_Player_PvP_6)
- Set VariableSet PvP_Fighter_6 = player_unit[PvP_Rnd_PN_6]
-
Player Group - Pick every player in PvP_Group3 and do (Actions)
-
Loop - Actions
- Player - Make Random_Player_PvP_5 treat Random_Player_PvP_6 as an Enemy with shared vision
- Player - Make Random_Player_PvP_6 treat Random_Player_PvP_5 as an Enemy with shared vision
- Unit - Move PvP_Fighter_5 instantly to (Center of Arena_Region[5]), facing (Center of Arena_Region[6])
- Camera - Pan camera for (Owner of PvP_Fighter_5) to (Center of Arena_Region[9]) over 0.00 seconds
- Unit - Move PvP_Fighter_6 instantly to (Center of Arena_Region[6]), facing (Center of Arena_Region[5])
- Camera - Pan camera for (Owner of PvP_Fighter_6) to (Center of Arena_Region[9]) over 0.00 seconds
-
Loop - Actions
- Game - Display to (All players) the text: |cffffc519PvP start...
- Wait 1.00 seconds
-
For each (Integer Sec_5) from 1 to 5, do (Actions)
-
Loop - Actions
- Game - Display to (All players) the text: (|cffffc519 + (String(((Sec_5 - 6) x -1))))
- Sound - Play BattleNetTick <gen>
- Wait 1.00 seconds
-
Loop - Actions
- Sound - Play ArrangedTeamInvitation <gen>
- Unit - Unpause PvP_Fighter
- Unit - Unpause PvP_Fighter_2
- Unit - Unpause PvP_Fighter_3
- Unit - Unpause PvP_Fighter_4
- Unit - Unpause PvP_Fighter_5
- Unit - Unpause PvP_Fighter_6
- Countdown Timer - Start wavesDecay_timer as a One-shot timer that will expire in 120.00 seconds
- Countdown Timer - Start Waves_Timer_PvP as a One-shot timer that will expire in 150.00 seconds
- Countdown Timer - Create a timer window for Waves_Timer_PvP with title PvP Event Ending in...
- Set VariableSet PvP_End_Window = (Last created timer window)
- Trigger - Turn on PvP Hero Dies <gen>
-
Else - Actions
- Countdown Timer - Destroy PvP_Timer_Window
- Sound - Play Error <gen>
- Game - Display to Player_Group_Playing the text: Not enough Players ...
- Countdown Timer - Start waves_timer as a One-shot timer that will expire in 30.00 seconds
- Set VariableSet waves_lvl = (waves_lvl + 1)
- Countdown Timer - Create a timer window for waves_timer with title (Wave + (String(waves_lvl)))
- Set VariableSet waves_timer_window = (Last created timer window)
-
If - Conditions
-
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
-
Events
Is there a better way for picking random players and if - lets say there are only 3 players, the third player has to be a spectator of the PvP match between player 1 and 2?
I'm glad for any answer and help!