1. Head to the 33rd Modeling Contest Poll and drink to your heart's desire.
    Dismiss Notice
  2. Choose your means of doom in the 17th Mini Mapping Contest Poll.
    Dismiss Notice
  3. A slave to two rhythms, the 22nd Terraining Contest is here.
    Dismiss Notice
  4. The heavens smile on the old faithful. The 16th Techtree Contest has begun.
    Dismiss Notice
  5. The die is cast - the 6th Melee Mapping Contest results have been announced. Onward to the Hive Cup!
    Dismiss Notice
  6. The glory of the 20th Icon Contest is yours for the taking!
    Dismiss Notice
  7. Check out the Staff job openings thread.
    Dismiss Notice
Dismiss Notice
60,000 passwords have been reset on July 8, 2019. If you cannot login, read this.

How to repsawn trees

Discussion in 'World Editor Help Zone' started by Kunfury, Dec 28, 2010.

  1. Kunfury

    Kunfury

    Joined:
    May 26, 2010
    Messages:
    211
    Resources:
    0
    Resources:
    0
    On my map i have spells that destroy trees and other stuff that destroys them. How do i make it that after about 10 seconds the trees will respawn
     
  2. PurgeandFire

    PurgeandFire

    Code Moderator

    Joined:
    Nov 11, 2006
    Messages:
    7,429
    Resources:
    18
    Icons:
    1
    Spells:
    4
    Tutorials:
    9
    JASS:
    4
    Resources:
    18
    This library works well:
    http://www.thehelper.net/forums/showthread.php?t=104390

    Just make sure you have JassNewGenPack. Create a new trigger, Edit -> Convert to Custom Text, and then copy and paste it in. Then change this:
    Code (vJASS):
    private constant real RegrowAfter = 23.0

    To this:
    Code (vJASS):
    private constant real RegrowAfter = 10.0


    And it should work. :)
     
  3. Kunfury

    Kunfury

    Joined:
    May 26, 2010
    Messages:
    211
    Resources:
    0
    Resources:
    0
    it wouldnt work in my map i kept getting a error do i need variables and if so which ones?
     
  4. Pandawarrior

    Pandawarrior

    Joined:
    Dec 23, 2008
    Messages:
    78
    Resources:
    0
    Resources:
    0
  5. Kunfury

    Kunfury

    Joined:
    May 26, 2010
    Messages:
    211
    Resources:
    0
    Resources:
    0
    umm my compute kinda crashes on youtube...
     
  6. TheWarchief

    TheWarchief

    Joined:
    Aug 19, 2009
    Messages:
    64
    Resources:
    0
    Resources:
    0
    Erhmm... aren't you guys complicating things...?
    When i tested this it worked perfectly.
    [trigger=Tree Respawn]Tree Respawn
    Events
    Destructible - A destructible within (Entire map) dies
    Conditions
    (Destructible-type of (Dying destructible)) Equal to Summer Tree Wall
    Actions
    Wait 10.00 seconds
    Destructible - Resurrect (Dying destructible) with (Max life of (Dying destructible)) life and Show birth animation[/trigger]

    When i tested this it worked perfectly even though multiple trees died within the 10 sec.
     
  7. priest170234

    priest170234

    Joined:
    Oct 31, 2010
    Messages:
    226
    Resources:
    2
    Maps:
    1
    Spells:
    1
    Resources:
    2
    That's true... Maybe this is equal to how the Regrow Trees library work?

    EDIT:
    Yes.. It's more or less similar. The library uses a TriggerSleepAction.. Which is Wait.
    In fact it's just a vJass version of GUI..?
     
  8. PurgeandFire

    PurgeandFire

    Code Moderator

    Joined:
    Nov 11, 2006
    Messages:
    7,429
    Resources:
    18
    Icons:
    1
    Spells:
    4
    Tutorials:
    9
    JASS:
    4
    Resources:
    18
    Destroy a gate in a map with that trigger and then watch. :p

    You can probably do it in GUI too. Idk. But the reason why the JASS is a bit longer is because it checks if the destructible is a tree or not. :D

    But it is kind of situational. If you don't really care that other destructibles will respawn, then yeah you can definitely use that trigger. Otherwise, you can compare destructible ID's or just make the naga slave and see if he can harvest it. (like the code I linked does)
     
  9. priest170234

    priest170234

    Joined:
    Oct 31, 2010
    Messages:
    226
    Resources:
    2
    Maps:
    1
    Spells:
    1
    Resources:
    2
    No wonder there's the naga slave... I was wondering what was that for.. Since I don't do much JASS/vJASS..
     
  10. D4RK_G4ND4LF

    D4RK_G4ND4LF

    Joined:
    Feb 4, 2009
    Messages:
    1,196
    Resources:
    20
    Models:
    3
    Spells:
    15
    Tutorials:
    2
    Resources:
    20
    "a destructible within entire map dies" only refers to a few destructibles (like 64) but not all
    probably blizzard thought it would be bad to create that many single events

    you can circumvent that by creating regions with a maxs of 64 trees and so on in it or by something like:
    trigger 1:
    event - map ini
    actions -
    - create a peasant or something with harvest ability
    - pick all destructibles in playable map area
    - - order last created unit to harvest picked destructible//what purge mentioned already
    - - if current order of last created unit is equal to harvest
    - - - add to trigger 2 the event picked destructible dies
    - remove peasant or hide and stop him to use him later or whatever

    trigger 2:
    events - are added by trigger 1
    actions -
    - wait some game time
    - revive tree
     
  11. Adiktuz

    Adiktuz

    Joined:
    Oct 16, 2008
    Messages:
    9,674
    Resources:
    23
    Models:
    2
    Packs:
    1
    Maps:
    1
    Spells:
    16
    Tutorials:
    1
    JASS:
    2
    Resources:
    23
    This...
     
  12. Kunfury

    Kunfury

    Joined:
    May 26, 2010
    Messages:
    211
    Resources:
    0
    Resources:
    0
    I just want to know how to revive the trees that die and i have multiple trees
     
  13. defskull

    defskull

    Joined:
    Mar 27, 2008
    Messages:
    7,978
    Resources:
    17
    Spells:
    17
    Resources:
    17
    Test map attached.
     

    Attached Files:

  14. Garfield1337

    Garfield1337

    Joined:
    Jul 6, 2009
    Messages:
    1,806
    Resources:
    4
    Maps:
    1
    Spells:
    3
    Resources:
    4
    ^ destructible groups don't leak afaik so no need to use
    Code (vJASS):
    set bj_wantDestroyGroup = true
     
  15. Adiktuz

    Adiktuz

    Joined:
    Oct 16, 2008
    Messages:
    9,674
    Resources:
    23
    Models:
    2
    Packs:
    1
    Maps:
    1
    Spells:
    16
    Tutorials:
    1
    JASS:
    2
    Resources:
    23
    they don't even use that bj right?

    Code (vJASS):

    function EnumDestructablesInCircleBJ takes real radius, location loc, code actionFunc returns nothing
        local rect r

        if (radius >= 0) then
            set bj_enumDestructableCenter = loc
            set bj_enumDestructableRadius = radius
            set r = GetRectFromCircleBJ(loc, radius)
            call EnumDestructablesInRect(r, filterEnumDestructablesInCircleBJ, actionFunc)
            call RemoveRect(r)
        endif
    endfunction


     
     
  16. Garfield1337

    Garfield1337

    Joined:
    Jul 6, 2009
    Messages:
    1,806
    Resources:
    4
    Maps:
    1
    Spells:
    3
    Resources:
    4
    According to JassCraft,no.
     
  17. Adiktuz

    Adiktuz

    Joined:
    Oct 16, 2008
    Messages:
    9,674
    Resources:
    23
    Models:
    2
    Packs:
    1
    Maps:
    1
    Spells:
    16
    Tutorials:
    1
    JASS:
    2
    Resources:
    23
    edited my previous post, added the script for the BJ which enums dests... they don't actually create a group...
     
  18. defskull

    defskull

    Joined:
    Mar 27, 2008
    Messages:
    7,978
    Resources:
    17
    Spells:
    17
    Resources:
    17
    Well, you guys probably be better than me, since I've no knowledge about JASS, even a bit lol
    So, no leaks present in that Unit Group of Destructibles ?
     
  19. Adiktuz

    Adiktuz

    Joined:
    Oct 16, 2008
    Messages:
    9,674
    Resources:
    23
    Models:
    2
    Packs:
    1
    Maps:
    1
    Spells:
    16
    Tutorials:
    1
    JASS:
    2
    Resources:
    23
    its not a UnitGroup... ^_^

    they don't create groups so there would be nothing to leak...
     
  20. Kunfury

    Kunfury

    Joined:
    May 26, 2010
    Messages:
    211
    Resources:
    0
    Resources:
    0
    alright one more thing... i know this is stupid... but how do i make a spell kill the trees it goes through. Like if i make a custom spell of breath of fire or Carrion Swarm how do i make it to where the trees the spells animation passes through die.