| 01-04-2007, 05:35 PM | #1 |
I tried put all my spawn triggers in 1 (from 12), which had staggered timing to avoid lag, but since you cant have staggered timing in one trigger, it lags everytime :( any other way to optimize this? JASS:function Trig_All_Spawns_Actions takes nothing returns nothing local integer e = 0 local unit a = gg_unit_nzlc_0012 //Undead local unit b = gg_unit_nbfl_0015 //Orc local unit c = gg_unit_ncte_0018 //Night Elf local unit d = gg_unit_haro_0021 //Human /////////////////// //Human Variables// /////////////////// local real hx = GetRectCenterX( gg_rct_Human_Unit_Spawn_Top ) local real hy = GetRectCenterY( gg_rct_Human_Unit_Spawn_Top ) local real hhx = GetRectCenterX( gg_rct_Human_Unit_Spawn_Mid ) local real hhy = GetRectCenterY( gg_rct_Human_Unit_Spawn_Mid ) local real hhhx = GetRectCenterX( gg_rct_Human_Unit_Spawn_Bot ) local real hhhy = GetRectCenterY( gg_rct_Human_Unit_Spawn_Bot ) ///////////////// //Orc Variables// ///////////////// local real ox = GetRectCenterX( gg_rct_Orc_Unit_Spawn_Top ) local real oy = GetRectCenterY( gg_rct_Orc_Unit_Spawn_Top ) local real oox = GetRectCenterX( gg_rct_Orc_Unit_Spawn_Mid ) local real ooy = GetRectCenterY( gg_rct_Orc_Unit_Spawn_Mid ) local real ooox = GetRectCenterX( gg_rct_Orc_Unit_Spawn_Bot ) local real oooy = GetRectCenterY( gg_rct_Orc_Unit_Spawn_Bot ) //////////////////// //Undead Variables// //////////////////// local real ux = GetRectCenterX( gg_rct_Undead_Unit_Spawn_Top ) local real uy = GetRectCenterY( gg_rct_Undead_Unit_Spawn_Top ) local real uux = GetRectCenterX( gg_rct_Undead_Unit_Spawn_Mid ) local real uuy = GetRectCenterY( gg_rct_Undead_Unit_Spawn_Mid ) local real uuux = GetRectCenterX( gg_rct_Undead_Unit_Spawn_Bot ) local real uuuy = GetRectCenterY( gg_rct_Undead_Unit_Spawn_Bot ) /////////////////////// //Night Elf Variables// /////////////////////// local real nx = GetRectCenterX( gg_rct_Night_Elf_Unit_Spawn_Top ) local real ny = GetRectCenterY( gg_rct_Night_Elf_Unit_Spawn_Top ) local real nnx = GetRectCenterX( gg_rct_Night_Elf_Unit_Spawn_Mid ) local real nny = GetRectCenterY( gg_rct_Night_Elf_Unit_Spawn_Mid ) local real nnnx = GetRectCenterX( gg_rct_Night_Elf_Unit_Spawn_Bot ) local real nnny = GetRectCenterY( gg_rct_Night_Elf_Unit_Spawn_Bot ) /////// //End// /////// loop exitwhen e == 2 set e = e + 1 if GetUnitState(a, UNIT_STATE_LIFE) > 0 then call CreateUnit( Player(0),'hfoo', hx, hy, 0 ) call CreateUnit( Player(0),'hsor', hx, hy, 0 ) call CreateUnit( Player(3),'ogru', ox, oy, 180 ) call CreateUnit( Player(3),'ohun', ox, oy, 180 ) call CreateUnit( Player(9),'edoc', nnx, nny, 315 ) call CreateUnit( Player(9),'even', nnx, nny, 315 ) endif if GetUnitState(b, UNIT_STATE_LIFE) > 0 then call CreateUnit( Player(0),'hfoo', hhx, hhy, 45 ) call CreateUnit( Player(0),'hsor', hhx, hhy, 45 ) call CreateUnit( Player(6),'ugho', ux, uy, 90 ) call CreateUnit( Player(6),'uban', ux, uy, 90 ) call CreateUnit( Player(9),'edoc', nx, ny, 0 ) call CreateUnit( Player(9),'even', nx, ny, 0 ) endif if GetUnitState(c, UNIT_STATE_LIFE) > 0 then call CreateUnit( Player(0),'hfoo', hhhx, hhhy, 90 ) call CreateUnit( Player(0),'hsor', hhhx, hhhy, 90 ) call CreateUnit( Player(3),'ogru', ooox, oooy, 180 ) call CreateUnit( Player(3),'ohun', ooox, oooy, 180 ) call CreateUnit( Player(6),'ugho', uux, uuy, 135 ) call CreateUnit( Player(6),'uban', uux, uuy, 135 ) endif if GetUnitState(d, UNIT_STATE_LIFE) > 0 then call CreateUnit( Player(3),'ogru', oox, ooy, 315 ) call CreateUnit( Player(3),'ohun', oox, ooy, 315 ) call CreateUnit( Player(6),'ugho', uuux, uuuy, 135 ) call CreateUnit( Player(6),'uban', uuux, uuuy, 135 ) call CreateUnit( Player(9),'edoc', nnnx, nnny, 180 ) call CreateUnit( Player(9),'even', nnnx, nnny, 180 ) endif endloop set a = null set b = null set c = null set d = null endfunction //=========================================================================== function InitTrig_All_Spawns takes nothing returns nothing set gg_trg_All_Spawns = CreateTrigger( ) call DisableTrigger( gg_trg_All_Spawns ) call TriggerRegisterTimerEventPeriodic( gg_trg_All_Spawns, 35 ) call TriggerAddAction( gg_trg_All_Spawns, function Trig_All_Spawns_Actions ) endfunction |
| 01-04-2007, 07:31 PM | #2 |
Its stop execution of it self all your vars looks like global constants make functions like this function x takes nothing returns nothing call CreateUnit( Player(3),'ogru', udg_oox, udg_ooy, 315 ) call CreateUnit( Player(3),'ohun', udg_oox, udg_ooy, 315 ) call CreateUnit( Player(6),'ugho', udg_uuux, udg_uuuy, 135 ) call CreateUnit( Player(6),'uban', udg_uuux, udg_uuuy, 135 ) call CreateUnit( Player(9),'edoc', udg_nnnx, udg_nnny, 180 ) call CreateUnit( Player(9),'even', udg_nnnx, udg_nnny, 180 ) endfunction and call it by call ExecuteFunc("x") exec dont need functions to be before and uses its name and mainly do not hold thread |
| 01-04-2007, 08:04 PM | #3 |
why would i have to use globals? also, im getting a syntax error on the call ExecuteFunc("x") |
| 01-04-2007, 09:05 PM | #4 |
do you have a function which takes nothing returns nothing and is named x? thats the reason to your syntax error |
| 01-05-2007, 12:09 AM | #5 |
yeah i do, i renamed the function |
| 01-05-2007, 11:13 AM | #6 |
and did you edit the line where it says: call ExecuteFunc("x") and change the string to your new funcname? |
| 01-05-2007, 06:34 PM | #7 |
ok now theres no error...I didnt change anything, but now it works thx guys |
