1. Are you planning to upload your awesome spell or system to Hive? Please review the rules here.
    Dismiss Notice
  2. Updated Resource Submission Rules: All model & skin resource submissions must now include an in-game screenshot. This is to help speed up the moderation process and to show how the model and/or texture looks like from the in-game camera.
    Dismiss Notice
  3. The 15th Mini-Mapping Contest came to an end. The Secrets of Warcraft 3 are soon to be revealed! Come and vote in the public poll for your favorite maps.
    Dismiss Notice
  4. The 12th incarnation of the Music Contest is LIVE! The theme is Synthwave. Knight Rider needs a song to listen to on his journey. You should definitely have some fun with this theme!
    Dismiss Notice
  5. Join other hivers in a friendly concept-art contest. The contestants have to create a genie coming out of its container. We wish you the best of luck!
    Dismiss Notice
  6. 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.

GUI and JASS IsDestTree V1.3

Submitted by Daffa the Mage
This bundle is marked as approved. It works and satisfies the submission rules.
IsDestTree
Originally by Almia - GUI Version by Daffa the Mage

REMAKING PURPOSE
Honestly, the main purpose I'm remaking Almia's vJass IsDestTree is that I found it unusable to normal WE users.
Noticing this, I decide to learn Jass a bit, using Almia's original script, I modify them to fit Plain Jass (it was in GUI, but using custom scripts, later turned into full Plain Jass) and also later Almia recommend me to remake them to whole GUI.

WARNING
Do not use both IsDestTree! It screws the code.

TRIGGERS AND CODES

JASS IsDestTree
Code (vJASS):
function IsDestTree takes destructable d returns boolean
    return IssueTargetOrderById(udg_DestChecker,852018,d) and IssueImmediateOrderById(udg_DestChecker,851972)
endfunction
function DestroyTree takes destructable d returns nothing
    if IsDestTree(d) and GetWidgetLife(d) > 0.405 then
        call KillDestructable(d)
    endif
endfunction

function InitTrig_IsDestTree takes nothing returns nothing
    set udg_DestChecker = CreateUnit(Player(15), 'hpea', 0, 0, 0)
    call UnitAddAbility(udg_DestChecker, 'Aloc')
    call UnitAddAbility(udg_DestChecker, 'Ahrl')
    call ShowUnit(udg_DestChecker, false)
endfunction
 


GUI IsDestTree (aka TreeKiller)
  • TreeKiller GUI Init
    • Events
      • Map initialization
    • Conditions
    • Actions
      • Set Dest = No destructible
      • Custom script: set udg_DestChecker = CreateUnit(Player(15), 'hpea', 0, 0, 0)
      • Custom script: call UnitAddAbility(udg_DestChecker, 'Aloc')
      • Custom script: call UnitAddAbility(udg_DestChecker, 'Ahrl')
      • Unit - Hide DestChecker


  • TreeKiller GUI
    • Events
    • Conditions
    • Actions
      • Set IsDestTree = False
      • Unit - Order DestChecker to Harvest Dest
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Current order of DestChecker) Equal to (Order(harvest))
        • Then - Actions
          • Set IsDestTree = True
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • TreeKill Equal to True
            • Then - Actions
              • Destructible - Kill Dest
              • Set TreeKill = False
            • Else - Actions
        • Else - Actions
      • Unit - Order DestChecker to Stop


GUIDE

JASS Version

Read the tutorial linked below before Installing the JASS Version.
This Tutorial By Almia

How to Import :
1. Create a Variable named DestChecker with type Unit
2. Import the IsDestTree JASS Folder
3. Ready to use, read the Tutorial above in case of errors

GUI Version

use the Dest variable to set the Tree you want to check.
Look at the Example carefully!

How to Import :
1. Make Sure "Create Unknown Variables When Pasting Trigger Data" is Enabled
2. Copy the IsDestTree GUI Folder
3. Use this action to run the IsDestTree :
  • Trigger - TreeKiller GUI gen (ignoring conditions)

to Destroy Trees while checking, use this before you run the function (can be in an Init or right before use) :
  • Set TreeKill = True


How to use GUI IsDestTree [aka TreeKiller] :
A little Guide for those who uses this IsDestTree [aka TreeKiller] along with it's TreeKill for Configurable Spells :
1. Use TreeKill_Init for True and False for killing trees!
2. Use the
  • Set TreeKill = TreeKill_Init
to connect the Init with the actual tree kill (remember, if you use pick destructables, put the
  • Set TreeKill = TreeKill_Init
inside the loop, also use the action before the Run IsDestTree, else it will cause bugs)
3. Done!
If you still don't know how to do it, check the Ex Init and Example GUI

Why this needs to be done? This is because the system automatically RESET TreeKill to False and make it easier for other users to configure your spell (nobody want to see a pile of trigger to find a minor thing right?)

