How to make shuffle players?

Just move their units to the other side of the map, and change their alliances - so that their former friends become their foes, and the other way around.
Can't give you a trigger, since I don't know what your map looks like.
 
Wait do you mean in the lobby or
when ingame (either at map init or some other time straight after map loaded)?
 
I want my map to have a shuffle players feature. Any ideas?

Well it depends on what a "shuffle players feature" is.

It could be that you add random players to two player groups, until there are none left to be shuffled, or it could be that your players all start off in random locations. You may want to explain a bit more here..
 
Just like in DotA...

If Player 1 types (string), players of both teams will be shuffled...

My map has no big difference with dota... Taverns sell heroes... Circle of Power buys heroes... Both teams are the same... When you buy a hero, it will move instantly to the shops. If I used the shuffle players, will the triggers that moves heroes instantly from one region to another be randomed too? Because my triggers are..
-Hero owned by player 1, 2, 3, 4, 5 move instantly to <region>
 
Best way to do this would be to create to forces, force 1 and 2 then make a loop that based on a random number between 1 and 2 moves them to force 1 or 2. Then take all the members of force move them to base 1 and change them to treat each other as allies and force 2 as enemies. Do the same with force 2.
 
This trigger shuffles players in 2 equal teams (or as equal as possible, in case of uneven teams)

Trigger:
  • ShufflePlayers
    • Events
      • Player - Player 1 (Red) types a chat message containing -sp as An exact match
    • Conditions
    • Actions
      • Set ToShuffle = (All players matching ((((Matching player) controller) Equal to User) and (((Matching player) slot status) Equal to Is playing)))
      • Set NumberOfPlayersPerTeam = ((Number of players in ToShuffle) / 2)
      • Player Group - Pick every player in ToShuffle and do (Actions)
        • Loop - Actions
          • Set ShuffleTeam = (Random integer number between 1 and 2)
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • Or - Any (Conditions) are true
                • Conditions
                  • ShuffleTeam Equal to 1
                  • (Number of players in ShuffleTeam2) Equal to NumberOfPlayersPerTeam
            • Then - Actions
              • Player Group - Add (Picked player) to ShuffleTeam1
              • Player Group - Remove (Picked player) from ToShuffle
            • Else - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • Or - Any (Conditions) are true
                • Conditions
                  • ShuffleTeam Equal to 2
                  • (Number of players in ShuffleTeam1) Equal to NumberOfPlayersPerTeam
            • Then - Actions
              • Player Group - Add (Picked player) to ShuffleTeam2
              • Player Group - Remove (Picked player) from ToShuffle
            • Else - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • Or - Any (Conditions) are true
                • Conditions
                  • (Number of players in ToShuffle) Greater than or equal to 1
            • Then - Actions
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • Or - Any (Conditions) are true
                    • Conditions
                      • ShuffleTeam Equal to 1
                • Then - Actions
                  • Player Group - Add (Picked player) to ShuffleTeam1
                  • Player Group - Remove (Picked player) from ToShuffle
                • Else - Actions
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • Or - Any (Conditions) are true
                    • Conditions
                      • ShuffleTeam Equal to 2
                • Then - Actions
                  • Player Group - Add (Picked player) to ShuffleTeam2
                  • Player Group - Remove (Picked player) from ToShuffle
                • Else - Actions
              • Player Group - Add (Picked player) to ShuffleTeam2
            • Else - Actions

