Imagine a spell, where there are six dummies with effects attached to them. Should they be dynamic, or static? If they can be static, how?
scope Bla
globals
private constant integer DUMMY_ID = 039;u000039;
private unit array DUMMIES
private integer INDEX = 0
endglobals
function NewDummy takes player p, real x, real y returns unit
if INDEX == 0 then
return CreateUnit(p,DUMMY_ID,x,y,0)
else
set INDEX = INDEX-1
call ShowUnit(DUMMIES[INDEX],true)
call SetUnitOwner(DUMMIES[INDEX],p,true)
call SetUnitPosition(DUMMIES[INDEX],x,y)
return DUMMIES[INDEX]
endif
endfunction
function ReleaseDummy takes unit u returns nothing
call ShowUnit(u,false)
set DUMMIES[INDEX] = u
set INDEX = INDEX+1
endfunction
endscope