• 🏆 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!
  • It's time for the first HD Modeling Contest of 2024. Join the theme discussion for Hive's HD Modeling Contest #6! Click here to post your idea!

Ally system

Status
Not open for further replies.
Level 2
Joined
Mar 24, 2011
Messages
12
Hey i'm making a map where i want an ally system so when a player ex. type
-ally blue blue will then have to confirm this so the player can't just
ally everyone because that would be very anoying is it possible to make
this and if can you show me an example???
That would be great.
THX.
 
Is this what your looking for?
set variables
  • Initialization
    • Events
      • Map initialization
    • Conditions
    • Actions
      • Set ControlColor[1] = red
      • Set ControlColor[2] = blue
      • Set ControlColor[3] = teal
      • Set ControlColor[4] = purple
set alliance
  • ally
    • 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
    • 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
              • Or - Any (Conditions) are true
                • Conditions
                  • (Entered chat string) Equal to (-ally + (String((Integer A))))
                  • (Entered chat string) Equal to (-ally + ControlColor[(Integer A)])
            • Then - Actions
              • Player - Make (Triggering player) treat (Player((Player number of (Triggering player)))) as an Ally with shared vision
            • Else - Actions
make enemy
  • enemy
    • Events
      • Player - Player 1 (Red) types a chat message containing -enemy as A substring
      • Player - Player 2 (Blue) types a chat message containing -enemy as A substring
      • Player - Player 3 (Teal) types a chat message containing -enemy as A substring
      • Player - Player 4 (Purple) types a chat message containing -enemy as A substring
    • 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
              • Or - Any (Conditions) are true
                • Conditions
                  • (Entered chat string) Equal to (-enemy + (String((Integer A))))
                  • (Entered chat string) Equal to (-enemy + ControlColor[(Integer A)])
            • Then - Actions
              • Player - Make (Triggering player) treat (Player((Player number of (Triggering player)))) as an Enemy
            • Else - Actions
you will have to type -ally players number or color and same with making them your enemy -enemy players number or color.
In a map :D http://www.hiveworkshop.com/forums/pastebin_data/p8ohek/_files/Ally by text.w3xhttp://www.hiveworkshop.com/forums/pastebin_data/p8ohek/_files/Ally by text.w3x hope all the effort was usefull to you :)
http://www.hiveworkshop.com/forums/pastebin_data/p8ohek/_files/Ally by text.w3x
edit: I think you'll need someone else to test it with or just use another computer but it should work:p
 
Last edited:
Level 2
Joined
Mar 24, 2011
Messages
12
Is this what your looking for?
set variables
Initialization
Events
Map initialization
Conditions
Actions
Set ControlColor[1] = red
Set ControlColor[2] = blue
Set ControlColor[3] = teal
Set ControlColor[4] = purple
set alliance
ally
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
Actions
For each (Integer A) from 1 to 10, do (Actions)
Loop - Actions
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
Or - Any (Conditions) are true
Conditions
(Entered chat string) Equal to (-ally + (String((Integer A))))
(Entered chat string) Equal to (-ally + ControlColor[(Integer A)])
Then - Actions
Player - Make (Triggering player) treat (Player((Player number of (Triggering player)))) as an Ally with shared vision
Else - Actions
make enemy
enemy
Events
Player - Player 1 (Red) types a chat message containing -enemy as A substring
Player - Player 2 (Blue) types a chat message containing -enemy as A substring
Player - Player 3 (Teal) types a chat message containing -enemy as A substring
Player - Player 4 (Purple) types a chat message containing -enemy as A substring
Conditions
Actions
For each (Integer A) from 1 to 10, do (Actions)
Loop - Actions
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
Or - Any (Conditions) are true
Conditions
(Entered chat string) Equal to (-enemy + (String((Integer A))))
(Entered chat string) Equal to (-enemy + ControlColor[(Integer A)])
Then - Actions
Player - Make (Triggering player) treat (Player((Player number of (Triggering player)))) as an Enemy
Else - Actions
you will have to type -ally players number or color and same with making them your enemy -enemy players number or color.
In a map :Dhttp://www.hiveworkshop.com/forums/p...0by%20text.w3x hope all the effort was usefull to you :)

edit: I think you'll need someone else to test it with or just use another computer but it should work:p
what to write when you play with another computer/player i cant get it working wasn't it -ally blue and then blue had to type -ally red???
 
Level 7
Joined
Dec 26, 2010
Messages
401
what to write when you play with another computer/player i cant get it working wasn't it -ally blue and then blue had to type -ally red???

