• 🏆 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!

How to make command to share gold to player?

Status
Not open for further replies.
Level 11
Joined
Jul 17, 2013
Messages
544
Hi so i would like to make simply share gold system how can i do it? i also would like players to be able to give any value of gold! like player types -give blue 18 (or 35) then blue receives 18 or 35 gold depenning what player typed. i got also 9 players in my map red blue teal purple yellow orange gray dg and brown i would like them all to be able to share gold beetwen eacother.
 
Level 28
Joined
Feb 18, 2014
Messages
3,580
  • Give Blue Gold
    • Events
      • Player - Player 1 (Red) types a chat message containing -give blue as A substring
      • Player - Player 3 (Teal) types a chat message containing -give blue as A substring
      • Player - Player 4 (Purple) types a chat message containing -give blue as A substring
      • Player - Player 5 (Yellow) types a chat message containing -give blue as A substring
      • Player - Player 6 (Orange) types a chat message containing -give blue as A substring
      • Player - Player 9 (Gray) types a chat message containing -give blue as A substring
      • Player - Player 11 (Dark Green) types a chat message containing -give blue as A substring
      • Player - Player 12 (Brown) types a chat message containing -give blue as A substring
    • Conditions
    • Actions
      • Player - Add (Integer((Substring((Entered chat string), 12, 20)))) to Player 2 (Blue) Current gold
You will have to repeat this trigger for every single player by changing the string -give (Player Color) and the player you want to receive the gold.
 
Level 39
Joined
Feb 27, 2007
Messages
5,023
Better to filter out the color from the message itself and use one trigger.
  • Give Gold
    • Events
      • Player - Player 1 (Red) types a chat message containing -give as A substring
      • Player - Player 3 (Teal) types a chat message containing -give as A substring
      • Player - Player 4 (Purple) types a chat message containing -give as A substring
      • Player - Player 5 (Yellow) types a chat message containing -give as A substring
      • Player - Player 6 (Orange) types a chat message containing -give as A substring
      • Player - Player 9 (Gray) types a chat message containing -give as A substring
      • Player - Player 11 (Dark Green) types a chat message containing -give as A substring
      • Player - Player 12 (Brown) types a chat message containing -give as A substring
    • Conditions
      • Substring((Entered Chat string), 1, 5) equal to -give
    • Actions
      • For each (integer A) from 1 to PLAYER_COUNT do (Actions)
        • Loop - Actions
          • Set S = Substring((Entered chat string), 7, (7 + COLOR_NAME_LENGTH[(Integer A)]))
          • If (All conditions are true) then do (then actions) else do (else actions)
            • If - Conditions
              • S equal to COLOR_NAME[(Integer A)]
            • Then - Actions
              • Set GivePlayer = COLOR_PLAYER[(Integer A)]
              • Set GiveAmount = Integer(Substring((Entered chat string), 8 + COLOR_NAME_LENGTH[(Integer A)], (Length of (Entered chat string))))
              • Player - Add GiveAmount to GivePlayer Current gold
  • Setup Give Gold
    • Events
      • Time - Elapsed Game time is 0.50 seconds
    • Conditions
    • Actions
      • Set PLAYER_COUNT = (PLAYER_COUNT + 1)
      • Set COLOR_PLAYER[PLAYER_COUNT] = Player 1 (Red)
      • Set COLOR_NAME[PLAYER_COUNT] = red
      • Set COLOR_NAME_LENGTH = (Length of COLOR_NAME[PLAYER_COUNT])
      • -------- --------
      • Set PLAYER_COUNT = (PLAYER_COUNT + 1)
      • Set COLOR_PLAYER[PLAYER_COUNT] = Player 3 (Teal)
      • Set COLOR_NAME[PLAYER_COUNT] = teal
      • Set COLOR_NAME_LENGTH = (Length of COLOR_NAME[PLAYER_COUNT])
      • -------- --------
      • Set PLAYER_COUNT = (PLAYER_COUNT + 1)
      • Set COLOR_PLAYER[PLAYER_COUNT] = Player 4 (Purple)
      • Set COLOR_NAME[PLAYER_COUNT] = purple
      • Set COLOR_NAME_LENGTH = (Length of COLOR_NAME[PLAYER_COUNT])
      • -------- etc. for all color names --------
      • -------- you can even make duplicate entries to allow multiple ways to type the color --------
      • -------- for example: --------
      • Set PLAYER_COUNT = (PLAYER_COUNT + 1)
      • Set COLOR_PLAYER[PLAYER_COUNT] = Player 11 (Dark Green)
      • Set COLOR_NAME[PLAYER_COUNT] = dark green
      • Set COLOR_NAME_LENGTH = (Length of COLOR_NAME[PLAYER_COUNT])
      • -------- --------
      • Set PLAYER_COUNT = (PLAYER_COUNT + 1)
      • Set COLOR_PLAYER[PLAYER_COUNT] = Player 11 (Dark Green)
      • Set COLOR_NAME[PLAYER_COUNT] = darkgreen
      • Set COLOR_NAME_LENGTH = (Length of COLOR_NAME[PLAYER_COUNT])
      • -------- --------
      • Set PLAYER_COUNT = (PLAYER_COUNT + 1)
      • Set COLOR_PLAYER[PLAYER_COUNT] = Player 11 (Dark Green)
      • Set COLOR_NAME[PLAYER_COUNT] = dg
      • Set COLOR_NAME_LENGTH = (Length of COLOR_NAME[PLAYER_COUNT])
 
Status
Not open for further replies.
Top