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

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 64
Joined
Aug 10, 2018
Messages
6,558
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 39
Joined
Feb 27, 2007
Messages
5,019
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