Removing Destructables

Rainther

I guess I should write something of value here...
Reaction score
61
By adding timer that will eventually remove it, yes.
 

prismpirate

New Member
Reaction score
2
If I created multiple destructables using a loop, then TriggerSleepAction(sometime) will cause the loop to take a long time to run. Is there such thing as a destructable group?
 

Rainther

I guess I should write something of value here...
Reaction score
61
I believe their are systems out there for it. I assume you wish to destroy all at the same time?
 

prismpirate

New Member
Reaction score
2
I'll post my trigger here:

JASS:
scope sprout initializer Init
    globals
    private constant integer spellid = 'A01U'
    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


Basically its Dota's Furion's Sprout. I've managed to create the trees, now I need to remove them x seconds after they are created
 

Jesus4Lyf

Good Idea™
Reaction score
397
If I created multiple destructables using a loop, then TriggerSleepAction(sometime) will cause the loop to take a long time to run.
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.)
 

prismpirate

New Member
Reaction score
2
Thanks a lot. I didn't know about .execute. vJass tutorials never talked about them. Will try to +rep you sometime later, I've maxed mine out at the moment.
 
Reaction score
341
Just to make things clear, im pretty sure vex made a hashtable version for TimerUtils which will work for the new patches.
 
General chit-chat
Help Users
  • No one is chatting at the moment.

      The Helper Discord

      Members online

      No members online now.

      Affiliates

      Hive Workshop NUON Dome World Editor Tutorials

      Network Sponsors

      Apex Steel Pipe - Buys and sells Steel Pipe.
      Top