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

How to make a simple trigger run only once

Status
Not open for further replies.
Level 4
Joined
Nov 19, 2009
Messages
78
hel;lo

title says it all ...

how do i make a simple trigger run only once and never again after ?

the trigger i want to run only once per game is to give Player 1, shared vision with enemy Player 2

i know hot ot make shared vision :) its the run only once then never again part that annoys me

i tried with ,,turn off'' but nothing...even with remove from queue

and yes...i did searched the forums

30 pages out of 263 results :( nothing relevant

thanks
 
Level 18
Joined
Jan 21, 2006
Messages
2,552
What do you mean exactly?

  • Untitled Trigger 001
    • Events
    • Conditions
    • Actions
      • Trigger - Run FogSetting <gen> (ignoring conditions)
Does this help at all? I don't really know how you're finding it difficult to run a trigger once, since it actually takes more effort to make it run multiple times.
 
Level 18
Joined
Jan 21, 2006
Messages
2,552
I don't get it, that isn't even necessary. Say for example you have a trigger that runs on Map Initialization. That trigger will only be run once. I don't see what the difficulty/confusion here is. Look at the "Melee Initialization" trigger - that trigger is only executed once, and there is no need to turn it off.
 
That's different; that trigger will execute once, because the event is going to run once in the game - you only have one initialization of a game, not ten. In case though he wants for example, after the death of a certain unit-type to gain visibility of Blue's units, he will have to turn the trigger off, because, if, after a while he wants to take the visibility back and the same unit-type dies, the visibility will be again granted. So, turning the trigger off will ensure its unique execution, unless he turns it on from another trigger, which is another issue.
Your action will run a trigger, but, if this action belongs to a trigger that might have a repetetive event, e.g. Time - Every 2.00 seconds of game time or Unit - A unit dies (that counts every dying unit), it will run many times during the gameplay. You actually run it, you don't prevent it from running.
 
Level 18
Joined
Jan 21, 2006
Messages
2,552
Oh, I see what he means. In that case:

  • Untitled Trigger 001
    • Events
      • Unit - A unit Dies
    • Conditions
      • RunFlag Equal to False
    • Actions
      • Set RunFlag = True
      • -------- // Do the rest of the actions: --------
You could also turn the trigger off once it has executed.
 
Level 4
Joined
Nov 19, 2009
Messages
78
ok let me be more explciit

player 1 red -- me
player 2 blue --- enemy pc

all i wanted is that ONCE, i get 1 second of shared vision with the enemy blue PC
then the shared vision is removed permanently, and the trigger never runs again

at first, i really did what you guys said ...
event -- map initialization
condition ----
trigger -- share vision with player 2
-- wait 1 sec
-- turn off this trigger

well...the above sequence does NOT work !
i keep getting shared vision with the enemy blue player repeateadly on and off ( blinks )
 
Try this instead:
  • ShareVision
    • Events
      • Time - Elapsed game time is 1.00 seconds
    • Conditions
    • Actions
      • Player - Make Player 1 (Red) treat Player 2 (Blue) as an Enemy with shared vision
      • Wait 1.00 seconds
      • Player - Make Player 1 (Red) treat Player 2 (Blue) as an Enemy
You can change the event if you want. If the event happens multiple times during the game, then you should turn off the trigger so it only runs once. But if it is something that happens only once, such as elapsed game time, then you can leave it as is.
 
Level 18
Joined
Jan 21, 2006
Messages
2,552
So what is the problem here exactly? Triggers run on Map Initialization as you have posted only run once. If they are running multiple times then it is because of something else in the map that is causing this. The only way to run a trigger "indefinitely" is with a loop or a timer. Triggers don't just execute for "no reason".
 
Level 9
Joined
Nov 4, 2007
Messages
931
I'm laughing my ass off... he's not saying that the trigger keeps executing, he's saying he still has shared vision of the enemy, which I am guessing he confused shared vision being active with trigger being on and executing still. It would be like if I had a 1 footman created then expected the footman to disappear or die after I turned the trigger off.
 
Level 4
Joined
Nov 19, 2009
Messages
78
sorry fopr the abscence...had some IRL problems

so...i d gladly submit map !

but i dont see an ,,attach object'' button

how do i submit the map ?
 
Level 18
Joined
Jan 21, 2006
Messages
2,552
Click "Manage Attachments" below the "Message" text-box. This will pop up a window that you can "Upload" and "Remove" attachments. You're able to browse through your computer to find the attachment file.
 
Level 4
Joined
Nov 19, 2009
Messages
78
oops :))

