• 🏆 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!

n00b needs help - triggers in trees and allies

Status
Not open for further replies.
Level 2
Joined
Apr 17, 2010
Messages
12
Ok - fair warning.

I suck at editor. I'm a noob, I don't necessarily program (read as I don't, nor have any knowledge of it), and my extent of wow editing is that I use object editor to compare units and thus figure out what each thing does.

Where I need help -

Two things:

a) I have a map where I have these neutral Night Elves chilling in a forest and when my hero meets them (RPlol) they join forces. Now, this is all storyboard, but I know that during quests, you can have this actually done. My question is... how? I saw that thing in the forces properties that says make rescue-able, but that doesn't seem to do anything... Also, the forces are spread out so if the hero walks towards the main Tree of Life, is there a way to trigger it to turn the entire team at once, or do I need to run by each unit?

b) On another map, I have these dwarves chilling on a mountain top. Naturally resources are scarce, but I was wondering (based on what I saw around here), can you provide a trigger that once trees are cut down, they will regrow? Or is the term respawn?

Anyways, thanks for your help in advance, but bear in mind, I'm mostly ignorant when it comes to triggers, so while I'm not asking for a complete guide in your explanation, please don't leave out any steps. Thanks.
 
Level 3
Joined
Jun 9, 2010
Messages
59
a) I have a map where I have these neutral Night Elves chilling in a forest and when my hero meets them (RPlol) they join forces. Now, this is all storyboard, but I know that during quests, you can have this actually done. My question is... how? I saw that thing in the forces properties that says make rescue-able, but that doesn't seem to do anything... Also, the forces are spread out so if the hero walks towards the main Tree of Life, is there a way to trigger it to turn the entire team at once, or do I need to run by each unit?

Use a simple region trigger such as this (you can make regions by going to the region pallete in your tool pallete window):
  • Events:
  • Unit - a unit enters (region that you placed near tree of life)
  • Conditions:
  • (Owner of (Entering unit) Equal to (whichever player is rescuing units)
  • Actions:
  • Unit Group - Pick every unit in (Owned by player that you set to be rescuable units) and do (Unit - Change ownership of (picked unit) to (whichever player you have rescuing units) and change color)
Basically what this trigger will do is once a unit owned by the player that you want rescuing units enters the region you set near the tree of life all of the units owned by the rescuable player (you must specify this in the trigger) change ownership to the player rescuing them(also must specify in the trigger).

Note that you can change the condition to anything you want really... say maybe you want it to be a specific unit only that can do this then just set it to a specfic unit condition and so on....

As for just making the units resquable here is another simple trigger you could do:

  • Events:
  • Map initialization
  • Conditions:
  • none really needed
  • Actions:
  • Unit Group - Pick every unit in (Owned by player that you set to be rescuable units) and do (Unit - Make (Picked Unit) Rescuable by Player Group (Whichever player you have set to rescue units)
  • Unit - Limit rescue events for (Picked Unit) to a range of X(you specifiy)
This trigger does just as you asked.. make the units of the player that is being rescued to be rescuable.. and the last action of the trigger I dont think is required but is useful if you want to set a different rescuable range for the units than default.

Note that this are very basic triggers for doing what your asking but seeing that you are a begginer you do need very basic triggers to learn off... just tamper with this trigger if your wanting to make it more advance (the trial and error process is the best learning process for most =] )

b) On another map, I have these dwarves chilling on a mountain top. Naturally resources are scarce, but I was wondering (based on what I saw around here), can you provide a trigger that once trees are cut down, they will regrow? Or is the term respawn?

Regrow...respawn both work when dealing with trees and I believe there is either a tutorial or another thread that already answers this subject in the forums/on this site.

Edit: Well I found the tutorial on the site but its written in Jass (which you definitely wouldnt want to start on as a begginer) so heres the link he does explain things quite well but Im sure there is an easier thread/tutorial out there written in GUI for tree respawning (at least i think X{ )

http://www.hiveworkshop.com/forums/jass-ai-scripts-tutorials-280/tree-revival-system-31805/
 
Level 9
Joined
Oct 11, 2009
Messages
477
You can create a GUI MUI Tree Revival System like this and it only requires 2 triggers and one(1) Hashtable global:

  • Initialize Tree Revival Hashtable
    • Events
      • Map initialization
    • Conditions
    • Actions
      • Hashtable - Create a hashtable
      • Set TreeRevivalHashtable = (Last created hashtable)
      • Destructible - Pick every destructible in (Entire map) and do (Actions)
        • Loop - Actions
          • Hashtable - Save 0 as (Key tree counter) of (Key (Picked unit)) in TreeRevivalHashtable
  • Tree Revival
    • Events
      • Time - Every 3.00 seconds of game time
    • Conditions
    • Actions
      • Set EntireMap = (Entire map)
      • Destructible - Pick every destructible in EntireMap and do (Actions)
        • Loop - Actions
          • Set TreeRevivalLocation = (Position of (Picked destructible))
          • Set TreeRevivalGroup = (Units within 300.00 of TreeRevivalLocation matching (((Matching unit) is alive) Equal to True))
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • (Number of units in TreeRevivalGroup) Equal to 0
              • ((Picked destructible) is dead) Equal to True
            • Then - Actions
              • Custom script: call RemoveLocation(udg_TreeRevivalLocation)
              • Custom script: call DestroyGroup(udg_TreeRevivalGroup)
              • Hashtable - Save ((Load (Key tree counter) of (Key (Picked unit)) from TreeRevivalHashtable) + 3) as (Key tree counter) of (Key (Picked unit)) in TreeRevivalHashtable
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • (Load (Key tree counter) of (Key (Picked unit)) from TreeRevivalHashtable) Greater than TIME INTERVAL OF TREE REVIVAL
                • Then - Actions
                  • Destructible - Resurrect (Picked destructible) with (Max life of (Picked destructible)) life and Show birth animation
                  • Hashtable - Save 0 as (Key tree counter) of (Key (Picked unit)) in TreeRevivalHashtable
                • Else - Actions
            • Else - Actions
              • Custom script: call RemoveLocation(udg_TreeRevivalLocation)
              • Custom script: call DestroyGroup(udg_TreeRevivalGroup)
      • Custom script: call RemoveRect(udg_EntireMap)


I hope that helped you....:thumbs_up:
 
sephiroth1234,
• You don't need to set the Entire map into a variable, it's a preset area.
• Destructibles out of the map's boundaries shouldn't have any functionality, so use Playable Map Area instead.
• RemoveRect for EntireMap makes no sense; I don't even know if it will be functional on the second call of the trigger; it's like destroying a player group of (All players) = no reference afterwards.
• In the first trigger, you made a mistake on rush: you used (Key(Picked unit)) instead of (Key(Picked destructible)).
• You remove the leaks in a wrong way. Use the removal out of the If/Then/Else statement and they will be removed just fine.
• You don't need a periodic event to check for dead destructibles, just use Destructible - A destructible within (Playable Map Area) dies.
• The trigger makes no comparison of whether the destructible is a Tree.
 
Level 2
Joined
Apr 17, 2010
Messages
12
Thanks Sephiroth and Pharaoh. I appreciate the help.

Like I said, I'm a total noob at triggers so when I click for the first trigger, I can't get it to say just "Last Created Hashtable" It asks me for values, then same with all the functions, so what am I suppose to put for variables?

Otherwise, when I got make a trigger, I keep getting errors that won't let it go through.
 
Status
Not open for further replies.
Top