• Listen to a special audio message from Bill Roper to the Hive Workshop community (Bill is a former Vice President of Blizzard Entertainment, Producer, Designer, Musician, Voice Actor) 🔗Click here to hear his message!
  • Read Evilhog's interview with Gregory Alper, the original composer of the music for WarCraft: Orcs & Humans 🔗Click here to read the full interview.

[Trigger] Trigger that kills trees

Status
Not open for further replies.
Level 4
Joined
Aug 20, 2004
Messages
65
I'm trying to make a trigger that will kill trees around a unit with a certain buff. This is what I have so far.

  • Trail Trees
    • Events
      • Time - Every 0.50 seconds of game time
    • Conditions
    • Actions
      • Set Temp_Group = (Units in (Playable map area) matching (((Matching unit) has buff Blazing A Trail ) Equal to True))
      • Unit Group - Pick every unit in Temp_Group and do (Actions)
        • Loop - Actions
          • Destructible - Pick every destructible within 256.00 of (Position of (Picked unit)) and do (Actions)
            • Loop - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • ((Destructible-type of (Picked destructible)) Equal to Fall Tree Wall) or (((Destructible-type of (Picked destructible)) Equal to Northrend Tree Wall) or ((Destructible-type of (Picked destructible)) Equal to Dungeon Tree Wall))
            • Then - Actions
              • Destructible - Kill (Picked destructible)
            • Else - Actions
But obviously it isn't working, which is why I posted it. Anyone point out whats wrong with it?
 
Last edited by a moderator:
Level 5
Joined
May 2, 2007
Messages
141
Hmm.... couldn't you do it without triggers?

Take the Neautral Life regen aura (from fountains) and reverse it so instead of 1 hp per sec, it actually does -XXXX per sec, then change its targets allowed to trees?

Not sure if it will work though...
 
Level 6
Joined
Mar 2, 2006
Messages
306
if i remember correctly, immolation is hard-coded to pick units. it won't work. stick with triggers.

as for your trigger, i failed to see anything wrong with it, so i made one almost identical to yours and it worked perfectly (aside from leaking every 0.5s). here is mine:
  • Untitled Trigger 001
    • Events
      • Time - Every 0.50 seconds of game time
    • Conditions
    • Actions
      • Set Temp_Group = (Units in (Playable map area) matching (((Matching unit) has buff Devotion Aura) Equal to True))
      • Unit Group - Pick every unit in Temp_Group and do (Actions)
        • Loop - Actions
          • Destructible - Pick every destructible within 256.00 of (Position of (Picked unit)) and do (Destructible - Kill (Picked destructible))
since your trigger fires two times each second we don't want it to leak so you should write it like this:

  • Untitled Trigger 002
    • Events
      • Time - Every 0.50 seconds of game time
    • Conditions
    • Actions
      • Set Temp_Group = (Units in (Playable map area) matching (((Matching unit) has buff Devotion Aura) Equal to True))
      • Unit Group - Pick every unit in Temp_Group and do (Actions)
        • Loop - Actions
          • Set Temp_Point = (Position of (Picked unit))
          • Destructible - Pick every destructible within 256.00 of Temp_Point and do (Destructible - Kill (Picked destructible))
          • Custom script: call RemoveLocation( udg_Temp_Point )
      • Custom script: call DestroyGroup( udg_Temp_Group )
------------------------

