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

How to make a trigger where a chat message can transfer gold.

Status
Not open for further replies.
Level 4
Joined
Feb 7, 2007
Messages
61
In some games you can distrbute gold to your teammates. For example,

-give purple 100 gold/wood

by doing player chat message, how can i do that? And to be sure to allow as much gold the player has to give. So if the player has 500 gold and he/she types -give purple 1000 gold/wood, there will be a trigger where it tells the player that he/she does not have enough gold/wood to give.
 
Level 11
Joined
Aug 25, 2006
Messages
971
Ok I completed what you asked for TO THE LETTER! It works flawlessly. It uses two (quite cool) functions I built. First one GetParam which reads in a string and splits all the text separated by spaces into different strings then returns the one you asked for. The second CS2P (Color string 2 player) which is actually dynamic! It does have one problem. If two players have the same color it will return the one with the lower player number.

To make it work on your map, just copy the 'Give' trigger into your map. To test it on my map, just give some gold/wood to blue.
 

Attachments

  • GivePSt.w3x
    15.4 KB · Views: 84
Level 4
Joined
Feb 7, 2007
Messages
61
i see that it says, max players/max colors is 11, can i change it to 12? cause i have 12 players in my map. What do i type to send the gold/wood? Also i would like to ask if i can disable the Allies Menu(F11) during game and how to.
 
Level 11
Joined
Aug 25, 2006
Messages
971
11 is 12 players.
Player 0 is actually displayed as player 1 ingame, and if you try and use GUI to find the number of a player it automatically adds 1 to the real number. So no, higher then 11 and it might crash. At the very least it won't do you any good. Its already prepared for all 12 players.

For your other question:
  • Game - Set Lock alliance settings to On
I'm almost certain it requires it be run at map init. (Though I'm also quite sure its off by default)
 
Level 11
Joined
Aug 25, 2006
Messages
971
Its the smallest mistake ever, however I fixed it. I also fixed another extremely small error.

Just copy the 'give' trigger. It works just like the my previous map except with the two small bugs fixed.

For your information I did check my triggers. Its just that there was only one 'if' statement that checks if a player is trying to trade with himself. So I had to make it 'you can't trade gold or wood' instead of 'you can't trade gold'
 

Attachments

  • GivePSt.w3x
    15.5 KB · Views: 40
Last edited:
Level 4
Joined
Feb 7, 2007
Messages
61
does the trigger display text to the player who recieves the gold/wood?

how do i make the texting colored instead of plain white?
 
Level 11
Joined
Aug 25, 2006
Messages
971
@Parrothead I already made the complete trigger. If you noticed. And my trigger works exactly as he asked it to work. To the letter!

@Lafeet What would you like colored Lafeet? I'll add it in for you!


Edited to stop confusion
 
Last edited:
Level 4
Joined
Feb 7, 2007
Messages
61
yeah i would like you to display the message to the player who recieves the resources in "red" color and playing a sound to let the player know who recieved the resources to know. Any sound to let the player know is good, thank you in advanced.
 
Level 11
Joined
Aug 25, 2006
Messages
971
Ok its done. However now you can't just copy the 'give' trigger. You must also get the sounds. You can use any sounds you want as long as they use the same variable names! I made it show green text for success/receive or red text for an error message.
 

Attachments

  • GivePSt.w3x
    16.4 KB · Views: 27
Status
Not open for further replies.
Top