• 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] Ambush trigger help

Status
Not open for further replies.
Level 2
Joined
Mar 2, 2016
Messages
6
Hi, I wanted to make a trigger where if a unit owned by the player were to walk towards a certain point, a group of skeletons would come out making an ambush for the player units.

I tried using regions for this where if a unit enters the region, a group of skeletons would be created. I even put conditions that the triggering unit belongs to the player.

The problem is, that the trigger keeps repeatedly spawn a group of skeletons whenever a unit remains on the region.

So how do I make trigger only run once?
 
Level 14
Joined
Jul 1, 2008
Messages
1,314
Hi, I wanted to make a trigger where if a unit owned by the player were to walk towards a certain point, a group of skeletons would come out making an ambush for the player units.

I tried using regions for this where if a unit enters the region, a group of skeletons would be created. I even put conditions that the triggering unit belongs to the player.

The problem is, that the trigger keeps repeatedly spawn a group of skeletons whenever a unit remains on the region.

So how do I make trigger only run once?

So I am asuming you are kind of new to this, thats why I thought giving u a bit more detail would be good.

Under the assumption, that there is more than one player, there is an easy solution for you.

1. Make a new variable of type boolean and make it an array (check the box)
e.g. name it "HasPlayerBeingAmbushed"
2. In your ambush trigger, do two things
A) Add the Boolean Comparison Condition (using your boolean variable):
  • HasPlayerBeingAmbushed[PlayerNumber of (Owner of (Triggering Unit))] (==) FALSE
B) Add a "Set variable" action to the beginning of your trigger (using the boolean again)
  • Set HasPlayerBeingAmbushed[PlayerNumber of (Owner of (Triggering Unit))] = TRUE
By doing this you deactivate this trigger after a single use for the rest of the game.
 
Status
Not open for further replies.
Top