• 🏆 Texturing Contest #33 is OPEN! Contestants must re-texture a SD unit model found in-game (Warcraft 3 Classic), recreating the unit into a peaceful NPC version. 🔗Click here to enter!
  • It's time for the first HD Modeling Contest of 2024. Join the theme discussion for Hive's HD Modeling Contest #6! Click here to post your idea!

IsDestructableTree GUI 1.1

  • Like
Reactions: deepstrasz and Wrda
-Reuploaded-

A gui version of IsDestructableTree by Maddeem two ways to detect if the destructable is a tree or not. Note that you got to choose one of the two ways before testing map since every trigger are disabled atm.


  • GUI
    • Events
      • Map initialization
    • Conditions
    • Actions
      • -------- creates hashtable --------
      • Hashtable - Create a hashtable
      • Set ISD_hashtable = (Last created hashtable)
      • -------- List tree or whatever you want to detect here --------
      • Custom script: call SaveBoolean(udg_ISD_hashtable, 'LTlt', 0, true)
  • Demo
    • Events
      • Player - Player 1 (Red) skips a cinematic sequence
    • Conditions
    • Actions
      • -------- you MUST store this variable into the destructable you want to detect --------
      • Set ISD_Destructable = Summer Tree Wall 0000 <gen>
      • -------- loads info from hashtable --------
      • Custom script: set udg_ISD_check= LoadBoolean(udg_ISD_hashtable, GetDestructableTypeId(udg_ISD_Destructable), 0)
      • -------- checks if true or false --------
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • ISD_check Equal to True
        • Then - Actions
          • Game - Display to (All players) the text: Destructable is a t...
        • Else - Actions
          • Game - Display to (All players) the text: Destructable is not...


  • init
    • Events
      • Map initialization
    • Conditions
    • Actions
      • Hashtable - Create a hashtable
      • Set ISD_hash = (Last created hashtable)
      • -------- Creates a dummy unit, hiding it and storing it. --------
      • Set ISD_loc = (Center of (Playable map area))
      • Unit - Create 1 Peasant for Neutral Passive at ISD_loc facing Default building facing degrees
      • Set ISD_dummy = (Last created unit)
      • Unit - Add Invulnerable (Neutral) to ISD_dummy
      • Unit - Hide ISD_dummy
      • Custom script: call RemoveLocation(udg_ISD_loc)
  • system
    • Events
    • Conditions
    • Actions
      • -------- orders unit to try to harvest the tree --------
      • Unit - Order ISD_dummy to Harvest ISD_d
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Current order of ISD_dummy) Equal to (Order(harvest))
        • Then - Actions
          • Set ISD_boolean = True
          • Set ISD_p = (Position of ISD_dummy)
          • Unit - Move ISD_dummy instantly to ISD_p
          • Custom script: call RemoveLocation(udg_ISD_p)
        • Else - Actions
          • Set ISD_boolean = False
  • demo
    • Events
      • Player - Player 1 (Red) skips a cinematic sequence
    • Conditions
    • Actions
      • Destructible - Pick every destructible in (Playable map area) and do (Actions)
        • Loop - Actions
          • Set ISD_d = (Picked destructible)
          • Trigger - Run system <gen> (checking conditions)
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • ISD_boolean Equal to True
            • Then - Actions
              • Game - Display to (All players) the text: true
            • Else - Actions
              • Destructible - Remove ISD_d
              • Game - Display to (All players) the text: false


credits:
Maker - help with trigger and idea to add the second way
Mag96 - for the second way
Maddeem - base idea of system


Keywords:
Destructable, is, GUI, convert, system, tree
Contents

Just another Warcraft III map (Map)

Reviews
Level 33
Joined
Apr 24, 2012
Messages
5,113
Cache GetDestructableTypeId to add some speed.


This will be much more efficient:

[jass=]

//This is for the then block:
if not HaveSavedBoolean(hash,id,key) then
set bool = true
call SaveBoolean(hash,id,key,bool
else
set bool = LoadBoolean(hash,id,key)[/code]

This way,users dont need to load them by them selves

edit

Dont do above,nevermind that.
Just return the boolean likes this in one line

set bool = IssueTargetOrderById(checker, OrderId("harvest"), d) and IssueImmediateOrderById(checker, OrderId("stop"))

Now,we are talking about the speed :D
 
Last edited:

Chaosy

Tutorial Reviewer
Level 40
Joined
Jun 9, 2011
Messages
13,182
thanks for taking your time to improve my system but my answer on this is no.

As this is a converted system I want a minimal jass within it. The only reason that I use the hashtable in jass is because you cant use a variable as a key in GUI in my case "GetDestructableTypeId(udg_ISD_d)".

but idea to store into a variable is a little update I can do sometime when im less lazy¨

edit: tho I am working on a way to return the boolean without hashtables so it's easier to understand got a minor problem atm tho :)
 
Last edited:
Top