With a computer you can't do dialogs, seeing as they don't click, you'd have to do a player controller comparison in there to detect a computer and automatically ally up if the player types -ally blue and blue is a computer.

  • Events:
    • Player - (Triggering player) enters a message with (-ally blue) as a substring
  • Conditions:
  • Actions:
    • Trigger - Turn on (Ally Blue)
  • Events:
    • Time - Elapsed time is 1 second
  • Conditions:
  • Actions:
    • If all (Conditions are True) then do (Then Actions) else do (Else actions)
      • Conditions:
        • Player - ((Player 2 Blue) Controller) Equal to User
      • Then - Actions:
        • Run your dialog here.
      • Else - Actions:
        • If all (Conditions are True) then do (Then Actions) else do (Else actions)
          • Conditions:
            • Player - ((Player 2 Blue) Controller) Equal to Computer
          • Then - Actions:
            • Player - Make (Player 2 Blue) treat (Player 1 Red) as an (Ally with shared vision)
          • Else - Actions:
            • Do Nothing
There's a more efficient way of doing that, I'm not too trigger savy, but there'll be someone who'll come by that'll fix that up to be one trigger that's MUI.
 
Level 2
Joined
Mar 24, 2011
Messages
12
sory i think we missunderstod eachother i meant can you make a system so when i type -ally blue (and you are blue) you'll have to say -ally red before we get allys i know how to make basicly but i dont know how to do this.
THX
 
Level 7
Joined
Dec 26, 2010
Messages
401
In that case, use variables, as a boolean value.
When one player types -ally blue, set their value to true, when the other player types ally red, set their value to true.
Have a trigger that runs every time -ally blue or -ally red is typed to check conditions (both values being equal to true being the condition that fires the trigger) and upon firing the trigger setting each player to alliance status with eachother.
 
ill do what you requested just give me a bit of time :p

edit: ok here it is :D remember this is only for 4 players.

to set variables for typing names by color
  • Initialization
    • Events
      • Map initialization
    • Conditions
    • Actions
      • Set ControlColor[1] = red
      • Set ControlColor[2] = blue
      • Set ControlColor[3] = teal
      • Set ControlColor[4] = purple
To ask and accept an aliance with another player. Can be typed as the players number or color. Remember this trigger only sets the aliance for you and not for your over allies if you have any.
  • ally
    • 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
    • Actions
      • For each (Integer A) from (((Player number of (Triggering player)) x 4) - 4) to ((Player number of (Triggering player)) x 4), do (Actions)
        • Loop - Actions
          • Set SetPlayerTextSend = (SetPlayerTextSend + 1)
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • Or - Any (Conditions) are true
                • Conditions
                  • (Entered chat string) Equal to (-ally + (String((Integer A))))
                  • (Entered chat string) Equal to (-ally + ControlColor[(Integer A)])
            • Then - Actions
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • Or - Any (Conditions) are true
                    • Conditions
                      • Alliance[(Integer A)] Equal to 1
                      • ((Player(SetPlayerTextSend)) controller) Equal to Computer
                • Then - Actions
                  • Set Alliance[(Integer A)] = 2
                  • Player - Make (Triggering player) treat (Player(SetPlayerTextSend)) as an Ally with shared vision
                  • Game - Display to (Player group((Triggering player))) the text: (You now have an aliance with + (Name of (Player(SetPlayerTextSend))))
                  • Set Alliance[(4 x ((Player number of (Player((Integer A)))) - (Player number of (Triggering player))))] = 2
                  • Player - Make (Player(SetPlayerTextSend)) treat (Triggering player) as an Ally with shared vision
                  • Game - Display to (Player group((Player(SetPlayerTextSend)))) the text: ((Name of (Triggering player)) + has accepted your alliance)
                • Else - Actions
                  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    • If - Conditions
                      • Alliance[(Integer A)] Equal to 0
                    • Then - Actions
                      • Set Alliance[(Integer A)] = 1
                      • Game - Display to (Player group((Player(SetPlayerTextSend)))) the text: ((Name of (Triggering player)) + ( wants to set an aliance with you. Type -ally + (ControlColor[SetPlayerTextSend] + ( or + ((String(SetPlayerTextSend)) + to accept.)))))
                    • Else - Actions
            • Else - Actions
