- Joined
- Nov 18, 2007
- Messages
- 48
Seeing that the triggers that run the most amount of times are the most important for performance I'm posting this for some advice.
so I have redone a unit spawn which is periodic.
summary:
basically udg_double is set to 0 or 1, the idea is to spawn units twice when it's 1. (local g)
there are four places that spawn units to I made a loop for that ( local b )
udg_spawn (array) is set to 1 after some time to spawn more units
udg_xreg (array) is GetLocationX() from a region
udg_yreg (array) is GetLocationY() from a region
is this ok ?
what can I improve ? (jass, no vjass)
so I have redone a unit spawn which is periodic.
summary:
basically udg_double is set to 0 or 1, the idea is to spawn units twice when it's 1. (local g)
there are four places that spawn units to I made a loop for that ( local b )
udg_spawn (array) is set to 1 after some time to spawn more units
udg_xreg (array) is GetLocationX() from a region
udg_yreg (array) is GetLocationY() from a region
is this ok ?
JASS:
set udg_xreg[0] = GetRectCenterX(gg_rct_Region_000)
set udg_yreg[0] = GetRectCenterY(gg_rct_Region_000)
JASS:
function Trig_Units_Actions takes nothing returns nothing
local integer b
local integer g
set g = 0
loop
exitwhen g > udg_double
set b = 0
loop
exitwhen b > 3
if udg_humanspawn[b]==1 then
call CreateUnit(Player(0),'hfoo',udg_xreg[b]-45,udg_yreg[b],90)
call CreateUnit(Player(0),'hfoo',udg_xreg[b],udg_yreg[b],90)
call CreateUnit(Player(0),'hfoo',udg_xreg[b]+45,udg_yreg[b],90)
call CreateUnit(Player(0),'nhea',udg_xreg[b]-55,udg_yreg[b]-150,90)
if udg_spawn[0]==1 then
call CreateUnit(Player(0),'nrif',udg_xreg[b]+5,udg_yreg[b]-100,90)
endif
if udg_spawn[1]==1 then
call CreateUnit(Player(0),'hhes',udg_xreg[b]+30,udg_yreg[b]+50,90)
endif
if udg_spawn[2]==1 then
call CreateUnit(Player(0),'eshd',udg_xreg[b]-20,udg_yreg[b]-170,90)
endif
if udg_spawn[3]==1 then
call CreateUnit(Player(0),'hmpr',udg_xreg[b]-75,udg_yreg[b]-120,90)
endif
if udg_spawn[4]==1 then
call CreateUnit(Player(0),'hkni',udg_xreg[b]-10,udg_yreg[b]+100,90)
endif
endif
set b = b + 1
endloop
set g = g + 1
endloop
endfunction
Last edited: