black.sheep
Active Member
- Reaction score
- 24
Simple snippet for getting a random player (seeing as the blizz one is utter fail) that is filled by a human player.
Don't bother crediting, change at your own free will.
Don't bother crediting, change at your own free will.
JASS:
function GetTrueRandomPlayerCheck takes nothing returns boolean
return ( GetPlayerController(GetFilterPlayer()) != MAP_CONTROL_COMPUTER and GetPlayerController(GetFilterPlayer()) != MAP_CONTROL_NONE )
endfunction
function GetTrueRandomPlayer takes nothing returns player
local force players
local player p
local integer i
set players = GetPlayersMatching(Condition(function GetTrueRandomPlayerCheck))
loop
set i =GetRandomInt(0,11)
set p =ConvertedPlayer(i)
exitwhen IsPlayerInForce(p,players) == true
endloop
call DestroyForce(players)
set players = null
return p
endfunction