• 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.
  • Create a faction for Warcraft 3 and enter Hive's 19th Techtree Contest: Co-Op Commanders! Click here to enter!
  • Get your art tools and paintbrushes ready and enter Hive's 34th Texturing Contest: Void! Click here to enter!

Items Made vs Items Sold

Level 3
Joined
Feb 13, 2020
Messages
22
Hi everyone,


I’m working on a custom Warcraft 3 map (Reforged, Lua-based) where each player has 4 preplaced, player-owned shops. Each shop should be exclusively accessible to its ownerno allies, no enemies, no shared access whatsoever. That part is non-negotiable.


My goal is to achieve clean and engine-native shop interaction for each player, where:


  • Only the owning player can interact with the shop.
  • Others can’t see, click, or buy from it.
  • No workarounds like refunding purchases or hiding things with fog of war.
I've tried the following so far:

  1. Items Sold (default approach):
    • The shop and its configurations work perfectly here, but any ally can access and use the shop.
  2. Items Made (as suggested in some threads):
    • Results in “No valid patron nearby” even when:
      • The hero is nearby.
      • The shop has Select Hero, Shop Purchase Item.
      • The shop is player-owned, and the hero belongs to the same player.
      • The hero is a proper Hero unit (and the only unit in the game).
      • All above configurations work perfectly fine if I use Items Sold, it's the switch to Items Made that breaks it.

The scenario is fairly simple, it's a 2v2 map, and each team spawns in the same area, and each player on the same team have their own shops. It should not be possible for Player 1 to shop in Player 2's shops and vice versa. This part is non-negotiable, I'm not looking for workarounds that circumvent that fact, or any clever solutions like using a single shared shop etc.

I'm hoping you guys can help! I've tried scouring the entire internet but to no avail.
 
Level 13
Joined
Nov 13, 2010
Messages
284
so i think i made what you need... the player has it own shop and can not se other players shops, i have also attach a map
  • Initialization
    • Events
      • Map initialization
    • Conditions
    • Actions
      • Visibility - Disable fog of war
      • Visibility - Disable black mask
      • Set VariableSet PlayerShop[1] = Goblin Merchant 0005 <gen>
      • Set VariableSet PlayerShop[2] = Goblin Merchant 0006 <gen>
      • Set VariableSet PlayerShop[3] = Goblin Merchant 0008 <gen>
      • Set VariableSet PlayerShop[4] = Goblin Merchant 0007 <gen>
      • For each (Integer A) from 1 to 4, do (Actions)
        • Loop - Actions
          • Set VariableSet tempUnit = PlayerShop[(Integer A)]
          • Set VariableSet tempPlayer = (Owner of tempUnit)
          • Unit - Make tempUnit Invulnerable
          • Unit - Make tempUnit Unrescuable by (All players)
          • Custom script: call ShowUnit(udg_tempUnit, false)
      • For each (Integer A) from 1 to 4, do (Actions)
        • Loop - Actions
          • Set VariableSet tempUnit = PlayerShop[(Integer A)]
          • Set VariableSet tempPlayer = (Owner of tempUnit)
          • Custom script: if GetLocalPlayer() == udg_tempPlayer then
          • Custom script: call ShowUnit(udg_tempUnit, true)
          • Custom script: endif
 

Attachments

  • shops.w3m
    12.6 KB · Views: 1
Level 3
Joined
Feb 13, 2020
Messages
22
I did a hybrid, thanks to your efforts. Instead of doing your actions, I call a LUA function:
  • ShopInit
    • Events
      • Map initialization
    • Conditions
    • Actions
      • Set VariableSet PlayerCreepShop[1] = Creep Generator 0003 <gen>
      • Set VariableSet PlayerArenaShop[1] = Arena Shop 0006 <gen>
      • Set VariableSet PlayerMasteryShop[1] = Mastery Obelisk 0007 <gen>
      • Set VariableSet PlayerTomeShop[1] = Tome of Knowledge 0008 <gen>
      • Set VariableSet PlayerCreepShop[2] = Creep Generator 0009 <gen>
      • Set VariableSet PlayerArenaShop[2] = Arena Shop 0010 <gen>
      • Set VariableSet PlayerMasteryShop[2] = Mastery Obelisk 0011 <gen>
      • Set VariableSet PlayerTomeShop[2] = Tome of Knowledge 0012 <gen>
      • Set VariableSet PlayerCreepShop[3] = Creep Generator 0016 <gen>
      • Set VariableSet PlayerArenaShop[3] = Arena Shop 0015 <gen>
      • Set VariableSet PlayerMasteryShop[3] = Mastery Obelisk 0014 <gen>
      • Set VariableSet PlayerTomeShop[3] = Tome of Knowledge 0013 <gen>
      • Set VariableSet PlayerCreepShop[4] = Creep Generator 0020 <gen>
      • Set VariableSet PlayerArenaShop[4] = Arena Shop 0019 <gen>
      • Set VariableSet PlayerMasteryShop[4] = Mastery Obelisk 0018 <gen>
      • Set VariableSet PlayerTomeShop[4] = Tome of Knowledge 0017 <gen>
      • Custom script: InitShopVisibility()
Code:
function InitShopVisibility()
  for pid = 0, bj_MAX_PLAYERS - 1 do
    local i = pid + 1

    local creepShop   = udg_PlayerCreepShop[i]
    local arenaShop   = udg_PlayerArenaShop[i]
    local masteryShop = udg_PlayerMasteryShop[i]
    local tomeShop    = udg_PlayerTomeShop[i]
 
    local function HandleShop(shop)
      if shop then
        ShowUnit(shop, false)
        if GetLocalPlayer() == Player(pid) then
          ShowUnit(shop, true)
        end
      end
    end
    HandleShop(creepShop)
    HandleShop(arenaShop)
    HandleShop(masteryShop)
    HandleShop(tomeShop)
  end
end


Thank you, polardude!
 
Last edited:
Top