so what's the problem with yours? i don't know, but you can use good old debugging methods:
- first, set the interval to 5 sec or more so you don't clutter the screen with messages;
- second, clear text messages from the last time (there's an action in Cinematic section)
- third: see which units are found each time ( Game - Display to All Players ( Name of Picked Unit) )
- fourth, print out the type of each destructible found ( Game - Display to (All players) the text: (Name of (Picked destructible)) )

that should tell you what's wrong; not just in this case, but also in almost every other case...
 
Last edited:
Level 4
Joined
Aug 20, 2004
Messages
65
@edge

After looking at your trigger i realized what was wrong with mine.. I, uh, forgot to put the actions in the loop after "Pick every.." And I cleared up the leaks, too. Thanks!

O.K, after I killed the trees I found out my respawn doesn't work, so here it is:

  • Tree Respawn
    • Events
      • Destructible - A destructible within (Entire map) dies
    • Conditions
      • ((Destructible-type of (Dying destructible)) Equal to Fall Tree Wall) or (((Destructible-type of (Dying destructible)) Equal to Dungeon Tree Wall) or ((Destructible-type of (Dying destructible)) Equal to Northrend Tree Wall))
    • Actions
      • Wait 10.00 seconds
      • Destructible - Resurrect (Dying destructible) with (Max life of (Dying destructible)) life and Show birth animation
 
Last edited:
Level 6
Joined
Mar 2, 2006
Messages
306
Black-Templar said:
I, uh, forgot to put the actions in the loop after "Pick every.."
the reason none of us saw what was wrong is that your trigger code wasn't properly indented. and you repeated the mistake in the following post. you are not supposed to copy-as-text one line at a time; right-click the trigger name on the right side (above events) and choose copy-as-text there... only then copy it inside a trigger tag here... preview post button seams silly, but it is useful.

paskovich said:
i heared that this tree-resurrection thing can only be done with custom scripts, or entirely with jass
(explanation not directed only to paskovich) true. the thing is, functions like (Dying destructible) do not maintain their values forever; after the slightest wait, it's gone. you have to save it in a local variable (using custom script), then you can wait and revive the saved destructible. so, first part of the problem with Black-Templar's regrowth trigger (actions) could be fixed in two lines.

second reason his trigger doesn't work is the event. (A destructible within region dies) only works if the region has 64 trees or less (probably not the case). so, he'd have two options: 1) have several regions and use this event, and 2) at map init, pick every tree and register (picked destructible dies) event with an eventless tree-reveval trigger (much easier)...

and one last point: do not use non-gametime wait (wait 10 seconds). always use (wait 10 game-time seconds).
 
Level 4
Joined
Aug 20, 2004
Messages
65
@ Edge.

Thats exactly how I copied my trigger. For some odd reason it still doesn't indent right.


Also, is there a reason never to use 'wait real seconds?' Does it cause a leak, or something?

@ Purple

Why is it bad to use waits?
 
Level 40
Joined
Dec 14, 2005
Messages
10,532
They're innaccurate --

A) Wait .01 seconds works out to about .27 seconds, + or - a few (it's random), on single player

B) Waits synch the trigger, meaning that the latency + leakage of the game is added on to the wait time. This means that a wait of .01 can even be waiting 10 seconds on a fairly leaky map, or a map with players with a bad internet connection
 
Level 6
Joined
Mar 2, 2006
Messages
306
I'd be surprised if warcraft doesn't retain GetTriggerWidget() forever, since it does retain GetTriggerUnit()

among all those event-functions, only two or three retain their values indefinitely. as they are clearly an exception to the rule, i think it is safer that we teach the rule to fresh mapmakers, not specific cases...

frankly, i'm not sure about GetTriggerWidget() and i don't feel like starting up the editor to check. unlike you, i'd be surprised if it would retain its values...

Also, is there a reason never to use 'wait real seconds?' Does it cause a leak, or something?
it leads to desynchronization. it doesn't split the game instantly like some gui actions (pan camera as neccessary) do, but accumulated waits over a long time (unless the network works perfectly and all machines are high-end) can cause the game to split. now it doesn't make perfect sense to me, but some people swear that changing all normal-waits to polled (game-time) waits caused their map to stop splitting...

PurplePoot said:
They're innaccurate...
true, but irrelevant. our brains are to slow to notice delays so short...

PurplePoot said:
Wait .01 seconds works out to about .27 seconds
...because 0.27 is minimum there; 0.01 works out to 0.27, but 0.31 works out to 0.31 or 0.32 which is fine for our humanly needs...
 
Level 40
Joined
Dec 14, 2005
Messages
10,532
JASS:
function GetDyingDestructable takes nothing returns destructable
    return GetTriggerWidget()
endfunction
Voila ><

true, but irrelevant. our brains are to slow to notice delays so short...
...
A) try doing a slide spell with TSA. It'll look awful
B) Synching in multiplayer can cause massive delays, as I said. I once used them for a 'wave' spell with .27 intervals, and in a game with a ton of delay, it was waiting up to 6 or 7 seconds between waves. An even better example is when a really leaky game has 10-or-so second intervals.

it leads to desynchronization. it doesn't split the game instantly like some gui actions (pan camera as neccessary) do, but accumulated waits over a long time (unless the network works perfectly and all machines are high-end) can cause the game to split. now it doesn't make perfect sense to me, but some people swear that changing all normal-waits to polled (game-time) waits caused their map to stop splitting...
Shouldn't. The main thing PolledWait does is make the aforementioned innaccurate-due-to-synchronization waits slightly less innaccurate, due to the usage of a timer.
 
Status
Not open for further replies.
Top