How to track only the first player who entered the mutator zone ?

Basicaly i want to tp the first player after a timer is completed but it tp everyone in the zone.
Please help :frowning:

More info : there are 2 dif mutator zones and 2 players since it’s a 1v1

Just subscribe to your mutator zone’s enterzone event and pass the player reference to your teleportation function. And have your Zone function that is called from the above event ignore any player after the first with something like an if statement.

Do you want the mutator zone after teleporting the first player to be disabled? Or teleporting the first player and keep it enabled but stops other players from being teleported when entering it?

I want the mutator zone to not take into account a player entering the zone when it’s already occupied , i managed to do it to a certain point

imagine i got a teleporter that tp’s a certain team
p1 enter zone 1 ( team changed )
p2 enter zone 1 ( nothing happens since p1 is in zone and didnt leave
p2 leaves zone 1
p2 re enter zone 1 ( team changed !!!) ← it shouldn’t do that since p1 is still in zone :[

Mutant.AgentEntersEvent.Subscribe(OnPlayerEnter)
Mutant.AgentExitsEvent.Subscribe(OnPlayerExit)

i set set some variables :
var P1isInZone : logic = false

OnPlayerEnter(Agent : agent) : void =
if (P1isInZone = false):
Print(“PlayerEnter: Agent entered the zone”)
…rest of code

OnPlayerExit(Agent : agent) : void =
    Print("PlayerExit: Agent exited the zone")
    set P1isInZone = false
    ... rest of code

Nice. My question now is, since you did some functions to deny p2 from changing team when entering zone while p1 is in it, why does that not work when p2 goes out and re enter it again?

I think I asked right and that what really happens right?

I think it’s because my code makes p1 Agent and p2 Agent but doesnt separate them as an individual each i’m trying to learn how to do that

Such things can be solved by several methods, there are some that are coming to mind now, but I’ll ask before.
Is the team index that will be given to whoever enters the zone specified or is it random? Like is it for example always team 3? Or can be changed?

the team is specified

Well, now this solution may be a little long but I’m sure it works! (If you had it hard to apply tell me so I find something else).

I assume you use class selector to change team. Now what you do is you forget everything about coding and just work with devices.

I’ll assume that the zone that changes players teams is square shaped.

I’ll assume the team that players get switched to is Team Index 3.

I need you to make the zone gets disabled after someone enters it and get team switched.

Plus find the option that it changes the team of the triggering player only.

1- Go add Trigger Device, and change the value of how many times it can be triggered before getting disabled to 1 (find this option in it).

2- Also in the Trigger Device first disable all check boxes that talk about triggering because we don’t want it to work if someone gets close to it, we’ll do it manually.

3- Scroll down to Trigger Device functions → Trigger → When Mutator Zone → Player Enters it

Now even if someone else enters the zone it won’t change his team because Trigger Device is able to get triggered once only as you set it above.

4- Go to ‘Class Selector’ that is responsible for changing team, scroll down to its functions and make ‘Change player to team’ → when Trigger Device → Gets Triggered

Also now the player team was changed to 3 right?

Last step is add Mutator Zones out of the current mutator zone (surrounding it) then go to trigger scroll down to its functions Reset or Active one I forgot it → let it reset when Team Player 3 enters the new surrounding zones (which in fact means he got out of the main zone)

So the trigger device now works again and can change team of anyone new who enters the Zone.

Honestly I’m away from PC so the answer may gets you lost abit because words aren’t accurate but if you are getting most of what I am saying tell me so I take the answer to the professional level.

As for last step I think there’s no need to add many surrounding zones, just replace the ‘Reset’ trigger device or ‘Activate’ it function from entering the new zones into just exiting the main zone. Same ending

thank’s a lot this helped me come up with a solution :sparkling_heart:

1 Like

You’re welcome :hugs:

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.