- Joined
- Apr 23, 2011
- Messages
- 460
I'm having a problem with this script. If a player is not in a slot (A player is in slot 1 and no one is in 2 but someone is in 3 4 5 and 6 for example) It will create player 1's hero, but no one else. Why is this? How can i fix this?
JASS:
function Trig_Random_Actions takes nothing returns nothing
local integer i
set udg_Random[1] = 'Hpal'
set udg_Random[2] = 'Hamg'
set udg_Random[3] = 'Hmkg'
set udg_Random[4] = 'Hblm'
set udg_Random[5] = 'Obla'
set udg_Random[6] = 'Ofar'
set udg_Random[7] = 'Otch'
set udg_Random[8] = 'Oshd'
set udg_Random[9] = 'Udea'
set udg_Random[10] = 'Ulic'
set udg_Random[11] = 'Udre'
set udg_Random[12] = 'Ucrl'
set udg_Random[13] = 'Ekee'
set udg_Random[14] = 'Emoo'
set udg_Random[15] = 'Edem'
set udg_Random[16] = 'Ewar'
set udg_Random[17] = 'Nalc'
set udg_Random[18] = 'Nngs'
set udg_Random[19] = 'Ntin'
set udg_Random[20] = 'Nbst'
set udg_Random[21] = 'Nbrn'
set udg_Random[22] = 'Nfir'
set udg_Random[23] = 'Npbm'
set udg_Random[24] = 'Nplh'
set i = 0
loop
exitwhen i > 11
if GetPlayerSlotState(Player(i))== PLAYER_SLOT_STATE_PLAYING then
set Hero[i] = CreateUnit(Player(i), udg_Random[GetRandomInt(1, 24)],GetRectCenterX(gg_rct_Hero_Spawn),GetRectCenterY(gg_rct_Hero_Spawn), 260.0)
endif
set i = (i + 1)
endloop
endfunction
//===========================================================================
function InitTrig_Random takes nothing returns nothing
local trigger t = CreateTrigger()
call TriggerRegisterTimerEventSingle(t, 0.00)
call TriggerAddAction( t, function Trig_Random_Actions )
set t = null
endfunction
Last edited: