- Joined
- May 11, 2008
- Messages
- 1,198
edit: ok so far it has been determined that a global point is not necessary...
so, all believe it's better to either use local location/point and then null or else use real y and x to get the point eh?
what would you recommend for optimizing this trigger?
i'm such a newb at jass and i forget a lot of the stuff i learn.
so, i had to convert a gui trigger into custom text because my map making partner can't use new map editor for whatever reason.
anyway, i just want to know like i already asked above.
i figured i could go ahead and start optimizing it myself, but i rather wanted to make sure i don't make any mistakes...plus you could give me some tips on whether it matters if i use globals and locals and stuff like that. for example that variable i'm using in the condition i think i want to keep global right? and the other stuff could probably be local right? and if i make them local i'll have to null them right? and all that good stuff.
So yeah, experts, please take care of me in this little trigger. i should learn a lot hopefully.
edit: well i just realized that the variable names alone don't say what the variables are maybe i should clarify that?
isg is a unit group (item spawn group)
isr is a region/rect (item spawn rect) actually there are two regions and the item spawn is random...which brings us to itemnmbr and if you need me to tell you that it's an integer then i probably don't need your advice lol but whatever.
sanvar just is a suffix don't pay attention to that sort of thing.
p is point
and in case you're wondering what the heck i'm up to it's a treasure chest that when you attack it then it will drop an item. that part is taken care of no problem in another trigger and some editing in objects as well.
so, all believe it's better to either use local location/point and then null or else use real y and x to get the point eh?
what would you recommend for optimizing this trigger?
i'm such a newb at jass and i forget a lot of the stuff i learn.
so, i had to convert a gui trigger into custom text because my map making partner can't use new map editor for whatever reason.
anyway, i just want to know like i already asked above.
JASS:
function Trig_itemspawns_Func005C takes nothing returns boolean
if ( not ( IsUnitGroupDeadBJ(udg_isg_SanVar) == true ) ) then
return false
endif
return true
endfunction
function Trig_itemspawns_Actions takes nothing returns nothing
// change the events to what you need for random spawns in one of the 8 locations
// change the other trigger to edit what items are selected for item spawn.
set udg_itemnmbr_SanVar = GetRandomInt(1, 2)
set udg_isg_SanVar = GetUnitsOfTypeIdAll('n00L')
if ( Trig_itemspawns_Func005C() ) then
set udg_p_SanVar = GetRectCenter(udg_isr_SanVar[udg_itemnmbr_SanVar])
call CreateNUnitsAtLoc( 1, 'n00L', Player(bj_PLAYER_NEUTRAL_EXTRA), udg_p_SanVar, bj_UNIT_FACING )
call RemoveLocation( udg_p_SanVar )
else
endif
call GroupClear( udg_isg_SanVar )
endfunction
//===========================================================================
function InitTrig_itemspawns takes nothing returns nothing
set gg_trg_itemspawns = CreateTrigger( )
call TriggerRegisterTimerEventSingle( gg_trg_itemspawns, 5.00 ) //first item spawns
call TriggerRegisterTimerEventPeriodic( gg_trg_itemspawns, 15.00 ) //item spawning again
call TriggerAddAction( gg_trg_itemspawns, function Trig_itemspawns_Actions )
endfunction
i figured i could go ahead and start optimizing it myself, but i rather wanted to make sure i don't make any mistakes...plus you could give me some tips on whether it matters if i use globals and locals and stuff like that. for example that variable i'm using in the condition i think i want to keep global right? and the other stuff could probably be local right? and if i make them local i'll have to null them right? and all that good stuff.
So yeah, experts, please take care of me in this little trigger. i should learn a lot hopefully.
edit: well i just realized that the variable names alone don't say what the variables are maybe i should clarify that?
isg is a unit group (item spawn group)
isr is a region/rect (item spawn rect) actually there are two regions and the item spawn is random...which brings us to itemnmbr and if you need me to tell you that it's an integer then i probably don't need your advice lol but whatever.
sanvar just is a suffix don't pay attention to that sort of thing.
p is point
and in case you're wondering what the heck i'm up to it's a treasure chest that when you attack it then it will drop an item. that part is taken care of no problem in another trigger and some editing in objects as well.
Last edited: