• Listen to a special audio message from Bill Roper to the Hive Workshop community (Bill is a former Vice President of Blizzard Entertainment, Producer, Designer, Musician, Voice Actor) 🔗Click here to hear his message!
  • Read Evilhog's interview with Gregory Alper, the original composer of the music for WarCraft: Orcs & Humans 🔗Click here to read the full interview.

(Please Help!) Chat Commands

Status
Not open for further replies.
Level 2
Joined
Mar 18, 2012
Messages
13
Example of a trigger I would like to make:

The player types "color yellow" and the team color of the selected unit turns to yellow.

The problem is I can't get it to work.

Can anyone please help me??

Thanks for taking the time to read.
 
Level 2
Joined
Mar 18, 2012
Messages
13
Is there a way to change the color of a specific unit?

I'm not sure if you've heard of a WC3 game called DOBRP, but as I recall, you could change the color of a specific unit using a chat command.
 
Level 16
Joined
Mar 3, 2006
Messages
1,564
I'm sorry. But how did you make "Unit group - Pick every units in..." is that an action?

I will post the trigger in a few minutes, expect an edit.

<<< EDIT >>>

  • Initialization
    • Events
      • Map initialization
    • Conditions
    • Actions
      • Set i = 1
      • Set ColorString[i] = color red
      • Set Color[i] = Red
      • Set Player[i] = Player 1 (Red)
      • Set i = (i + 1)
      • Set ColorString[i] = color blue
      • Set Color[i] = Blue
      • Set Player[i] = Player 2 (Blue)
      • Set i = (i + 1)
      • Set ColorString[i] = color teal
      • Set Color[i] = Teal
      • Set Player[i] = Player 3 (Teal)
      • Set i = (i + 1)
      • Set ColorString[i] = color purple
      • Set Color[i] = Purple
      • Set Player[i] = Player 4 (Purple)
      • Set i = (i + 1)
      • Set ColorString[i] = color yellow
      • Set Color[i] = Yellow
      • Set Player[i] = Player 5 (Yellow)
      • Set i = (i + 1)
      • Set ColorString[i] = color orange
      • Set Color[i] = Orange
      • Set Player[i] = Player 6 (Orange)
      • Set i = (i + 1)
      • Set ColorString[i] = color green
      • Set Color[i] = Green
      • Set Player[i] = Player 7 (Green)
      • Set i = (i + 1)
      • Set ColorString[i] = color pink
      • Set Color[i] = Pink
      • Set Player[i] = Player 8 (Pink)
      • -------- Add all the color, color string and players you need --------
      • For each (Integer A) from 1 to i, do (Actions)
        • Loop - Actions
          • For each (Integer B) from 1 to i, do (Actions)
            • Loop - Actions
              • Trigger - Add to Change Color <gen> the event (Player - Player[(Integer A)] types a chat message containing ColorString[(Integer B)] as An exact match)
  • Change Color
    • Events
    • Conditions
    • Actions
      • For each (Integer A) from 1 to 12, do (Actions)
        • Loop - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • (Entered chat string) Equal to ColorString[(Integer A)]
            • Then - Actions
              • Player - Change color of (Triggering player) to Color[(Integer A)], Changing color of existing units
            • Else - Actions
 
Level 2
Joined
Mar 18, 2012
Messages
13
Thanks! I will try it out in a couple of hours when I get home from work, and let you know how it turned out for me. Any suggestions on what the chat command event should be?
 
Level 16
Joined
Mar 3, 2006
Messages
1,564
What does he mean by that?

You don't need to add the variable Player[x] to the triggers.

Its something like that

  • Init
    • Events
      • Map initialization
    • Conditions
    • Actions
      • Set i = 1
      • Set ColorString[i] = color red
      • Set Color[i] = Red
      • Set i = (i + 1)
      • Set ColorString[i] = color blue
      • Set Color[i] = Blue
      • Set i = (i + 1)
      • Set ColorString[i] = color teal
      • Set Color[i] = Teal
      • Set i = (i + 1)
      • Set ColorString[i] = color purple
      • Set Color[i] = Purple
      • Set i = (i + 1)
      • Set ColorString[i] = color yellow
      • Set Color[i] = Yellow
      • Set i = (i + 1)
      • Set ColorString[i] = color orange
      • Set Color[i] = Orange
      • Set i = (i + 1)
      • Set ColorString[i] = color green
      • Set Color[i] = Green
      • Set i = (i + 1)
      • Set ColorString[i] = color pink
      • Set Color[i] = Pink
      • -------- Add all the color, color string and players you need --------
      • For each (Integer A) from 1 to i, do (Actions)
        • Loop - Actions
          • For each (Integer B) from 1 to i, do (Actions)
            • Loop - Actions
              • Trigger - Add to Change Color <gen> the event (Player - (Player((Integer A))) types a chat message containing ColorString[(Integer B)] as An exact match)
In the loop action I don't have to use a variable all I need to do is to click on the drop down list and select
_______________________________________
|Conversion - Convert Player Index To Player|
¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯
 
Level 26
Joined
Aug 18, 2009
Messages
4,097
  • Initialization
    • Events
      • Map initialization
    • Conditions
    • Actions
      • Set ColorString[1] = red
      • Set ColorString[2] = blue
      • Set ColorString[3] = teal
      • Set ColorString[4] = purple
      • Set ColorString[5] = yellow
      • Set ColorString[6] = orange
      • Set ColorString[7] = green
      • Set ColorString[8] = pink
      • -------- Add all the color, color string and players you need --------
      • Set i = 8 or what the amount of players is
      • For each (Integer A) from 1 to i, do (Actions)
        • Loop - Actions
          • Set ColorString[(Integer A)] = (color + ColorString[(Integer A)])
          • For each (Integer B) from 1 to i, do (Actions)
            • Loop - Actions
              • Trigger - Add to Change Color <gen> the event (Player - (Player((Integer B))) types a chat message containing ColorString[(Integer A)] as An exact match)
  • Change Color
    • Events
    • Conditions
    • Actions
      • For each (Integer A) from 1 to i, do (Actions)
        • Loop - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • (Entered chat string) Equal to ColorString[(Integer A)]
            • Then - Actions
              • Unit Group - Pick every unit in (Units currently selected by (Triggering player)) and do (Actions)
                • Loop - Actions
                  • Unit - Change color of (Picked unit) to (Color of (Player((Integer A))))
            • Else - Actions
 
Level 16
Joined
Mar 3, 2006
Messages
1,564
  • Actions
    • For each (Integer A) from 1 to i, do (Actions)
      • Loop - Actions
        • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
          • If - Conditions
            • (Entered chat string) Equal to ColorString[(Integer A)]
          • Then - Actions
            • Unit Group - Pick every unit in (Units currently selected by (Triggering player)) and do (Actions)
              • Loop - Actions
                • Unit - Change color of (Picked unit) to (Color of (Player((Integer A))))
          • Else - Actions

Why do you need to pick every unit, that will leak a group, don't you think ?
 
Level 16
Joined
Mar 3, 2006
Messages
1,564
Surely. This is what TC wanted, only the selected units shall change color, not the player or his/her other units. It does leak a group but it's marginally, the event is not frequent and GUI users do not get it anyway.

He want selected unit only, ok. I didn't notice that besides leaks can be easily removed in this case.

OK, thanks for the clarification.
 
Status
Not open for further replies.
Top