• 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.
  • Create a faction for Warcraft 3 and enter Hive's 19th Techtree Contest: Co-Op Commanders! Click here to enter!
  • Create a void inspired texture for Warcraft 3 and enter Hive's 34th Texturing Contest: Void! Click here to enter!
  • The Hive's 21st Texturing Contest: Upgrade is now concluded, time to vote for your favourite set of icons! Click here to vote!

trigger for multiple players, but only one can trigger it?

Status
Not open for further replies.

311

311

Level 4
Joined
May 12, 2019
Messages
73
I'm Probably missing something obvious
I have a map that has "levels" so after you beat level 1, you go buy some items/upgrade skills and so on, and when ready go to level 2 and players get teleported to level 2 and so on

I'm trying to make a trigger that when a player (5 players possible) enter a region the level increases by 1 (I already have my variable "level" as an integer variable
my problem is that if I put unit enters region (and lets say all or least multiple players) enter this zone at the same time, what happens is now level is increased by 2 levels or more, which I don't want.
I also don't want to make it so only player 1 can trigger it, because if he dies, I want the others to be able to continue the game, or if player 1 was AFK or something.
and I cant have it turn off the trigger, because this continues throughout the game (also both player 1/2 getting there at same time would still be a problem I think)

So I need it so if any player 1-5 enter the region the level increases by 1 and teleports everyone, but at the same time make so if multiple heroes get to location at the exact same time it wont accidently increase by 2 or more.

Hopefully that makes sense
 

Uncle

Warcraft Moderator
Level 74
Joined
Aug 10, 2018
Messages
7,957
Just temporarily turn the trigger off until all of the players have been moved.

A unit enters region -> Turn off the teleport region trigger -> Teleport all of the units -> Wait 0.1 second -> Turn on the teleport region trigger

You could also keep the trigger off until the players have completely finished the level.

Level starts -> Turn off the teleport region trigger.
Level finishes -> Turn on the teleport region trigger.

A Boolean variable can be used as well if turning off the trigger has buggy results:
  • Set Variable LevelIsInProgress = False
Then add a Condition that checks the state of this Boolean. If it's Equal to True then the teleport trigger won't run it's Actions.
  • Conditions
    • LevelIsInProgress Equal to False
  • Actions
    • Set Variable LevelIsInProgress = True
    • // Teleport units
You can toggle the value of the Boolean (True/False) whenever needed.
 
Last edited:
Level 45
Joined
Feb 27, 2007
Messages
5,578
Not exactly what you're asking but an easy way is to use a player group that you put players in if their actions should activate a trigger:
  • Events
    • Unit - A unit does whatever
  • Conditions
    • ((Owner of (Triggering Unit)) is in ActivateThisShit) equal to True
    • -------- or this way for other types of triggers --------
    • ((Triggering Player) is in ActivateThisShit) equal to True
  • Actions
 
Status
Not open for further replies.
Top