I want my map to have a shuffle players feature. Any ideas?
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) >= 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), "-sp", true )
call TriggerAddAction( gg_trg_ShufflePlayers, function Trig_ShufflePlayers_Actions )
endfunction
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
Wait! Bob's trigger doesn't work...
Help!
But i still not trying the jass yet...