CHANGELOGS
Changelog
V1.3 : Minor Patch by BPower
V1.2 : Just a couple of minor changes, change GUI IsDestTree name to TreeKiller to make it less vague.
V1.1 : Opt Jass Version, thanks to Magtheridon96
Fixes GUI Version Bug for TreeKill, thanks to PurgeandFire
V1.0 Minor Update : Fixes Jass Version Issue, thanks to Almia
V1.0 : First Upload


CREDITS
Special Thanks to Almia for Giving me Permission to Upload this IsDestTree, Fixing the Jass Version, and Improving the GUI Version.
Also
Magtheridon96 : Optimizing Jass Version and Giving Suggestions
PurgeandFire : Discovering GUI Bugs
BPower : Mention issues with this IsDestTree


AUTHOR NOTES
Mods
This System is marked as NO RATING like Mag's GUI AutoFly and Almia's IsDestTree

I hope this is useful, useful feedbacks are VERY APPRECIATED

~Daffa the Mage

Keywords:
Magtheridon96, Almia, IsDestTree, Daffa, Mage, Daffa the Mage, System
Contents

IsDestTree (Map)

Reviews
Moderator
19:32, 25th Sep 2013 PurgeandFire: Approved!
  1. 19:32, 25th Sep 2013
    PurgeandFire: Approved!
     
  2. Rheiko

    Rheiko

    Joined:
    Aug 27, 2013
    Messages:
    2,936
    Resources:
    7
    Icons:
    2
    Spells:
    3
    Tutorials:
    2
    Resources:
    7
    glad someone can convert Jass to GUI
    nice job there
    a little present from me

    +REP
     
  3. Daffa the Mage

    Daffa the Mage

    Map Moderator

    Joined:
    Jan 30, 2013
    Messages:
    7,571
    Resources:
    27
    Packs:
    1
    Maps:
    8
    Spells:
    16
    Tutorials:
    2
    Resources:
    27
    for anyone who is wondering abut the permission, it can be found here
     
  4. Almia

    Almia

    Joined:
    Apr 24, 2012
    Messages:
    4,861
    Resources:
    35
    Spells:
    30
    Tutorials:
    4
    JASS:
    1
    Resources:
    35
    Uhh, The InitTrig function I suggested must be the init function. Rename the trigger to IsDestTree or rename the init function to the init function you use in the code. I told you it is the most optimized script yet you added a "fail" function, a useless function XD

    Other than that, good job

    Btw, make sure to notify them that they must only implement one of the systems(GUI and JASS), because the unit's handler may be lost due to the fact that One of them replaces the older harvester :D
     
  5. Daffa the Mage

    Daffa the Mage

    Map Moderator

    Joined:
    Jan 30, 2013
    Messages:
    7,571
    Resources:
    27
    Packs:
    1
    Maps:
    8
    Spells:
    16
    Tutorials:
    2
    Resources:
    27
    it seems I misunderstood, I'll try to fix that (u know, my Jass sucks)

    good point, I'll update them at once.

    EDIT :

    I was so careless, I called the Initial Function which screw stuffs.
    Fixed.

    Updating...

    EDIT 2 :

    Updated! I'm sure both works properly now (tested the Jass Version, it works now!)
     
  6. PurgeandFire

    PurgeandFire

    Code Moderator

    Joined:
    Nov 11, 2006
    Messages:
    7,427
    Resources:
    18
    Icons:
    1
    Spells:
    4
    Tutorials:
    9
    JASS:
    4
    Resources:
    18
    You should set TreeKill back to "False" after killing the destructible. Otherwise it can cause issues if you leave it up to the user.

    E.g. Let's say you have some knockback trigger that kills trees. You set TreeKill = true in that trigger. Meanwhile, some other trigger fires that groups destructables and checks if any of them are trees. Since TreeKill is still set to True, it will kill those destructables even if the user didn't set TreeKill to true right then.
     
  7. Daffa the Mage

    Daffa the Mage

    Map Moderator

    Joined:
    Jan 30, 2013
    Messages:
    7,571
    Resources:
    27
    Packs:
    1
    Maps:
    8
    Spells:
    16
    Tutorials:
    2
    Resources:
    27
    Okay, thanks for the info PurgeandFire :)
    I'll update them after school (in 6/7 hours I hope).

    Anyway, is there any other flaws I left beside that and what Almia's stated before?
     
  8. Almia

    Almia

    Joined:
    Apr 24, 2012
    Messages:
    4,861
    Resources:
    35
    Spells:
    30
    Tutorials:
    4
    JASS:
    1
    Resources:
    35
    Add Locust Ability to the Peasant. Hiding Units are still not protected.

    • Custom script : call UnitAddAbility(udg_DestChecker, 'Aloc')
     
  9. Daffa the Mage

    Daffa the Mage

    Map Moderator

    Joined:
    Jan 30, 2013
    Messages:
    7,571
    Resources:
    27
    Packs:
    1
    Maps:
    8
    Spells:
    16
    Tutorials:
    2
    Resources:
    27
    Okay, I'll add it :)
     
  10. Rheiko

    Rheiko

    Joined:
    Aug 27, 2013
    Messages:
    2,936
    Resources:
    7
    Icons:
    2
    Spells:
    3
    Tutorials:
    2
    Resources:
    7
    fix the flaws, bro :wink:
    btw, why this?

     
  11. Daffa the Mage

    Daffa the Mage

    Map Moderator

    Joined:
    Jan 30, 2013
    Messages:
    7,571
    Resources:
    27
    Packs:
    1
    Maps:
    8
    Spells:
    16
    Tutorials:
    2
    Resources:
    27
    As it should be the same as Original IsDestTree by Almia, it's not fair if this got rated and that one isn't.
     
  12. Rheiko

    Rheiko

    Joined:
    Aug 27, 2013
    Messages:
    2,936
    Resources:
    7
    Icons:
    2
    Spells:
    3
    Tutorials:
    2
    Resources:
    7
    i see, fair and square.. keep it up, man
     
  13. Magtheridon96

    Magtheridon96

    Joined:
    Dec 12, 2008
    Messages:
    6,006
    Resources:
    26
    Maps:
    1
    Spells:
    8
    Tutorials:
    7
    JASS:
    10
    Resources:
    26
    Delete this entirely:

    Code (vJASS):
    //===========================================================================
    function InitTrig_IsDestTree_JASS takes nothing returns nothing
        local trigger t = CreateTrigger(  )
        call TriggerAddAction( t, function InitTrig_IsDestTree )
        set t = null
    endfunction


    It does absolutely nothing.
     
  14. Daffa the Mage

    Daffa the Mage

    Map Moderator

    Joined:
    Jan 30, 2013
    Messages:
    7,571
    Resources:
    27
    Packs:
    1
    Maps:
    8
    Spells:
    16
    Tutorials:
    2
    Resources:
    27
    Isn't that the structure for JASS Initialization? This is not VJASS, unless Plain JASS can have this block removed.
     
  15. Magtheridon96

    Magtheridon96

    Joined:
    Dec 12, 2008
    Messages:
    6,006
    Resources:
    26
    Maps:
    1
    Spells:
    8
    Tutorials:
    7
    JASS:
    10
    Resources:
    26
    Any function that starts with InitTrig will be called inside of one of the initialization functions that runs inside
    function main
    .

    Currently, your
    InitTrig_IsDestTree
    function is running on map initialization and initializing the library just fine, then you have this other useless function:

    Code (vJASS):
    //===========================================================================
    function InitTrig_IsDestTree_JASS takes nothing returns nothing
        local trigger t = CreateTrigger(  )
        call TriggerAddAction( t, function InitTrig_IsDestTree )
        set t = null
    endfunction


    That just creates a trigger, adds an action to it and does nothing after that. All it's doing is leaking memory :p
     
  16. Daffa the Mage

    Daffa the Mage

    Map Moderator

    Joined:
    Jan 30, 2013
    Messages:
    7,571
    Resources:
    27
    Packs:
    1
    Maps:
    8
    Spells:
    16
    Tutorials:
    2
    Resources:
    27
    I see, so it will read the InitTrig_IsDestTree and runs that function as Map Init begin, I'll fix this along with the rest of the issues today, was busy that I forgot to update it yesterday.

    EDIT :

    Forgot to post, UPDATED!
     
    Last edited: Aug 30, 2013
  17. Almia

    Almia

    Joined:
    Apr 24, 2012
    Messages:
    4,861
    Resources:
    35
    Spells:
    30
    Tutorials:
    4
    JASS:
    1
    Resources:
    35
    I was pointing that out a long time ago Daffa, but you ignored it.
     
  18. Daffa the Mage

    Daffa the Mage

    Map Moderator

    Joined:
    Jan 30, 2013
    Messages:
    7,571
    Resources:
    27
    Packs:
    1
    Maps:
    8
    Spells:
    16
    Tutorials:
    2
    Resources:
    27
    Sorry, because I skip some stuffs you mention :(
     
  19. Daffa the Mage

    Daffa the Mage

    Map Moderator

    Joined:
    Jan 30, 2013
    Messages:
    7,571
    Resources:
    27
    Packs:
    1
    Maps:
    8
    Spells:
    16
    Tutorials:
    2
    Resources:
    27
    *necromancy + bumpy bump + update*
    Guys, I'm intending to update this thanks to BPower IsDestTree, which is adding the harvest ability for security.