• 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.

ally

Level 2
Joined
Nov 21, 2024
Messages
3
Hi, I'm making map where player 1 can control all 23 players.
Is there any way to control their ally between them in game?
like: player 2 and player 4 will by ally now
or player 2 and player 4 will be enemy now
 

Uncle

Warcraft Moderator
Level 73
Joined
Aug 10, 2018
Messages
7,866
Hello, it's a Player action called Set Alliance:
  • Ally Example
    • Events
      • Player - Player 1 (Red) types a chat message containing ally as An exact match
    • Conditions
    • Actions
      • Player - Make Player 2 (Blue) treat Player 4 (Purple) as an Ally with shared vision
      • Player - Make Player 4 (Purple) treat Player 2 (Blue) as an Ally with shared vision
  • Enemy Example
    • Events
      • Player - Player 1 (Red) types a chat message containing enemy as An exact match
    • Conditions
    • Actions
      • Player - Make Player 2 (Blue) treat Player 4 (Purple) as an Enemy
      • Player - Make Player 4 (Purple) treat Player 2 (Blue) as an Enemy
Edit or add your own Events/Actions to the Triggers to customize them further.
 

Attachments

  • Triggers.w3m
    16.7 KB · Views: 3
Level 2
Joined
Nov 21, 2024
Messages
3
Hello, it's a Player action called Set Alliance:
  • Ally Example
    • Events
      • Player - Player 1 (Red) types a chat message containing ally as An exact match
    • Conditions
    • Actions
      • Player - Make Player 2 (Blue) treat Player 4 (Purple) as an Ally with shared vision
      • Player - Make Player 4 (Purple) treat Player 2 (Blue) as an Ally with shared vision
  • Enemy Example
    • Events
      • Player - Player 1 (Red) types a chat message containing enemy as An exact match
    • Conditions
    • Actions
      • Player - Make Player 2 (Blue) treat Player 4 (Purple) as an Enemy
      • Player - Make Player 4 (Purple) treat Player 2 (Blue) as an Enemy
Edit or add your own Events/Actions to the Triggers to customize them further.
thanks but i already have this.

I wrote my question bad
i wanted some system which allow me to make ally in the game

like: if i type -ally playerA and playerB in chat as player1
after that they will be ally
 

Uncle

Warcraft Moderator
Level 73
Joined
Aug 10, 2018
Messages
7,866
Use the Substring function:
  • Ally Example
    • Events
      • Player - Player 1 (Red) types a chat message containing -ally as A substring
    • Conditions
    • Actions
      • Set Variable Str = (Entered chat string)
      • Set Variable PN1 = (Integer(Substring(Str, 7, 8)))
      • Set Variable PN2 = (Integer(Substring(Str, 9, 10)))
      • Player - Make Player(PN1) treat Player(PN2) as an Ally with shared vision
      • Player - Make Player(PN2) treat Player(PN1) as an Ally with shared vision
That will convert the 7th-8th character in the string to an Integer (PN1) and the 9th-10th character in the string to an Integer (PN2).

So if you type "-ally 2 4" it will make Player 2 and Player 4 allied. Spaces are counted as a character in the strings.

You will likely want to confirm that PN1 and PN2 are actually valid before you change the alliance settings.
  • If all Conditions are True then (do Actions)
    • If - Conditions
      • Or - Multiple conditions
        • PN1 Less than 1
        • PN2 Less than 1
    • Then - Actions
      • Skip remaining actions
    • Else - Conditions
You may need to have a special exception for single digit Player Numbers since converting something like "1 " may actually fail due to the extra space. Some more If Then Else statements could solve this.
 
Last edited:
Level 2
Joined
Nov 21, 2024
Messages
3
Use the Substring function:
  • Ally Example
    • Events
      • Player - Player 1 (Red) types a chat message containing -ally as A substring
    • Conditions
    • Actions
      • Set Variable Str = (Entered chat string)
      • Set Variable PN1 = (Integer(Substring(Str, 7, 8)))
      • Set Variable PN2 = (Integer(Substring(Str, 9, 10)))
      • Player - Make Player(PN1) treat Player(PN2) as an Ally with shared vision
      • Player - Make Player(PN2) treat Player(PN1) as an Ally with shared vision
That will convert the 7th-8th character in the string to an Integer (PN1) and the 9th-10th character in the string to an Integer (PN2).

