• 🏆 Texturing Contest #33 is OPEN! Contestants must re-texture a SD unit model found in-game (Warcraft 3 Classic), recreating the unit into a peaceful NPC version. 🔗Click here to enter!

[Trigger] In game alliances using dialogue boxes

Status
Not open for further replies.
Level 3
Joined
Dec 24, 2007
Messages
29
Hi! I'm new to this forum, but I've been mapping for a few weeks now...

Here is my problem, I want to make an in game chat alliance system (i.e. someone types -ally blue). I want the trigger (or triggers since it probably won't fit into one) to pop up a dialogue window for the player receiving the alliance proposition with an "accept" and "reject" option. I'm running into dead ends trying to do this myself and I searched this forum a few times to see if the question has been asked before but nothing turned up. Any help is appreciated.
 
Level 3
Joined
Dec 24, 2007
Messages
29
I think I know what substrings are... When I type "-ally red", "-ally" and "red" would be substrings?
 
Level 29
Joined
Jul 29, 2007
Messages
5,174
Ok I think this should work (can't test it because need more players).

That dialog was a real pain but what ever... you'll need to deal with it not me ^^
This is for 4 players, think about 8/10/12 players lol.

And yes you are right about the substrings.

Anyway here it is
[Things you need to know about for basic understanding]
Variables
Loops
Substrings
Arrays
A lot of patience making this trigger for more players :p

[Variables used]
dialog - dialog variable, arrayed
dialogbuttons - dialog button variable, arrayed

  • Init
    • Events
      • Map initialization
    • Conditions
    • Actions
      • For each (Integer A) from 1 to 16, do (Actions)
        • Loop - Actions
          • Dialog - Create a dialog button for dialog[(Integer A)] labelled Agree
          • Set dialogbuttons[(Integer A)] = (Last created dialog Button)
      • For each (Integer A) from 17 to 32, do (Actions)
        • Loop - Actions
          • Dialog - Create a dialog button for dialog[((Integer A) - 16)] labelled Refuse
          • Set dialogbuttons[(Integer A)] = (Last created dialog Button)
  • Typing
    • Events
      • Player - Player 1 (Red) types a chat message containing -ally as A substring
      • Player - Player 2 (Blue) types a chat message containing -ally as A substring
      • Player - Player 3 (Teal) types a chat message containing -ally as A substring
      • Player - Player 4 (Purple) types a chat message containing -ally as A substring
    • Conditions
      • (Substring((Entered chat string), 1, 5)) Equal to -ally
    • Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Substring((Entered chat string), 7, 9)) Equal to red
        • Then - Actions
          • Dialog - Show dialog[(Player number of (Triggering player))] for Player 1 (Red)
        • Else - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • (Substring((Entered chat string), 7, 10)) Equal to blue
            • Then - Actions
              • Dialog - Show dialog[((Player number of (Triggering player)) + 4)] for Player 2 (Blue)
            • Else - Actions
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • (Substring((Entered chat string), 7, 10)) Equal to teal
                • Then - Actions
                  • Dialog - Show dialog[((Player number of (Triggering player)) + 8)] for Player 3 (Teal)
                • Else - Actions
                  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    • If - Conditions
                      • (Substring((Entered chat string), 7, 12)) Equal to purple
                    • Then - Actions
                      • Dialog - Show dialog[((Player number of (Triggering player)) + 12)] for Player 4 (Purple)
                    • Else - Actions
  • Buttons clicked
    • Events
      • Dialog - A dialog button is clicked for dialog[1]
      • Dialog - A dialog button is clicked for dialog[2]
      • Dialog - A dialog button is clicked for dialog[3]
      • Dialog - A dialog button is clicked for dialog[4]
      • Dialog - A dialog button is clicked for dialog[5]
      • Dialog - A dialog button is clicked for dialog[6]
      • Dialog - A dialog button is clicked for dialog[7]
      • Dialog - A dialog button is clicked for dialog[8]
      • Dialog - A dialog button is clicked for dialog[9]
      • Dialog - A dialog button is clicked for dialog[10]
      • Dialog - A dialog button is clicked for dialog[11]
      • Dialog - A dialog button is clicked for dialog[12]
      • Dialog - A dialog button is clicked for dialog[13]
      • Dialog - A dialog button is clicked for dialog[14]
      • Dialog - A dialog button is clicked for dialog[15]
      • Dialog - A dialog button is clicked for dialog[16]
    • Conditions
    • Actions
      • For each (Integer A) from 1 to 4, do (Actions)
        • Loop - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • (Clicked dialog button) Equal to dialogbuttons[(Integer A)]
            • Then - Actions
              • Player - Make Player 1 (Red) treat (Player((Integer A))) as an Ally with shared vision
              • Player - Make (Player((Integer A))) treat Player 1 (Red) as an Ally with shared vision
            • Else - Actions
      • For each (Integer A) from 5 to 8, do (Actions)
        • Loop - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • (Clicked dialog button) Equal to dialogbuttons[(Integer A)]
            • Then - Actions
              • Player - Make Player 2 (Blue) treat (Player(((Integer A) - 4))) as an Ally with shared vision
              • Player - Make (Player(((Integer A) - 4))) treat Player 2 (Blue) as an Ally with shared vision
            • Else - Actions
      • For each (Integer A) from 9 to 12, do (Actions)
        • Loop - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • (Clicked dialog button) Equal to dialogbuttons[(Integer A)]
            • Then - Actions
              • Player - Make Player 3 (Teal) treat (Player(((Integer A) - 8))) as an Ally with shared vision
              • Player - Make (Player(((Integer A) - 8))) treat Player 3 (Teal) as an Ally with shared vision
            • Else - Actions
      • For each (Integer A) from 13 to 16, do (Actions)
        • Loop - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • (Clicked dialog button) Equal to dialogbuttons[(Integer A)]
            • Then - Actions
              • Player - Make Player 4 (Purple) treat (Player(((Integer A) - 12))) as an Ally with shared vision
              • Player - Make (Player(((Integer A) - 12))) treat Player 4 (Purple) as an Ally with shared vision
            • Else - Actions
      • For each (Integer A) from 17 to 20, do (Actions)
        • Loop - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • (Clicked dialog button) Equal to dialogbuttons[(Integer A)]
            • Then - Actions
              • Game - Display to (Player group((Player(((Integer A) - 16))))) the text: Player 1 has refuse...
              • Player - Make Player 1 (Red) treat (Player(((Integer A) - 16))) as an Enemy
              • Player - Make (Player(((Integer A) - 16))) treat Player 1 (Red) as an Enemy
            • Else - Actions
      • For each (Integer A) from 21 to 24, do (Actions)
        • Loop - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • (Clicked dialog button) Equal to dialogbuttons[(Integer A)]
            • Then - Actions
              • Game - Display to (Player group((Player(((Integer A) - 20))))) the text: Player 2 has refuse...
              • Player - Make Player 2 (Blue) treat (Player(((Integer A) - 20))) as an Enemy
              • Player - Make (Player(((Integer A) - 20))) treat Player 2 (Blue) as an Enemy
            • Else - Actions
      • For each (Integer A) from 25 to 28, do (Actions)
        • Loop - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • (Clicked dialog button) Equal to dialogbuttons[(Integer A)]
            • Then - Actions
              • Game - Display to (Player group((Player(((Integer A) - 24))))) the text: Player 3 has refuse...
              • Player - Make Player 3 (Teal) treat (Player(((Integer A) - 24))) as an Enemy
              • Player - Make (Player(((Integer A) - 24))) treat Player 3 (Teal) as an Enemy
            • Else - Actions
      • For each (Integer A) from 29 to 32, do (Actions)
        • Loop - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • (Clicked dialog button) Equal to dialogbuttons[(Integer A)]
            • Then - Actions
              • Game - Display to (Player group((Player(((Integer A) - 28))))) the text: Player 4 has refuse...
              • Player - Make Player 4 (Purple) treat (Player(((Integer A) - 28))) as an Enemy
              • Player - Make (Player(((Integer A) - 28))) treat Player 4 (Purple) as an Enemy
            • Else - Actions

Pretty long isn't it...
 
Level 3
Joined
Dec 24, 2007
Messages
29
I just tried this and it did not work. It didn't even trigger when I typed (I tried this with a friend).

There is a map I've seen that has this but it is protected unfortunately... I wish I could get in there and get the triggers but I don't have a working unprotecter or the unprotected version. Map = Heroes and Empries
 
Level 3
Joined
Dec 24, 2007
Messages
29
Yes I tried that. I even reviewed the triggers, its word for word what you said to put in.
 
Level 17
Joined
Jun 17, 2007
Messages
1,433
Ok I think this should work (can't test it because need more players).

That dialog was a real pain but what ever... you'll need to deal with it not me ^^
This is for 4 players, think about 8/10/12 players lol.

And yes you are right about the substrings.

Anyway here it is
[Things you need to know about for basic understanding]
Variables
Loops
Substrings
Arrays
A lot of patience making this trigger for more players :p

[Variables used]
dialog - dialog variable, arrayed
dialogbuttons - dialog button variable, arrayed

  • Init
    • Events
      • Map initialization
    • Conditions
    • Actions
      • For each (Integer A) from 1 to 16, do (Actions)
        • Loop - Actions
          • Dialog - Create a dialog button for dialog[(Integer A)] labelled Agree
          • Set dialogbuttons[(Integer A)] = (Last created dialog Button)
      • For each (Integer A) from 17 to 32, do (Actions)
        • Loop - Actions
          • Dialog - Create a dialog button for dialog[((Integer A) - 16)] labelled Refuse
          • Set dialogbuttons[(Integer A)] = (Last created dialog Button)
  • Typing
    • Events
      • Player - Player 1 (Red) types a chat message containing -ally as A substring
      • Player - Player 2 (Blue) types a chat message containing -ally as A substring
      • Player - Player 3 (Teal) types a chat message containing -ally as A substring
      • Player - Player 4 (Purple) types a chat message containing -ally as A substring
    • Conditions
      • (Substring((Entered chat string), 1, 5)) Equal to -ally
    • Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Substring((Entered chat string), 7, 9)) Equal to red
        • Then - Actions
          • Dialog - Show dialog[(Player number of (Triggering player))] for Player 1 (Red)
        • Else - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • (Substring((Entered chat string), 7, 10)) Equal to blue
            • Then - Actions
              • Dialog - Show dialog[((Player number of (Triggering player)) + 4)] for Player 2 (Blue)
            • Else - Actions
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • (Substring((Entered chat string), 7, 10)) Equal to teal
                • Then - Actions
                  • Dialog - Show dialog[((Player number of (Triggering player)) + 8)] for Player 3 (Teal)
                • Else - Actions
                  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    • If - Conditions
                      • (Substring((Entered chat string), 7, 12)) Equal to purple
                    • Then - Actions
                      • Dialog - Show dialog[((Player number of (Triggering player)) + 12)] for Player 4 (Purple)
                    • Else - Actions
  • Buttons clicked
    • Events
      • Dialog - A dialog button is clicked for dialog[1]
      • Dialog - A dialog button is clicked for dialog[2]
      • Dialog - A dialog button is clicked for dialog[3]
      • Dialog - A dialog button is clicked for dialog[4]
      • Dialog - A dialog button is clicked for dialog[5]
      • Dialog - A dialog button is clicked for dialog[6]
      • Dialog - A dialog button is clicked for dialog[7]
      • Dialog - A dialog button is clicked for dialog[8]
      • Dialog - A dialog button is clicked for dialog[9]
      • Dialog - A dialog button is clicked for dialog[10]
      • Dialog - A dialog button is clicked for dialog[11]
      • Dialog - A dialog button is clicked for dialog[12]
      • Dialog - A dialog button is clicked for dialog[13]
      • Dialog - A dialog button is clicked for dialog[14]
      • Dialog - A dialog button is clicked for dialog[15]
      • Dialog - A dialog button is clicked for dialog[16]
    • Conditions
    • Actions
      • For each (Integer A) from 1 to 4, do (Actions)
        • Loop - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • (Clicked dialog button) Equal to dialogbuttons[(Integer A)]
            • Then - Actions
              • Player - Make Player 1 (Red) treat (Player((Integer A))) as an Ally with shared vision
              • Player - Make (Player((Integer A))) treat Player 1 (Red) as an Ally with shared vision
            • Else - Actions
      • For each (Integer A) from 5 to 8, do (Actions)
        • Loop - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • (Clicked dialog button) Equal to dialogbuttons[(Integer A)]
            • Then - Actions
              • Player - Make Player 2 (Blue) treat (Player(((Integer A) - 4))) as an Ally with shared vision
              • Player - Make (Player(((Integer A) - 4))) treat Player 2 (Blue) as an Ally with shared vision
            • Else - Actions
      • For each (Integer A) from 9 to 12, do (Actions)
        • Loop - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • (Clicked dialog button) Equal to dialogbuttons[(Integer A)]
            • Then - Actions
              • Player - Make Player 3 (Teal) treat (Player(((Integer A) - 8))) as an Ally with shared vision
              • Player - Make (Player(((Integer A) - 8))) treat Player 3 (Teal) as an Ally with shared vision
            • Else - Actions
      • For each (Integer A) from 13 to 16, do (Actions)
        • Loop - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • (Clicked dialog button) Equal to dialogbuttons[(Integer A)]
            • Then - Actions
              • Player - Make Player 4 (Purple) treat (Player(((Integer A) - 12))) as an Ally with shared vision
              • Player - Make (Player(((Integer A) - 12))) treat Player 4 (Purple) as an Ally with shared vision
            • Else - Actions
      • For each (Integer A) from 17 to 20, do (Actions)
        • Loop - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • (Clicked dialog button) Equal to dialogbuttons[(Integer A)]
            • Then - Actions
              • Game - Display to (Player group((Player(((Integer A) - 16))))) the text: Player 1 has refuse...
              • Player - Make Player 1 (Red) treat (Player(((Integer A) - 16))) as an Enemy
              • Player - Make (Player(((Integer A) - 16))) treat Player 1 (Red) as an Enemy
            • Else - Actions
      • For each (Integer A) from 21 to 24, do (Actions)
        • Loop - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • (Clicked dialog button) Equal to dialogbuttons[(Integer A)]
            • Then - Actions
              • Game - Display to (Player group((Player(((Integer A) - 20))))) the text: Player 2 has refuse...
              • Player - Make Player 2 (Blue) treat (Player(((Integer A) - 20))) as an Enemy
              • Player - Make (Player(((Integer A) - 20))) treat Player 2 (Blue) as an Enemy
            • Else - Actions
      • For each (Integer A) from 25 to 28, do (Actions)
        • Loop - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • (Clicked dialog button) Equal to dialogbuttons[(Integer A)]
            • Then - Actions
              • Game - Display to (Player group((Player(((Integer A) - 24))))) the text: Player 3 has refuse...
              • Player - Make Player 3 (Teal) treat (Player(((Integer A) - 24))) as an Enemy
              • Player - Make (Player(((Integer A) - 24))) treat Player 3 (Teal) as an Enemy
            • Else - Actions
      • For each (Integer A) from 29 to 32, do (Actions)
        • Loop - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • (Clicked dialog button) Equal to dialogbuttons[(Integer A)]
            • Then - Actions
              • Game - Display to (Player group((Player(((Integer A) - 28))))) the text: Player 4 has refuse...
              • Player - Make Player 4 (Purple) treat (Player(((Integer A) - 28))) as an Enemy
              • Player - Make (Player(((Integer A) - 28))) treat Player 4 (Purple) as an Enemy
            • Else - Actions
Pretty long isn't it...
Why do you need 16 dialogs? I can only see a reason to have a maximum of 12.
 
Status
Not open for further replies.
Top