• 🏆 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 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: 81
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: 39
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