This is to make the player your enemy. By doing this the other player does not have to except. But this alliance is for only you and the other player not any other.
  • enemy
    • Events
      • Player - Player 1 (Red) types a chat message containing -enemy as A substring
      • Player - Player 2 (Blue) types a chat message containing -enemy as A substring
      • Player - Player 3 (Teal) types a chat message containing -enemy as A substring
      • Player - Player 4 (Purple) types a chat message containing -enemy as A substring
    • Conditions
    • Actions
      • For each (Integer A) from (((Player number of (Triggering player)) x 4) - 4) to ((Player number of (Triggering player)) x 4), do (Actions)
        • Loop - Actions
          • Set SetPlayerTextSend = (SetPlayerTextSend + 1)
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • Or - Any (Conditions) are true
                • Conditions
                  • (Entered chat string) Equal to (-enemy + (String((Integer A))))
                  • (Entered chat string) Equal to (-enemy + ControlColor[(Integer A)])
            • Then - Actions
              • Set Alliance[(Integer A)] = 0
              • Player - Make (Triggering player) treat (Player(SetPlayerTextSend)) as an Enemy
              • Game - Display to (Player group((Triggering player))) the text: (You are no longer an ally with + (Name of (Player(SetPlayerTextSend))))
              • Set Alliance[(4 x ((Player number of (Player((Integer A)))) - (Player number of (Triggering player))))] = 0
              • Player - Make (Player(SetPlayerTextSend)) treat (Triggering player) as an Enemy
              • Game - Display to (Player group((Player(SetPlayerTextSend)))) the text: ((Name of (Triggering player)) + has set you as an enemy once again)
            • Else - Actions
The map!http://www.hiveworkshop.com/forums/pastebin_data/gmt9jb/_files/Ally by text comfirm.w3x
hopefully this is the final answer:D
 
Last edited:
Level 2
Joined
Mar 24, 2011
Messages
12
sorry but it doesn't work when im trying the map with my brother warcraft closes with an application error
but don't wast more time on it i'll just use my system where you can ally everyone
But thx for trying:thumbs_up:
 
Level 7
Joined
Dec 26, 2010
Messages
401
sorry but it doesn't work when im trying the map with my brother warcraft closes with an application error
but don't wast more time on it i'll just use my system where you can ally everyone
But thx for trying:thumbs_up:

  • Events:
    • Player - (Triggering player) Enters chat message with (-Ally Blue) as a substring.
  • Conditions:
  • Actions:
    • If all (Conditions are True) then do (Then Actions) else do (Else actions)
      • Conditions:
        • (Triggering player) Equal to (Player 1 Red)
      • Then - Actions:
        • Set Ally_Blue[1] = True
        • Trigger - Turn on Red_Blue<gen>
      • Else - Actions:
        • Do Nothing
  • Events:
    • Map Initialization
  • Conditions:
  • Actions:
    • If all (Conditions are True) then do (Then Actions) else do (Else actions)
      • Conditions:
        • Ally_Blue[1] = True
        • Ally_Red[1] = True
      • Then - Actions:
        • Player - Make (Player 1 Red) treat (Player 2 Blue) as an Ally with shared vision
        • Player - Make (Player 2 Blue) treat (Player 1 Red) as an Ally with shared vision
        • Trigger - Turn off (this trigger)
      • Else - Actions:
        • Do Nothing
 

Dr Super Good

Spell Reviewer
Level 64
Joined
Jan 18, 2005
Messages
27,198
Use hashtables to map player strings to players (or their slot numbers). This removes the need for multiple selection and improves the system to O(1) efficency.

You should also add a timer to prevent requests being sent more than once a minute. You should also consider defaulting everyone to allied to prevent mass allience spam early on. That way it will only be a few war declerations from those who want to fight at the start which do not need confirmation (a more polished feel).
 
with the system I made the request can only be sent once until reply but can be egnored if the player doesnt simply respond to wanting to be allied. anyway I forgot to even test to see if itll work and maybe I'll fix because I think it'll be the best system to do this instead of just puting up dialogs to anoy the player and also distract the player from the game itself:xxd:. And remember I don't mind wasting time for other peoples uses:p

edit: heres your final system completely working:thumbs_up:

Pending ally or enemy by text:

Initializing the colors for text
  • Initialization
    • Events
      • Map initialization
    • Conditions
    • Actions
      • Set ControlColor[1] = red
      • Set ControlColor[2] = blue
      • Set ControlColor[3] = teal
      • Set ControlColor[4] = purple
