- Joined
- Jan 12, 2011
- Messages
- 1,527
No. If your trigger fires only when you write "-ally red" then you know that the triggering player wants to ally red player! There is no need to get substring to find out if "-ally red" contains substring red, because they way you set it up, if the entered chat message didn't contain exactly "-ally red", then the trigger would not even fire.
If you want for this whole (un)alliance system only 1 trigger, you need to do it my way (similarly to what I posted in the test map a few posts before).
If you do it your way - 12 ally and 12 unally triggers, then each trigger has different event.
So just merge the important parts of my trigger into your trigger - like this:
For -unally red the trigger is same, except the event (you have to change which command fires that trigger to -unally red), condition (now you check that they are allies instead of checking that they are not allies) and that you set their alliance as enemy.
Ally Red
Events
Player - Player 2 (Blue) types a chat message containing -ally red as An exact match
Player - Player 3 (Teal) types a chat message containing -ally red as An exact match
Player - Player 4 (Purple) types a chat message containing -ally red as An exact match
Player - Player 5 (Yellow) types a chat message containing -ally red as An exact match
Player - Player 6 (Orange) types a chat message containing -ally red as An exact match
Player - Player 7 (Green) types a chat message containing -ally red as An exact match
Player - Player 8 (Pink) types a chat message containing -ally red as An exact match
Player - Player 9 (Gray) types a chat message containing -ally red as An exact match
Player - Player 10 (Light Blue) types a chat message containing -ally red as An exact match
Player - Player 11 (Dark Green) types a chat message containing -ally red as An exact match
Player - Player 12 (Brown) types a chat message containing -ally red as An exact match
Conditions
((Triggering player) is an ally of Player 1 (Red)) Equal to False
Actions
Player - Make (Triggering player) treat Player 1 (Red) as an Ally with shared vision
Player - Make Player 1 (Red) treat (Triggering player) as an Ally with shared vision
Set allies = (All allies of (Triggering player))
Set int = (Integer((300.00 / (Real((Number of players in allies))))))
Player Group - Pick every player in allies and do (Actions)
Loop - Actions
Player - Set (Picked player) Food max to int
Player - Set (Picked player) Food used to (((Picked player) Food used) + 1)
Player - Set (Picked player) Food used to (((Picked player) Food used) - 1)
Custom script: call DestroyForce(udg_allies)
-------- --------------------------------------------------------------- --------
-------- Here is the part where you update your multiboard --------
Then you just copy it 11 times for other players.
ooooh nice