Some Complicated Team Switching Stuff (Uses Blocks)

Okay. I have a really weird team switching thing that I feel like could be done better but idk. So, I have a piece of text. It is a random arrangement of the numbers 1, 2, 3, and 4. (For example the text could be “3142”) This is what determines what teams to switch to. In my example text, the person on team 3 would switch to team 1 because it is in the first spot. The person on team 1 would switch to team 2 because it is in the second spot. And so on and so forth. I already know how to pull each individual number, just use the string methods, either
image
or
image
The main thing I need help with is “what is the best way to switch the teams?” The method that I have in my head right now uses 12 (maybe 16) relays, and I feel like it could be done better but I can’t think of anything.

If you are confused about anything (which is likely because my explaining sucks) just ask!

I think the top one works better:
Input 1: Find the team string
Input 2: Find the letter number of the certain part of the string.
Ex: in “2881” get letter # 3
Outcome: 8

Relay on all players. Then run a trigger that will get the current players team number (there is a block for this) and then gets the index of the string you have that’s associated with that number. Based on what number is at that index, broadcast on one of 4 channels (switch to team1, 2, 3, 4). Then, place a team switcher that receives on each of these channels and switches to the correct team.

If this is unclear (I rushed this explanation), feel free to ask for clarification haha.

1 Like

Wait the person on team 1 switches to team 2, not 4? Based on the text you showed, it seems like 3 → 1 → 4 → 2? Or am I misunderstanding?

Oh crap, I misunderstood and solved it backwards haha. Lemme rethink this.

No in 3142,
3 is in the first spot so team 3 switches to team 1
1 is in the second spot so team 1 switches to team 2
4 is in the third spot so team 4 switches to team 3
2 is in the fourth spot so team 2 switches to team 4

if that makes sense

You gave me an idea though. Let me see if it works.

Ok yeah so relay on all players then trigger a trigger that:
Gets the player’s team number
Finds the first occurrence of that number in the text
Then broadcasts on a channel that correspondes to the index (use concatenation)
Then have four team switchers that receive on each channel to switch the teams.

1 Like

Ah I see. You could do something like this:

broadcast on channel (create text with (in text {your text} find first occurrence of text (create text with [team number])))

And each number corresponds to a team switcher, sorry if it’s unreadable lol

Basically what bh said

I have to do a bit more concatenating than that bc I already have number channels being used for something else but yeah I think you and Blackhole’s ideas will work. I just hope I don’t have to use another block cause I’m already at 71% memory and I’m still working on game mechanics

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