prismpirate
New Member
- Reaction score
- 2
Is there a way to make a destructable have a timed life, similar to units?
func doyourremove takes some destructible and a real returns nothing
call TriggerSleepAction(yourreal)
call RemoveThingie(dest)
endfunction
//Use:
call doyourremove.execute(dest,real)
scope sprout initializer Init
globals
private constant integer spellid = 039;A01U039;
endglobals
private function sproutaction takes nothing returns nothing
local real x
local real y
local real theta = 0
local destructable lastcreateddestructable
loop
exitwhen theta > 315
set x = (Cos(Deg2Rad(theta))*200)+GetUnitX(GetSpellTargetUnit())
set y = (Sin(Deg2Rad(theta))*200) +GetUnitY(GetSpellTargetUnit())
set lastcreateddestructable = CreateDestructable(treetype,x,y,0,1,1)
set theta = theta + 45
endloop
endfunction
private function sproutcondition takes nothing returns boolean
return GetSpellAbilityId() == spellid
endfunction
private function Init takes nothing returns nothing
local trigger t = CreateTrigger()
local integer index = 0
loop
call TriggerRegisterPlayerUnitEvent(t, Player(index), EVENT_PLAYER_UNIT_SPELL_EFFECT, null)
set index = index + 1
exitwhen index == 11
endloop
call TriggerAddCondition(t, Condition(function sproutcondition))
call TriggerAddAction(t, function sproutaction)
endfunction
endscope
Read my code more carefully. Calling with .execute(... starts a new thread. Meaning your code will execute immediately and stuff. (But the stuff after the wait will wait in its own thread to fire.)If I created multiple destructables using a loop, then TriggerSleepAction(sometime) will cause the loop to take a long time to run.
No need for his map to break on patch 1.24 just to remove a tree.
The solution he has now is suitable.
The return bug is being 'fixed', isn't it?How will it break on patch 1.24?