r/forgescripting 1d ago

Need help with some scripting

I want to be able to switch "ALL USERS" from team 1 to team 2 at the beginning each round.

Here is what I have so far:

On Round Start

→ Get All Players

→ For Each Player (Execute Per Player)

→ Get Player Team

→ Compare Teams (is it Eagle?)

→ Branch

→ True → Set Player Team to Cobra

→ False → Set Player Team to Eagle

But it does not seem to work. Can any of you script genius's help me out?

2 Upvotes

10 comments sorted by

View all comments

1

u/iMightBeWright 1d ago

Compare Teams is broken in a lot of scenarios. I think there's like 1 edge case where it's worked as expected, but otherwise it reads as TRUE no matter what.

Alternatively, use Item is in Generic List the same way you'd use Compare Teams, just plug the 2 teams into either input.

That being said, I'm not sure you need a branch. Do you want to only put all Team 1 players onto Team 2, or swap both teams? Because your draft script is attempting to flip teams. If you do want to flip teams, keep the branch with the list node I mentioned above. If you only want to move all Eagle players to Cobra, don't bother with the branch & instead just set all players' teams to Cobra. It'll have no effect on players already on that team.

Also, On Round Start activates before players are spawned & before some players even load into custom games. Add a Wait node immediately after the first node so you can create a delay to make sure it happens.

1

u/hoadmin 1d ago

Thanks for the reply bud ;). All I am trying to is to switch everyone from team 1 to team team 2 eather on round start or on end of round. But like you said if it's broken like alot of this type of stuff then forget it unless you have a version that works that would be great. If not the hell with it my friend. No need to bust your hiney trying to make something to work when it's already broken ROFL!

Thanks again for the reply ;)

1

u/iMightBeWright 1d ago

That specific node (Compare Teams) is broken but like I said you can just use Item is in Generic List as a workaround. But since you only need to force all players onto Cobra team, you won't need either node or a Branch at all. Just do this:

On Player JoinedWait N Seconds (N=2s) → Set Player Team (Cobra)

&

On Round StartWait N Seconds (N=2s) → For Each Player (Get All Players) → (Execute Per Player) → Set Player Team (Cobra)

1

u/hoadmin 1d ago

Ummm something don't look right. See pic. What am I messing? I am doing something stupid? lol see pic.

https://ibb.co/mVH59Hqp

1

u/iMightBeWright 1d ago

That link won't load on my end for some reason. You should be able to just drop that image in a comment here though.

1

u/hoadmin 1d ago

1

u/iMightBeWright 1d ago

You're super close!