• 🏆 Texturing Contest #33 is OPEN! Contestants must re-texture a SD unit model found in-game (Warcraft 3 Classic), recreating the unit into a peaceful NPC version. 🔗Click here to enter!

Button used to start waves trigger

Status
Not open for further replies.
Level 20
Joined
Jul 14, 2011
Messages
3,213
Is the button a Dialog Box button? or an Ability? or a Dummy Item sold?.

I'll give some clues.

You need 4 variables:
1- A PlayerGroup (matching Players status: User, and Player is Playing).
2- An Integer variable (PlayerQ) to know the amount of players in PlayerGroup
3- A Boolean Variable array (WaveActv), to know if the player has already activated the next wave.
4- A Integer variable to know the amount of players that has already activated next wave. (ActvPlayers) (Edited)


-> On Map Init you need to set the PlayerGroup force.
-> Declare the number of Players in PlayerGroup into PlayerQ.

-> When the player activates next wave, set WaveActv[Player Number of Triggering Player] = true. The condition to activate the next wave, is having WaveActv[Player Number of Triggering Player] = false
-> When player activates next wave, set ActvPlayers = (ActvPlayers + 1)
-> If "ActvPlayers = PlayerQ" means that all players has activatd the next wave. Then set ActvPlayers = 0, reset the WaveAct[Player Number] to false, and start the wave.

-> If a player leaves, you have to update the PlayerQ variable.

May not be very precise, but may give you some clue.

EDIT: Actually, doesn't need the "Real variable". Change it for Integer.
 

Chaosy

Tutorial Reviewer
Level 40
Joined
Jun 9, 2011
Messages
13,183
This i how i should have made it.
  • setup
    • Events
      • Map initialization
    • Conditions
    • Actions
      • Player Group - Pick every player in (All players controlled by a User player) and do (Actions)
        • Loop - Actions
          • Set player_count = (player_count + 1)
  • someone left
    • Events
      • Player - Player 1 (Red) leaves the game
      • Player - Player 2 (Blue) leaves the game
      • Player - Player 3 (Teal) leaves the game
      • Player - Player 4 (Purple) leaves the game
      • Player - Player 5 (Yellow) leaves the game
    • Conditions
    • Actions
      • Set player_count = (player_count - 1)
  • ready
    • Events
      • Unit - A unit Acquires an item
    • Conditions
      • (Item-type of (Item being manipulated)) Equal to im ready item
    • Actions
      • Item - Remove (Item being manipulated)
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • player_is_ready[(Player number of (Triggering player))] Equal to False
        • Then - Actions
          • Set player_is_ready[(Player number of (Triggering player))] = True
          • Set player_is_ready_count = (player_is_ready_count + 1)
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • player_is_ready_count Equal to player_count
            • Then - Actions
              • Trigger - Run next wave <gen> (checking conditions)
            • Else - Actions
        • Else - Actions
 
Level 20
Joined
Jul 14, 2011
Messages
3,213
I would remove the manual "Player leaves the game" from the 2nd trigger events, and do it with trigger.

on map Init: For each integer A from 1 to Number of Players -> User and -> Playing do "Add (Player(IntegerA) leaves the game) event to X trigger"
 
Status
Not open for further replies.
Top