• 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.
  • The Hive's 22nd Icon Contest: Creep Abilities is now concluded, time to vote for your favourite set of icons! Click here to vote!
  • ✅ The POLL for Hive's Texturing Contest #34 is OPEN! Vote for the TOP 3 SKINS! 🔗Click here to cast your vote!
  • ✅ The POLL for Hive's Techtree Contest #20 is OPEN! Vote for the TOP 3 FACTIONS! 🔗Click here to cast your vote!

Can't trade resources with players in different forces

Level 5
Joined
Sep 20, 2024
Messages
31
Hello, there seems to be a bug where players in different forces (teams) can't trade resources to eachother even if they become allied with actions in trigger.

Set in "Scenario->Force Properties...":
Blue, teal, gray and light blue in force 1.
Peach and emerald in force 2.

  • Iniitialization
    • Events
      • Map initialization
    • Conditions
    • Actions
      • Player Group - Pick every player in (All players matching ((((Matching player) controller) Equal to User) and (((Matching player) slot status) Equal to Is playing)).) and do (Actions)
        • Loop - Actions
          • Player Group - Add (Picked player) to Players
      • Player - Make Player 2 (Blue) treat Player 23 (Emerald) as an Ally with shared vision
      • Player - Make Player 3 (Teal) treat Player 23 (Emerald) as an Ally with shared vision
      • Player - Make Player 9 (Gray) treat Player 23 (Emerald) as an Ally with shared vision
      • Player - Make Player 10 (Light Blue) treat Player 23 (Emerald) as an Ally with shared vision
      • Player - Make Player 12 (Brown) treat Player 23 (Emerald) as an Ally with shared vision
      • Player - Make Player 23 (Emerald) treat Player 2 (Blue) as an Ally with shared vision
      • Player - Make Player 23 (Emerald) treat Player 3 (Teal) as an Ally with shared vision
      • Player - Make Player 23 (Emerald) treat Player 9 (Gray) as an Ally with shared vision
      • Player - Make Player 23 (Emerald) treat Player 10 (Light Blue) as an Ally with shared vision
      • Player - Make Player 23 (Emerald) treat Player 12 (Brown) as an Ally with shared vision
      • Player - Make Player 18 (Peach) treat Player 2 (Blue) as an Ally with shared vision
      • Player - Make Player 18 (Peach) treat Player 3 (Teal) as an Ally with shared vision
      • Player - Make Player 18 (Peach) treat Player 9 (Gray) as an Ally with shared vision
      • Player - Make Player 18 (Peach) treat Player 10 (Light Blue) as an Ally with shared vision
      • Player - Make Player 18 (Peach) treat Player 12 (Brown) as an Ally with shared vision
      • Player - Make Player 2 (Blue) treat Player 18 (Peach) as an Ally with shared vision
      • Player - Make Player 3 (Teal) treat Player 18 (Peach) as an Ally with shared vision
      • Player - Make Player 9 (Gray) treat Player 18 (Peach) as an Ally with shared vision
      • Player - Make Player 10 (Light Blue) treat Player 18 (Peach) as an Ally with shared vision
      • Player - Make Player 12 (Brown) treat Player 18 (Peach) as an Ally with shared vision
      • Player - Make Player 2 (Blue) treat Player 12 (Brown) as an Ally with shared vision
      • Player - Make Player 3 (Teal) treat Player 12 (Brown) as an Ally with shared vision
      • Player - Make Player 9 (Gray) treat Player 12 (Brown) as an Ally with shared vision
      • Player - Make Player 10 (Light Blue) treat Player 12 (Brown) as an Ally with shared vision
      • Player - Make Player 12 (Brown) treat Player 2 (Blue) as an Ally with shared vision
      • Player - Make Player 12 (Brown) treat Player 3 (Teal) as an Ally with shared vision
      • Player - Make Player 12 (Brown) treat Player 9 (Gray) as an Ally with shared vision
      • Player - Make Player 12 (Brown) treat Player 10 (Light Blue) as an Ally with shared vision
Other people also have this problem with their maps.

I always wondered why there are 2 different actions to ally players/computer AI:
"Player - Set Aspect Of Alliance"
"Player - Set Alliance"
Blizzard should merge those 2 actions into 1 action. But perhaps testing different ways with those 2 actions the trading bug can be fixed?

Anyone know how to fix the trading bug?
 
Last edited:
You can try with this

1759569355978.png


Also, trading only works with "human" players, you can't trade with a computer even if allied
 
"Game - Set Map Flag" action don't work, it's broken. I posted about it long ago on Blizzard's forum.

Trading doesn't work with computer AI in singleplayer, but when hosting multiplayer custom games lobby trading works with computer AI. That's actually good you brought that up because I would like to make it so all players can't trade to computer AI brown since trolls send resources to brown and then leave game. How to make resources trading grayed out in allies window only on computer AI brown for all players so they can't send resources to brown?
 