got it ! :)
so sorry....i missed it :(

anyway....here is the map in question

you will notice sme trigger which go:
event --- map initialize
action --- limit training of .....for Player 1 Red to 1

those are because i made some custom heros and had to use this trigger to prevent a bug
( the bug beeing that without trigger, clicking the custom hero to train it, it would not made the other icons grey out till second tier of capital building )

except this, there are no other trigger or hidden actions etc!

thank you
 

Attachments

  • (10)RagingStream - Scourge Invasion2.w3x
    780.7 KB · Views: 107
Level 9
Joined
Nov 4, 2007
Messages
931
Worked fine like this:
  • Melee Initialization
    • Events
      • Map initialization
    • Conditions
    • Actions
      • Melee Game - Limit Heroes to 1 per Hero-type (for all players)
      • Melee Game - Give trained Heroes a Scroll of Town Portal (for all players)
      • Melee Game - Set starting resources (for all players)
      • Melee Game - Remove creeps and critters from used start locations (for all players)
      • Melee Game - Create starting units (for all players)
      • Melee Game - Run melee AI scripts (for computer players)
      • Melee Game - Enforce victory/defeat conditions (for all players)
      • Player - Make Player 2 (Blue) treat Player 1 (Red) as an Enemy with shared vision
      • Wait 1.00 seconds
      • Player - Make Player 2 (Blue) treat Player 1 (Red) as an Enemy
By the way you don't need all those other hero limit triggers, you can lump it all into the first one like this:
  • Melee Initialization
    • Events
      • Map initialization
    • Conditions
    • Actions
      • Melee Game - Limit Heroes to 1 per Hero-type (for all players)
      • Melee Game - Give trained Heroes a Scroll of Town Portal (for all players)
      • Melee Game - Set starting resources (for all players)
      • Melee Game - Remove creeps and critters from used start locations (for all players)
      • Melee Game - Create starting units (for all players)
      • Melee Game - Run melee AI scripts (for computer players)
      • Melee Game - Enforce victory/defeat conditions (for all players)
      • Player - Limit training of Firelord to 1 for Player 1 (Red)
      • Player - Limit training of Alchemist to 1 for Player 1 (Red)
      • Player - Limit training of Tinker to 1 for Player 1 (Red)
      • Player - Limit training of Blood Knight to 1 for Player 1 (Red)
      • Player - Limit training of Moonkin to 1 for Player 1 (Red)
      • Player - Limit training of Legion Warlock to 1 for Player 1 (Red)
      • Player - Limit training of Magnataur Chieftain to 1 for Player 1 (Red)
      • Player - Make Player 2 (Blue) treat Player 1 (Red) as an Enemy with shared vision
      • Wait 1.00 seconds
      • Player - Make Player 2 (Blue) treat Player 1 (Red) as an Enemy
 
Level 4
Joined
Nov 19, 2009
Messages
78
thanks
it works great :0

( i modified the trigger to accomodate for the fact i also play with an ally ....so the trigger now takes that into accoun too and show me the posiont of the enemy)

many thanks
 
Here, you can also do this.

First, you make a hidden area. then you make hidden enemy wisps.

  • Trigger1a
  • Events Unit - A Unit enters Region001 (Where the unit will cross.)
  • Conditions
  • Actions Unit - Kill Wisp(one of those enemy units)
  • Trigger1b
  • Events - a unit dies
  • Conditions
  • Actions - whatever you want to happen
So if I wanted Arthas to say I LIKE CHEESE only once, I'd do this:
  • ArthasSpeech 1a
  • Events - A Unit Enters RegionXXX(Your region)
  • Conditions
  • Actions - A Unit(Preferably a wisp within a boundary wall) dies
  • ArthasSpeech 1b
  • Events - A Unit(Wisp) Dies
  • Conditions
  • Actions - Game - Display to all players the text: |cffffcc00Arthas|r: I LIKE CHEESE

It should work, I'm using that.
 
Status
Not open for further replies.
Top