Alternatively, if you don't feel like/don't know how to do this trigger, you can just copy this into your map:
(I know its converted GUI, didn't feel like making it complicated.....)

JASS:
function Trig_ShufflePlayers_Func002002001001 takes nothing returns boolean
    return ( GetPlayerController(GetFilterPlayer()) == MAP_CONTROL_USER )
endfunction

function Trig_ShufflePlayers_Func002002001002 takes nothing returns boolean
    return ( GetPlayerSlotState(GetFilterPlayer()) == PLAYER_SLOT_STATE_PLAYING )
endfunction

function Trig_ShufflePlayers_Func002002001 takes nothing returns boolean
    return GetBooleanAnd( Trig_ShufflePlayers_Func002002001001(), Trig_ShufflePlayers_Func002002001002() )
endfunction

function Trig_ShufflePlayers_Func004Func002Func003C takes nothing returns boolean
    if ( ( udg_ShuffleTeam == 1 ) ) then
        return true
    endif
    if ( ( CountPlayersInForceBJ(udg_ShuffleTeam2) == udg_NumberOfPlayersPerTeam ) ) then
        return true
    endif
    return false
endfunction

function Trig_ShufflePlayers_Func004Func002C takes nothing returns boolean
    if ( not Trig_ShufflePlayers_Func004Func002Func003C() ) then
        return false
    endif
    return true
endfunction

function Trig_ShufflePlayers_Func004Func003Func003C takes nothing returns boolean
    if ( ( udg_ShuffleTeam == 2 ) ) then
        return true
    endif
    if ( ( CountPlayersInForceBJ(udg_ShuffleTeam1) == udg_NumberOfPlayersPerTeam ) ) then
        return true
    endif
    return false
endfunction

function Trig_ShufflePlayers_Func004Func003C takes nothing returns boolean
    if ( not Trig_ShufflePlayers_Func004Func003Func003C() ) then
        return false
    endif
    return true
endfunction

function Trig_ShufflePlayers_Func004Func004Func001Func003C takes nothing returns boolean
    if ( ( udg_ShuffleTeam == 1 ) ) then
        return true
    endif
    return false
endfunction

function Trig_ShufflePlayers_Func004Func004Func001C takes nothing returns boolean
    if ( not Trig_ShufflePlayers_Func004Func004Func001Func003C() ) then
        return false
    endif
    return true
endfunction

function Trig_ShufflePlayers_Func004Func004Func002Func003C takes nothing returns boolean
    if ( ( udg_ShuffleTeam == 2 ) ) then
        return true
    endif
    return false
endfunction

function Trig_ShufflePlayers_Func004Func004Func002C takes nothing returns boolean
    if ( not Trig_ShufflePlayers_Func004Func004Func002Func003C() ) then
        return false
    endif
    return true
endfunction

function Trig_ShufflePlayers_Func004Func004Func004C takes nothing returns boolean
    if ( ( CountPlayersInForceBJ(udg_ToShuffle) &gt;= 1 ) ) then
        return true
    endif
    return false
endfunction

function Trig_ShufflePlayers_Func004Func004C takes nothing returns boolean
    if ( not Trig_ShufflePlayers_Func004Func004Func004C() ) then
        return false
    endif
    return true
endfunction

function Trig_ShufflePlayers_Func004A takes nothing returns nothing
    set udg_ShuffleTeam = GetRandomInt(1, 2)
    if ( Trig_ShufflePlayers_Func004Func002C() ) then
        call ForceAddPlayerSimple( GetEnumPlayer(), udg_ShuffleTeam1 )
        call ForceRemovePlayerSimple( GetEnumPlayer(), udg_ToShuffle )
    else
    endif
    if ( Trig_ShufflePlayers_Func004Func003C() ) then
        call ForceAddPlayerSimple( GetEnumPlayer(), udg_ShuffleTeam2 )
        call ForceRemovePlayerSimple( GetEnumPlayer(), udg_ToShuffle )
    else
    endif
    if ( Trig_ShufflePlayers_Func004Func004C() ) then
        if ( Trig_ShufflePlayers_Func004Func004Func001C() ) then
            call ForceAddPlayerSimple( GetEnumPlayer(), udg_ShuffleTeam1 )
            call ForceRemovePlayerSimple( GetEnumPlayer(), udg_ToShuffle )
        else
        endif
        if ( Trig_ShufflePlayers_Func004Func004Func002C() ) then
            call ForceAddPlayerSimple( GetEnumPlayer(), udg_ShuffleTeam2 )
            call ForceRemovePlayerSimple( GetEnumPlayer(), udg_ToShuffle )
        else
        endif
        call ForceAddPlayerSimple( GetEnumPlayer(), udg_ShuffleTeam2 )
    else
    endif
endfunction

function Trig_ShufflePlayers_Actions takes nothing returns nothing
    set udg_ToShuffle = GetPlayersMatching(Condition(function Trig_ShufflePlayers_Func002002001))
    set udg_NumberOfPlayersPerTeam = ( CountPlayersInForceBJ(udg_ToShuffle) / 2 )
    call ForForce( udg_ToShuffle, function Trig_ShufflePlayers_Func004A )
endfunction

//===========================================================================
function InitTrig_ShufflePlayers takes nothing returns nothing
    set gg_trg_ShufflePlayers = CreateTrigger(  )
    call TriggerRegisterPlayerChatEvent( gg_trg_ShufflePlayers, Player(0), &quot;-sp&quot;, true )
    call TriggerAddAction( gg_trg_ShufflePlayers, function Trig_ShufflePlayers_Actions )
endfunction
 
NumberOfPlayersPerTeam - Integer
ShuffleTeam - Integer
ShuffleTeam1 - Player Group
ShuffleTeam2 - Player Group (you can use an array too :p)
ToShuffle - Player Group

---
Also I forgot, that trigger i posted only splits the players into 2 group
Add alliance actions after to make it work ^^
 
Amazingly long...

Here's a shorter version:
Code:
Set Players = All players matching (((Matching player) slot status) equal to Is playing) and (((Matching player) controller) equal to User) (or whatever players you need here)
Player group - Clear Teams[1]
Player group - Clear Teams[2]
Set CurrentTeam = 1
For each Integer A from 1 to (Number of players in Players) and do
    Set Player = Random player from Players
    Player group - Add Player to Teams[CurrentTeam]
    Player group - Remove Player from Players
    Set CurrentTeam = 3 - CurrentTeam

Players: variable of type player group
Teams: variable of type player group, with a check in array,
CurrentTeam: of type integer
Player: of type player
 
stop double posting, edit ur last post..

yes it will work.
just add event player red display -sp
 
General chit-chat
Help Users
  • No one is chatting at the moment.
  • V-SNES V-SNES:
    Happy Friday!
    +1
  • The Helper The Helper:
    News portal has been retired. Main page of site goes to Headline News forum now
  • The Helper The Helper:
    I am working on getting access to the old news portal under a different URL for those that would rather use that for news before we get a different news view.
  • Ghan Ghan:
    Easily done
    +1
  • The Helper The Helper:
    https://www.thehelper.net/pages/news/ is a link to the old news portal - i will integrate it into the interface somewhere when i figure it out
  • Ghan Ghan:
    Need to try something
  • Ghan Ghan:
    Hopefully this won't cause problems.
  • Ghan Ghan:
    Hmm
  • Ghan Ghan:
    I have converted the Headline News forum to an Article type forum. It will now show the top 20 threads with more detail of each thread.
  • Ghan Ghan:
    See how we like that.
  • The Helper The Helper:
    I do not see a way to go past the 1st page of posts on the forum though
  • The Helper The Helper:
    It is OK though for the main page to open up on the forum in the view it was before. As long as the portal has its own URL so it can be viewed that way I do want to try it as a regular forum view for a while
  • Ghan Ghan:
    Yeah I'm not sure what the deal is with the pagination.
  • Ghan Ghan:
    It SHOULD be there so I think it might just be an artifact of having an older style.
  • Ghan Ghan:
    I switched it to a "Standard" article forum. This will show the thread list like normal, but the threads themselves will have the first post set up above the rest of the "comments"
  • The Helper The Helper:
    I don't really get that article forum but I think it is because I have never really seen it used on a multi post thread
  • Ghan Ghan:
    RpNation makes more use of it right now as an example: https://www.rpnation.com/news/
  • The Helper The Helper:
  • The Helper The Helper:
    What do you think Tom?
  • tom_mai78101 tom_mai78101:
    I will have to get used to this.
  • tom_mai78101 tom_mai78101:
    The latest news feed looks good

      The Helper Discord

      Members online

      Affiliates

      Hive Workshop NUON Dome World Editor Tutorials

      Network Sponsors

      Apex Steel Pipe - Buys and sells Steel Pipe.
      Top