To set a player as ally and is set to pend!
  • ally
    • 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
    • Actions
      • For each (Integer A) from (((Player number of (Triggering player)) x 4) - 3) to ((Player number of (Triggering player)) x 4), do (Actions)
        • Loop - Actions
          • Set SetPlayerTextSend = (SetPlayerTextSend + 1)
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • ((Player(SetPlayerTextSend)) controller) Equal to None
              • Or - Any (Conditions) are true
                • Conditions
                  • ((Player(SetPlayerTextSend)) controller) Equal to User
                  • ((Player(SetPlayerTextSend)) controller) Equal to Computer
              • (Triggering player) Not equal to (Player(SetPlayerTextSend))
              • Or - Any (Conditions) are true
                • Conditions
                  • (Entered chat string) Equal to (-ally + (String(SetPlayerTextSend)))
                  • (Entered chat string) Equal to (-ally + ControlColor[SetPlayerTextSend])
            • Then - Actions
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • Or - Any (Conditions) are true
                    • Conditions
                      • And - All (Conditions) are true
                        • Conditions
                          • Alliance[(Integer A)] Less than 2
                          • ((Player(SetPlayerTextSend)) controller) Equal to Computer
                      • Alliance[(4 x (SetPlayerTextSend - (Player number of (Triggering player))))] Equal to 1
                • Then - Actions
                  • Set Alliance[(Integer A)] = 2
                  • Player - Make (Triggering player) treat (Player(SetPlayerTextSend)) as an Ally with shared vision
                  • Game - Display to (Player group((Triggering player))) the text: (You now have an aliance with + (Name of (Player(SetPlayerTextSend))))
                  • Set Alliance[(4 x ((Player number of (Player((Integer A)))) - (Player number of (Triggering player))))] = 2
                  • Player - Make (Player(SetPlayerTextSend)) treat (Triggering player) as an Ally with shared vision
                  • Game - Display to (Player group((Player(SetPlayerTextSend)))) the text: ((Name of (Triggering player)) + has accepted your alliance)
                • Else - Actions
                  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    • If - Conditions
                      • Alliance[(Integer A)] Equal to 0
                    • Then - Actions
                      • Set Alliance[(Integer A)] = 1
                      • Game - Display to (Player group((Player(SetPlayerTextSend)))) the text: ((Name of (Triggering player)) + ( wants to set an aliance with you. Type -ally + (ControlColor[SetPlayerTextSend] + ( or + ((String(SetPlayerTextSend)) + to accept.)))))
                      • Game - Display to (Player group((Triggering player))) the text: (Your Aliance with + ((Name of (Player(SetPlayerTextSend))) + is now pending))
                    • Else - Actions
            • Else - Actions
      • Set SetPlayerTextSend = 0
And the player to enemy
  • enemy
    • Events
      • Player - Player 1 (Red) types a chat message containing -enemy as A substring
      • Player - Player 2 (Blue) types a chat message containing -enemy as A substring
      • Player - Player 3 (Teal) types a chat message containing -enemy as A substring
      • Player - Player 4 (Purple) types a chat message containing -enemy as A substring
    • Conditions
    • Actions
      • For each (Integer A) from (((Player number of (Triggering player)) x 4) - 3) to ((Player number of (Triggering player)) x 4), do (Actions)
        • Loop - Actions
          • Set SetPlayerTextSend = (SetPlayerTextSend + 1)
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • ((Player(SetPlayerTextSend)) controller) Equal to None
              • Or - Any (Conditions) are true
                • Conditions
                  • ((Player(SetPlayerTextSend)) controller) Equal to User
                  • ((Player(SetPlayerTextSend)) controller) Equal to Computer
              • (Triggering player) Not equal to (Player(SetPlayerTextSend))
              • Or - Any (Conditions) are true
                • Conditions
                  • (Entered chat string) Equal to (-enemy + (String(SetPlayerTextSend)))
                  • (Entered chat string) Equal to (-enemy + ControlColor[SetPlayerTextSend])
            • Then - Actions
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • Alliance[(Integer A)] Equal to 1
                • Then - Actions
                  • Set Alliance[(Integer A)] = 0
                  • Game - Display to (Player group((Triggering player))) the text: (You have rejected an aliance with + (Name of (Player(SetPlayerTextSend))))
                  • Set Alliance[(4 x ((Player number of (Player((Integer A)))) - (Player number of (Triggering player))))] = 0
                  • Game - Display to (Player group((Player(SetPlayerTextSend)))) the text: ((Your alliance + (Name of (Triggering player))) + has been rejected)
                • Else - Actions
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • Alliance[(Integer A)] Equal to 2
                • Then - Actions
                  • Set Alliance[(Integer A)] = 0
                  • Player - Make (Triggering player) treat (Player(SetPlayerTextSend)) as an Enemy
                  • Game - Display to (Player group((Triggering player))) the text: (You are no longer an ally with + (Name of (Player(SetPlayerTextSend))))
                  • Set Alliance[(4 x ((Player number of (Player((Integer A)))) - (Player number of (Triggering player))))] = 0
                  • Player - Make (Player(SetPlayerTextSend)) treat (Triggering player) as an Enemy
                  • Game - Display to (Player group((Player(SetPlayerTextSend)))) the text: ((Name of (Triggering player)) + has set you as an enemy once again)
                • Else - Actions
            • Else - Actions
      • Set SetPlayerTextSend = 0
this trigger should be 100% bug free but I havnt tested it with another player but I had my own way of working around it:wink:. Anyway I hope you still want the system:eekani:.And remember I never give up on something I now I can do!

sinserily yours: DeathChef
 

Attachments

  • Pending ally or enemy by text.w3x
    17 KB · Views: 69
Last edited:
Status
Not open for further replies.
Top