So if you type "-ally 2 4" it will make Player 2 and Player 4 allied. Spaces are counted as a character in the strings.

You will likely want to confirm that PN1 and PN2 are actually valid before you change the alliance settings.
  • If all Conditions are True then (do Actions)
    • If - Conditions
      • Or - Multiple conditions
        • PN1 Less than 1
        • PN2 Less than 1
    • Then - Actions
      • Skip remaining actions
    • Else - Conditions
You may need to have a special exception for single digit Player Numbers since converting something like "1 " may actually fail due to the extra space. Some more If Then Else statements could solve this.
sorry for disturbing you with that but could you send me a simple map file with that code? I relly dont know how to do it in Editor .
also idk if it will makes any difference but my map is for 24 players
but no one control them (no computer and no real players) just me as player 1.
its for role play map hah
 
Last edited:

Uncle

Warcraft Moderator
Level 73
Joined
Aug 10, 2018
Messages
7,866
sorry for disturbing you with that but could you send me a simple map file with that code? I relly dont know how to do it in Editor .
also idk if it will makes any difference but my map is for 24 players
but no one control them (no computer and no real players) just me as player 1.
its for role play map hah
That's fine, it's an easy trigger to make:
  • Ally Example
    • Events
      • Player - Player 1 (Red) types a chat message containing -ally as A substring
    • Conditions
    • Actions
      • Set VariableSet ACS_String = (Entered chat string)
      • Set VariableSet ACS_PN[1] = 0
      • Set VariableSet ACS_PN[2] = 0
      • Set VariableSet ACS_PN[1] = (Integer((Substring(ACS_String, 7, 8))))
      • Set VariableSet ACS_PN[2] = (Integer((Substring(ACS_String, 9, (Length of ACS_String)))))
      • -------- --------
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • Or - Any (Conditions) are true
            • Conditions
              • ACS_PN[1] Less than or equal to 0
              • ACS_PN[2] Less than or equal to 0
        • Then - Actions
          • -------- ERROR! You typed the wrong string or wrong player numbers! --------
          • Game - Display to (All players) for 5.00 seconds the text: |cff808080Invalid a...
          • Skip remaining actions
        • Else - Actions
      • -------- --------
      • Set VariableSet ACS_Player[1] = (Player(ACS_PN[1]))
      • Set VariableSet ACS_Player[2] = (Player(ACS_PN[2]))
      • Player - Make ACS_Player[1] treat ACS_Player[2] as an Ally with shared vision
      • Player - Make ACS_Player[2] treat ACS_Player[1] as an Ally with shared vision
      • Game - Display to (All players) for 5.00 seconds the text: ((Name of ACS_Player[1]) + ( is now |cff00ff00allied|r with + (Name of ACS_Player[2])))
  • Enemy Example
    • Events
      • Player - Player 1 (Red) types a chat message containing -enemy as A substring
    • Conditions
    • Actions
      • Set VariableSet ACS_String = (Entered chat string)
      • Set VariableSet ACS_PN[1] = 0
      • Set VariableSet ACS_PN[2] = 0
      • Set VariableSet ACS_PN[1] = (Integer((Substring(ACS_String, 8, 9))))
      • Set VariableSet ACS_PN[2] = (Integer((Substring(ACS_String, 10, (Length of ACS_String)))))
      • -------- --------
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • Or - Any (Conditions) are true
            • Conditions
              • ACS_PN[1] Less than or equal to 0
              • ACS_PN[2] Less than or equal to 0
        • Then - Actions
          • -------- ERROR! You typed the wrong string or wrong player numbers! --------
          • Game - Display to (All players) for 5.00 seconds the text: |cff808080Invalid a...
          • Skip remaining actions
        • Else - Actions
      • -------- --------
      • Set VariableSet ACS_Player[1] = (Player(ACS_PN[1]))
      • Set VariableSet ACS_Player[2] = (Player(ACS_PN[2]))
      • Player - Make ACS_Player[1] treat ACS_Player[2] as an Enemy
      • Player - Make ACS_Player[2] treat ACS_Player[1] as an Enemy
      • Game - Display to (All players) for 5.00 seconds the text: ((Name of ACS_Player[1]) + ( is now |cffff0000enemies|r with + (Name of ACS_Player[2])))
 

Attachments

  • Triggers 2.w3m
    25.1 KB · Views: 4
Top