Make an integer array "AllyState[]" for example.
Let's define the integer values like:
- Pending Ally
- Ally
- Enemy
----
Trigger for when a Player types "~ Ally X" ("X" is the respective player number):
- if TriggeringPlayer is already ally with Player X you do nothing.
- if TriggeingPlayer is not an ally with Player X you set his "AllyState" towards PlayerX to "1".
- if Player X's state is "1" already towards TriggeringPlayer, you make them allies, and seit their AllyState to "2".
... similar for enemy. But you can make both players instant enemy I guess, without more checks.
There are 12 (default max) players. Each player has an "AllyState" towards
all other players, so you minimum need to use 12*11 array indices.
For simplcitiy we will just use 12*12, because we will just use always "PlayerNumberOf(Player)" as reference, see:
AllyState[ X*12 + Y] -> defines the allystate from Player X towards Player Y. "X" and "Y" are the respective player numbers.
Try it out, test around, and in case you have troubles just
post your code.
edit:
"Player X" works same as "Player Name" you just need to get PlayerName.