• 🏆 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!
  • It's time for the first HD Modeling Contest of 2024. Join the theme discussion for Hive's HD Modeling Contest #6! Click here to post your idea!

Next Player in <PlayerGroup> ?!

Status
Not open for further replies.
Level 9
Joined
Apr 28, 2009
Messages
538
Let's say I have a player group called....Racers In this player group are all the players controlled by a human player that is still playing; once a guy leaves the game, he's removed from Racers.

Is there any function to get the next player form Racers?
I want to make a map in wich each player has to do a move, but he must only able to do it when is he's turn.
 
Level 37
Joined
Mar 6, 2006
Messages
9,240
Loop through the group, and check whether the controller == user and user is playing or not.

Or maybe, you mean something like this:

  • Untitled Trigger 001
    • Events
    • Conditions
    • Actions
      • For each (Integer loopA) from 1 to 12, do (Actions)
        • Loop - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • Player is in PlayerGroup
              • Player_Index Equal to loopA
              • ((Player(loopA)) controller) Equal to User
              • ((Player(loopA)) slot status) Equal to Is playing
            • Then - Actions
              • Custom script: DO YOUR THINGIES HERE
            • Else - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • Player_Index Equal to 12
            • Then - Actions
              • Set Player_Index = 1
            • Else - Actions
              • Set Player_Index = (Player_Index + 1)
          • Skip remaining actions
Just something I triggered quickly. Set the index to 1 at initilization.

It loops through players. Player_Index keeps track whose turn it is.

But tough to say more without knowing more.
 
Level 9
Joined
Apr 28, 2009
Messages
538
this is no good. Think about it.

Let's say that the following players are still in game: 1,4,5 and 7, while 2,3 and 6 quited the game or are unused slots.
Now let's say player 1 just completed his move. The variable "Player_Index" will be set to 2, and because player 2 is not in game....guess what...the game will block.
 
Then try using some integer with array. Each variable will represent one player:
  • Trigger
  • Events
    • Map Initialization
  • Conditions
  • Actions
    • For each (Integer A) from 1 to 12, do (Actions)
      • Loop - Actions
        • Set PlayersInteger[(IntegerA)] = (PlayersInteger[(IntegerA)] + 1)
Then, you can use a periodic event, which will run through PlayersInteger and, if PlayersInteger slot Equal to Unused or Computer or Not playing, then set PlayersInteger = PlayersInteger + 1.

  • Trigger
  • Events
    • Time - Every 1.00 seconds of game-time
  • Conditions
  • Actions
    • For each (Integer B) from 1 to 12, do (Actions)
      • Loop - Actions
        • If - Conditions
          • ((Player(PlayersInteger[(IntegerB)])) controller) Not Equal to User
          • ((Player(PlayersInteger[(IntegerB)])) slot status) Not Equal to Is playing
        • Then - Actions
          • If (All conditions are true) then do (Actions) else do (Actions)
            • If - Conditions
              • (IntegerB) Less than 12
            • Then - Actions
              • Set NewPlayer = (Player(IntegerB + 1)) <---- This will be your "next player".
            • Else - Actions
Try something like this. PlayersInteger[] is an Integer variable, NewPlayer is a player variable. Those "Player()" things come from Player Conversion (when it asks your for a player, scroll to Convert Player index to Player.
 
Level 9
Joined
Apr 28, 2009
Messages
538
  • Set PlayersInteger[(IntegerA)] = (PlayersInteger[(IntegerA)] + 1)
First of all, I don't understand why " +1 ".
I first thought it's some sort of mistake since in GUI Player(1) = Player 1 (Red)
Only in JASS Player(0) is Player 1 (Red).

There are some other thing I don't understand, like, for example, why the heck you all seem to consider me some kind of a noob, but anyway...

The trigger you posted isn't in any way batter the the one posted by Maker

Guess why.
 
Level 37
Joined
Mar 6, 2006
Messages
9,240
Test this:

  • Melee Initialization
    • Events
      • Map initialization
    • Conditions
    • Actions
      • Player Group - Add Player 9 (Gray) to PlayerGroup
      • Player Group - Add Player 1 (Red) to PlayerGroup
      • Player Group - Add Player 6 (Orange) to PlayerGroup
      • Player Group - Add Player 3 (Teal) to PlayerGroup
      • Set Player_Index = 1
  • Untitled Trigger 001
    • Events
      • Player - Player 1 (Red) skips a cinematic sequence
    • Conditions
    • Actions
      • For each (Integer loopA) from Player_Index to 13, do (Actions)
        • Loop - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • Player_Index Equal to 13
            • Then - Actions
              • Set Player_Index = 1
              • Trigger - Run (This trigger) (ignoring conditions)
              • Skip remaining actions
            • Else - Actions
              • Set Player_Index = (Player_Index + 1)
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • ((Player(loopA)) is in PlayerGroup) Equal to True
            • Then - Actions
              • Game - Display to (All players) the text: (String((Player number of (Player(loopA)))))
              • Skip remaining actions
            • Else - Actions
It will display 1,3,6,9,1,3,6,9,1,3,6,9...
 
Level 13
Joined
Feb 18, 2009
Messages
1,381
You are rly, friendly huh? Go make it yourself if you think you are better then other.
 
Level 9
Joined
Apr 28, 2009
Messages
538
Etzer, I don't care for you, so just go do something else. I don't need this kind of useless s*** in my thread.

@Pharaoh_, @Maker: No. None of this thing work. Thanks for trying, anyway.
If somebody manages to do it, please attach the map.
Rep to both for wasting some time on this, have a nice day.
 
Level 13
Joined
Feb 18, 2009
Messages
1,381
You GO FUCKING RELAX!
I don't want to hear that shit goddammit. They are trying to help you but you SH** on their help sitting on your high chair thinking : "I am better then anybody else"
 
Level 9
Joined
Apr 28, 2009
Messages
538
this is no good. Think about it.

Let's say that the following players are still in game: 1,4,5 and 7, while 2,3 and 6 quited the game or are unused slots.
Now let's say player 1 just completed his move. The variable "Player_Index" will be set to 2, and because player 2 is not in game....guess what...the game will block.

Pharaoh_, how about reading the posts before posting a trigger?
 
Level 37
Joined
Mar 6, 2006
Messages
9,240
How does my newer solution not work? It displays the player number of the "next player" that is in the player group. If there's no next player, it will start from the beginning of the group. Therefore, you can determine who's turn it is.

Just a matter of integrating it to your system.
 
I did, apparently, that is why I posted an alternative solution. If you have appetite for flaming, go in other forums that will accept your behaviour. Just don't be so annoying. I did post some other way that would maybe help you out; the trigger I posted uses periodic event, I didn't imply in any way that my trigger was better than Maker's. What's the matter with you?
 
Status
Not open for further replies.
Top