Last edited:
Edit: Hold on, in the process of debugging this. Will upload a new fixed version soon.

Edit 2: Uploaded second "should be fixed" version in my post below.

Here's a system I made for trading resources. It's a custom menu meant to replace the USE of the standard Allies menu:
  • TradeMenu Initialize
    • Events
      • Time - Elapsed game time is 0.01 seconds
    • Conditions
    • Actions
      • -------- Initialize the system (it's important if not required to do this after Map Initialization): --------
      • Custom script: call TradeMenuInit()
      • -------- --------
      • -------- Disable the default resource trading system: --------
      • Game - Set Lock resource trading to On
      • -------- --------
      • -------- --------
      • -------- Here's an example of disabling trade between P1 and P2: --------
      • Set VariableSet CTM_Source = Player 1 (Red)
      • Set VariableSet CTM_Target = Player 2 (Blue)
      • Set VariableSet CTM_Flag = False
      • Trigger - Run TradeMenu Allow Trading <gen> (ignoring conditions)
      • -------- --------
      • -------- Here's an example of enabling trade between P1 and P2: --------
      • Set VariableSet CTM_Source = Player 1 (Red)
      • Set VariableSet CTM_Target = Player 2 (Blue)
      • Set VariableSet CTM_Flag = True
      • Trigger - Run TradeMenu Allow Trading <gen> (ignoring conditions)
      • -------- --------
      • -------- Here's an example of disabling all trades with P2: --------
      • Set VariableSet CTM_Source = Player 2 (Blue)
      • Set VariableSet CTM_Flag = True
      • Trigger - Run TradeMenu Disable Trading <gen> (ignoring conditions)
      • -------- --------
      • -------- Here's an example of enabling all trades with P2: --------
      • Set VariableSet CTM_Source = Player 2 (Blue)
      • Set VariableSet CTM_Flag = False
      • Trigger - Run TradeMenu Disable Trading <gen> (ignoring conditions)
Press the F9 key to open the menu. This hotkey can be changed.

Through GUI you can control:
1. Whether two Players are allowed to trade with one another.
2. Whether a Player can be traded with at all. Useful for Computers, Leavers, and Unused slots.

This means that you can use #2 to disable trading with your Brown player (AI). But by default it should disable all unwanted trading between opponents, unused player slots, and computers. Note that when you "enable all trades" with a Player that doesn't undo any of their "allowed" settings, these act as separate flags which need to be controlled independently. Also, if you ever want to manually toggle the trade menu on/off the function is called ToggleTradeMenu and takes a Player as it's only parameter. It will switch the current state of the menu for that Player (off -> on, on -> off).

You can find the configurable settings at the very top of the TradeMenu script with some //comments to help explain:
vJASS:
        // !!! DEFINE THESE YOURSELF !!!
        // ==================================================
        private constant integer MAX_PLAYERS    = 24           // total number of players (might bug out if not 24)
 
        private constant integer TRADE_SMALL    = 100          // resource amount (normal)
 
        private constant integer TRADE_LARGE    = 200          // resource amount (modified -> large)
 
        private constant integer TRADE_HUGE     = 1000         // resource amount (modified -> huge)
 
        private constant oskeytype OPEN_BUTTON = OSKEY_F9      // button used to open and close the trade menu
 
        private constant boolean USE_MODIFIER_KEYS = true      // allows 'Shift', 'Control', and 'Alt' modifier keys
 
        private constant boolean USE_ALLIANCE_DEFAULTS = true  // prevents trading with enemies, disables trading with CPUs/unused
 
        private constant boolean USE_RESET_ON_FAIL = true      // resets resources if you fail to send any
 
        private constant real ANCHOR_X = 0.0                   // offsets all UI on the horizontal axis
 
        private constant real ANCHOR_Y = 0.0                   // offsets all UI on the vertical axis
        // ==================================================
        // !!! STOP !!!
These settings allow you to modify behavior such as changing how much Gold/Lumber is traded or the position of the UI elements.

Lastly, you'll want to export and import this asset into your own map, it's an image used by the UI:
1759597332976.png
 
Last edited:
I don't know if the standard system is bugged or not but I figured why be at the mercy of Blizzard's neglect when we have the tools to create even better systems ourselves. So here's my "now fixed" resource trading menu, it can be customized to do just about anything you want.

Random side note, checking controller/slot status during Map initialization is not a good idea as Players may not have loaded in yet (afaik):
  • Iniitialization
    • Events
      • Map initialization
    • Conditions
    • Actions
      • Player Group - Pick every player in (All players matching ((((Matching player) controller) Equal to User) and (((Matching player) slot status) Equal to Is playing)).) and do (Actions)
        • Loop - Actions
          • Player Group - Add (Picked player) to Players
I would do this using a 0.01 second Elapsed Time event.
 

Attachments

Last edited:
Back
Top