WarLuvr3393
Hmmm...too many things to play (WoW, COD4, WC3)
- Reaction score
- 54
Hey guys. I was just working on a map and I wanted to do some cleaning up so I converted my initialization trigger into JASS and attempted to clean up leaks and ugly coding. Here's my current script:
Now it's suppose to set the time of day, play music, give gold to players, and remove the units of the players that aren't playing at the moment. Now, for some reason, it's not removing the units of the players not present in the game.
What's the problem here?
JASS:
function Set_Starting_Gold takes nothing returns nothing
call AdjustPlayerStateBJ(150,GetEnumPlayer(),PLAYER_STATE_RESOURCE_GOLD)
endfunction
function Remove_Units takes nothing returns nothing
call RemoveUnit(GetEnumUnit())
endfunction
function Trig_Intialization_Actions takes nothing returns nothing
local integer i
local group g
call DisplayTextToForce(GetPlayersAll(),"TRIGSTR_102")
call SetTimeOfDay(6.0)
call EnableDawnDusk(false)
call StopMusic(false)
call ClearMapMusic()
call PlayMusic(gg_snd_MainMusic)
call ForForce(GetPlayersAll(),function Set_Starting_Gold)
set i = 2
loop
exitwhen i > 11
if GetPlayerSlotState(Player(i)) == PLAYER_SLOT_STATE_PLAYING then
call BJDebugMsg("Player " + I2S(i+1) + " is in the game.")
else
set g = CreateGroup()
call GroupEnumUnitsOfPlayer(g, Player(i), null)
call ForGroup(g, function Remove_Units)
call DestroyGroup(g)
call BJDebugMsg("Player " + I2S(i+1) + "039;s units have been successfully removed")
endif
set g = null
endloop
endfunction
function InitTrig_Intialization takes nothing returns nothing
local trigger t = CreateTrigger()
call TriggerAddAction(t,function Trig_Intialization_Actions)
endfunction
Now it's suppose to set the time of day, play music, give gold to players, and remove the units of the players that aren't playing at the moment. Now, for some reason, it's not removing the units of the players not present in the game.
What's the problem here?