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

[General] Shop which only owner can use

Status
Not open for further replies.
Level 3
Joined
Jan 4, 2010
Messages
14
Is it possible to have an item shop that only the owner of it can use? That means that even allies of the item shop building owner cannot even see the items on it or any abilities it can cast.

Just an explanation on why I need it:
I'm working on a tower defense map where there is a special race which uses towers with inventory slots, and it can build an item shop. However, people using the same race can abuse by buying items from that person's shop (saving money for building the item shop).
They can even cast the "Sell" ability on the owner's shop, causing the shop to sell.

I tried the following possible solutions I found on the internet:
1) Abilities -> Shop Sharing -> tick Player Units under Targets Allowed: didn't work
2) Trigger forces player to deselect shop if he is not the owner of it: has a delay before it deselects, and it is easy to spam the hotkeys to buy item / use ability
3) Remove Shop Sharing ability: Had no effect, still can access shop by other player

This is the skills my shop has: (Sell is based off Thunderslam, for selling the building)
1zdluo9.jpg


Would appreciate if anyone can find a solution for this :)
 
Level 5
Joined
Aug 27, 2008
Messages
127
Maybe with a trigger, that checks if the shop is owned by the owner of the unit that is purchasing the item. If it isn't - refund.

Another way is to change the targets allowed for the abilities "Select Hero/Unit". Try different combinations until it works.

And yet another way is to add perm invisibility to the shop, so that way only the owning player will see it.

You can even hide the shop and make it a hero unit. So every time a player needs to buy something he can click the hero icon.
 
Level 3
Joined
Jan 4, 2010
Messages
14
Thanks for the ideas, but

#1: The non-owner still can cast the Sell ability on the shop
#2: I tried to change every item selling ability to target only Player Units (that seems like the only viable option) and it doesn't work
#3: But they're both allies, the ally will see it still
#4: It's a good "last resort" idea, but I prefer that the shop is visble and is a solid building that can block creeps

I found a good method that works quite well (for those who searched up this thread).
It does have some flaws though. You have to give your shop an inventory (unless you don't mind it appearing on the floor). The bought item will appear in the shop's inventory. (Of course you can code it that it appears in a certain unit's inventory)

1) Put the items you like to sell in a shop, run the map and wait for them to have a stock of 1 (with a unit that can purchase them nearby)
2) Press screenshot button and paste it into Paint
3) Select, copy and paste each icon (with the number 1 at bottom-right) into another Paint window, and save it.
4) Resize and convert to BLP (icon file).
5) Import it into your map.
6) Create an dummy ability (that doesn't do anything) and set the description so that the title is something like "[26 Gold] Purchase New Item (Q)" <- Q being the hotkey
7) Set the ability icon as the image you imported
8) Give your shop this ability (remember to remove the item under Items Sold/Made)
9) Make a trigger that triggers every time this ability is casted. When it is casted, check whether player has sufficient gold, and if so, Item - Create the real item beside the shop, and command the shop to Right-Click it. Deduct the gold cost from player's gold.

Flaws: Shop has inventory (you can change it around and make it appear in another unit's inventory). Cannot "Select Unit" to purchase the item. Cannot set a real gold cost (have to put it in the tooltip as [26 Gold] for example. Hard to implement a cooldown on the item purchase. Needs a different base ability for every item. MSI.
 
Level 5
Joined
Aug 27, 2008
Messages
127
Thanks for the ideas, but

#1: The non-owner still can cast the Sell ability on the shop
#2: I tried to change every item selling ability to target only Player Units (that seems like the only viable option) and it doesn't work
#3: But they're both allies, the ally will see it still
#4: It's a good "last resort" idea, but I prefer that the shop is visble and is a solid building that can block creeps

I found a good method that works quite well (for those who searched up this thread).
It does have some flaws though. You have to give your shop an inventory (unless you don't mind it appearing on the floor). The bought item will appear in the shop's inventory. (Of course you can code it that it appears in a certain unit's inventory)

1) Put the items you like to sell in a shop, run the map and wait for them to have a stock of 1 (with a unit that can purchase them nearby)
2) Press screenshot button and paste it into Paint
3) Select, copy and paste each icon (with the number 1 at bottom-right) into another Paint window, and save it.
4) Resize and convert to BLP (icon file).
5) Import it into your map.
6) Create an dummy ability (that doesn't do anything) and set the description so that the title is something like "[26 Gold] Purchase New Item (Q)" <- Q being the hotkey
7) Set the ability icon as the image you imported
8) Give your shop this ability (remember to remove the item under Items Sold/Made)
9) Make a trigger that triggers every time this ability is casted. When it is casted, check whether player has sufficient gold, and if so, Item - Create the real item beside the shop, and command the shop to Right-Click it. Deduct the gold cost from player's gold.

Flaws: Shop has inventory (you can change it around and make it appear in another unit's inventory). Cannot "Select Unit" to purchase the item. Cannot set a real gold cost (have to put it in the tooltip as [26 Gold] for example. Hard to implement a cooldown on the item purchase. Needs a different base ability for every item. MSI.
Seems like a hard thing to do.
Anyways, the ally wont see it if vision isn't shared.
BTW about the selling ability, maybe by typing -sell.
Or by adding an inventory to the shop like you said, but with only one space, with one item that will have the sell ability.
Or maybe by removing the shop sharing ability and changing the owner each time a player selects it and disabling the sell shop ability if its not the player who built it (variables).
 
Level 3
Joined
Jan 4, 2010
Messages
14
@Br3akth3w1nd
1)My map has always been a full vision map where you can see the whole map without fog.
2)I'm not really willing to change the entire sell system just for this problem. People have got used to it.
3)Same as #2

I tried various methods. No matter what, if the shop sells item, it will be automatically shared.

I already tried setting the Targets Allowed to every item shop skill it has (including Select Hero / Select Unit), but it doesn't work.

But anyway, I already completed the get-around method above and there's no problem with it so far :)
 
Level 4
Joined
Oct 20, 2011
Messages
129
Do you know how to make a unit only visible with some specific player and although other player has True Sight but he can't see it? I don't know how to do it but I know it is possible!
 
Level 5
Joined
Aug 27, 2008
Messages
127
@Br3akth3w1nd
1)My map has always been a full vision map where you can see the whole map without fog.
2)I'm not really willing to change the entire sell system just for this problem. People have got used to it.
3)Same as #2

I tried various methods. No matter what, if the shop sells item, it will be automatically shared.

I already tried setting the Targets Allowed to every item shop skill it has (including Select Hero / Select Unit), but it doesn't work.

But anyway, I already completed the get-around method above and there's no problem with it so far :)

DUDE! about #1. That doesn't matter. All it matters is that players dont share vision in F11 (alliance without granted vision). So that way his allies wont be able to see his invisible units.
 
Status
Not open for further replies.
Top