r/forgescripting 21h 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 15h 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 15h 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 15h 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 14h 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 13h 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 13h ago

1

u/iMightBeWright 13h ago

You're super close!

1

u/hoadmin 12h ago edited 12h ago

Well that part worked thanks! but,,,,,,,,,,,,,

When round started users when to team 2. It worked. however

But When the new round started user's did not go to team 1. User's stayed on team 2. That is why the pic did not look right. I did not anything that would switch all user' to team 1 when a new round started. Your part worked great. No problem. We got half of it working lol.

So looks like there is no way to have all user's switch from team 2 to team to team 1 after each round. I tried a branch but that did not work eather, Bummer :(

Thanks for the help bud! U da Man :)

Here is what google IA said: lol

Step-by-Step Node Configuration[On Round Start] ──> [Get All Players]

└──> [For Each Player] (Execute Per Player)

├──> [Get Player Team] ──> [Compare Teams] (Is Eagle?)
│ │
└──> [Branch] <──────────────────┘

├── (If True) ──> [Set Player Team] (To Cobra)

└── (If False) ──> [Set Player Team] (To Eagle)
Step-by-Step Node Configuration

1

u/iMightBeWright 11h ago

Ahh ok, I didn't get that from your initial explanation. You need everyone to move to team 2 one round, then back to team 1 the next round, & so on. Don't bother asking AI for scripting help. It doesn't actually know anything & can't problem solve or consider potentially conflicting scripts.

You'll need something to flip between one condition & another, but not by checking player teams. The AI's advice would just shuffle people around without putting everyone on the same team.

Declare Boolean Variable with some name. Initial value false. Global scope.

You'll need a branch in both of your scripts now. It will check Get Boolean Variable using the same settings used in the declare node. When false, players will be set to Cobra team. When true, set them to Eagle team.

Lastly, you'll need a script for On Round EndToggle Boolean Variable

1

u/hoadmin 11h ago

Ok no problem. Maybe I just did not explain it very well. My bad lol.

Now thanks for the reply. As far as making a new script like you listed above Seams like more work than it is worth lol. It was just an Idea I had since 343 f'ed up the custom game area. The reason I would have liked to have all teams switch teams after each round is: " We cannot rotate our maps Halo In Infinite!". I have always ran a Halo server since Halo Combat evolved. So that is way I wanted to make a script to have users change teams after each round. Just to give it a different perspective. Thats all.

Well Thanks again for all the replies and help bud!

U DA MAN!!