• 🏆 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!
  • 🏆 Hive's 6th HD Modeling Contest: Mechanical is now open! Design and model a mechanical creature, mechanized animal, a futuristic robotic being, or anything else your imagination can tinker with! 📅 Submissions close on June 30, 2024. Don't miss this opportunity to let your creativity shine! Enter now and show us your mechanical masterpiece! 🔗 Click here to enter!

Shops not selecting allied units

Status
Not open for further replies.
Level 5
Joined
Sep 21, 2005
Messages
119
Well, I'm back to map-making again for like the 7th lapse lol,

And as usual, I'm stuck on something rather intriguing.

Let's say you have a shop owned by a player (not neutral), the shop has "Select Hero" so it can select the nearby patrons to sell items to. However, I want that to only work for the owner's units, not for everyone.. is this possible? I've tried to set "Targets Allowed" in all the neutral abilities related to shop-sharing to anything from Air to Enemy, nothing makes a difference.

Any insights?

Thanks in advance, you guys have never failed me before,

~Gloomfrost
 
Level 5
Joined
Nov 7, 2007
Messages
134
I thought of one thing that might work, but I'm not sure. Make a trigger that looks like this:

Event, Unit - A Unit Starts the effect of and ability
Condition, Ability - Ability being cast Equal to Select Hero
Condition, Player - Owner of Target Unit of ability being cast Not Equal to Owner of Casting Unit
Action, Unit - Remove Select Hero from Casting Unit
Action, Unit - Add Select Hero from Casting Unit

The idea is that when the shop tries to select a enemy hero to buy from it, the skill will be removed so that the enemy hero can't buy from it, but then it immediately gets the ability back so it won't be noticeable. However, I haven't tried it myself and to tell the truth I have my doubts it will work, but you could always try unless you think of something better.
 
Level 5
Joined
Sep 21, 2005
Messages
119
Sole, I've tried creating it as a custom ability targeting only air and enemy, (just to be certain), it didn't work. In addition, even if you add a tech req., it STILL works... I don't think it's that kind of ability.

Xarxos, I've tried that before, 'Select Hero' doesn't register as an ability cast or starts effect of.


--The only thing I can think of now is to somehow have each one of those buildings added to a trigger with "unit comes within 500 of (shop)", then do something fancy, but that's going to be really buggy :S

Any other ideas? Maybe something in Gameplay Constants?

Just to add something to this; it's not necessary the fact that the shop can "Select" the hero, it's moreso that the shop is "Shop Shared", so because of that, other players can even cast ABILITIES that the shop has. That's what I'm moreso worried about.
 
Level 5
Joined
Nov 7, 2007
Messages
134
I see. There's one more thing I thought of, and that is that instead of using an actual shop you have a building that sells a certain number of units whose name and icon is the same as the items you want to be sold. Then you put as requirements for the units a dummy upgrade called "Nearby Patron". Then make a trigger that says that when a hero owned by the owner of the "shop" comes within range, the dummy upgrade is automatically researched for the player so that he/she can buy the units. Then, when the player buys a specific unit, remove it immediately and create an item and give it to the hero that came within range. If the hero should then move out of range, set the dummy upgrade to be disabled once again and it will appear as if the building is an actual shop. If you do this it will only be the owner of the shop that can buy items from it.

Hope that made sense and that it helps^^
 
Level 5
Joined
Sep 21, 2005
Messages
119
That's not a bad idea, but if I have 6 items to be sold, I need to switch each of those items to UNITS. Hmm.. I might try it out, I think that's the best I can do right now, if noone has any better ideas, I'll let everyone know how it works out.

~Gloom

P.S: You can't remove an upgrade, it has to be done with a dummy unit requirement. (For anyone curious about removing upgrades)
 
Level 5
Joined
Sep 21, 2005
Messages
119
Alright so I tried 2 clever things:

1) Take off "Select Hero" and just "spawn" items (the shop can still "sell" items), so items were appearing infront of the shop without shop sharing, and then I wanted to use triggers to give the items to the hero, BUTTT, Apparently, if there is no "Select Hero", or rather, a target, then triggers which register "Sold Item" or "Shop sells an Item" do NOT register, so that was retarded on WC3's part.. x_X

2) That basically leads to the following: If you're selling anything from a shop INCLUDING units, you NEED select hero or else it does not register for any "Sells" events. <-*Note, have not tried it with selling units, but I am pretty sure if there is no hero selector, then the event won't register even with selling units.

Problem persists. I don't know what to try now.. training units with train time 0??
 
Level 6
Joined
May 1, 2009
Messages
215
Base the shop off of Arcane Vault

Remove the 'shop sharing' ability and make sure items are 'made' and not 'sold'

I can't really understand your problem beyond that. The above should work (though only in theory, I've never tried to do what you're doing), if it doesn't... I dunno. I've seen what you're trying to do in a few AOS's (that don't allow enemy heroes to purchase items in your base).
 
Level 6
Joined
May 1, 2009
Messages
215
Some ideas:

A trigger to remove heroes that get too close to a shop that aren't supposed to purchase anything

An aura on shop buildings which insta kills heroes not owned by the player

What's your map exactly? I can't think of any more solutions than that, but perhaps there's a map specific solution that can be found.
 
Level 5
Joined
Nov 7, 2007
Messages
134
Flowers solutions weren't that bad actually, but perhaps you don't want to kill allied heroes. In that case you could do a trigger like he suggested, one that is triggered by a allied hero coming within shop-range of the shop (you could find this range out by testing, or perhaps it's something in the object editor or gameplay constants, I'm not sure), but instead of killing it, simply move it out of the shop-range. This way they shouldn't be able to buy anything from the shop.
 
Level 5
Joined
Sep 21, 2005
Messages
119
It's Werewolf - Transylvania,

Players are allowed to place a lighthouse that they can purchase ships to "sail out" and when they return they give profit, the problem is that the lighthouse has a demolish ability that can be used to destroy the lighthouse that players who can see the shop can use (problem) (because of the shop sharing). Also, although players dont get anything from buying ships from a lighthouse that doesn't belong to them, they still activate the cooldown interval in the building so the owner has to wait 2 minutes before sending out another ship to sea.

I can't kill or damage heroes that aren't allowed to come close, that's very impractical as lighthouses can and should be placed anywhere, even in other people's bases. Thus, I can't have players who can't move around their own base if another player puts up a lighthouse in the middle lol...

~Gloom
 
Level 6
Joined
May 1, 2009
Messages
215
The basic idea is you only want the creator of the building ONLY to use the building, so why are you doing this at all? Maybe I misunderstand, but if lighthouses should only be able to be used by their creator, then why not make the light house functions use actual abilities, removing the hero select all together.

If you need for other players to destroy light houses, or to interact with them in some other way, give them an ability that allows them to, instead of relying on select hero.

Maybe it's not an ideal solution, so if you don't like it... you should probably ask someone who knows JASS well. He could probably create a system for you that only selects user-heroes.
 
Level 7
Joined
Oct 14, 2008
Messages
340
I didn't read all these posts, so I'm not sure if this is a valid idea, but create a shop that instead of selling items, has dummy abilities, and use a custom trigger to select a nearby hero, then the use of those abilities gives the hero the item.. just an idea. Won't properly display gold costs though.
 
Level 5
Joined
Sep 21, 2005
Messages
119
Flowers, I need the lighthouse to be able to "sell" items, as it has some complicated triggers written from before that work with item charges based on the item manipulated, if i want the shop to sell items, then I need a selector.

Also, this isn't the only building, I also have a warehouse that sells seeds, and I definitely can't use that as an ability.

No other players should be able to interact with each others' buildings.

--
Maximilianx, that won't display the gold costs lol, in addition, you can't "stack" abilities in an icon, i need people to see the number of items left in stock, you just can't do that with abilities.
 
Level 3
Joined
Aug 4, 2009
Messages
54
Would a workaround be acceptable?

Perhaps try giving the shops a 6-slot inventory, and reduce the range of the "Select User" thing (or maybe that's a Gameplay Constants thing) to such an extent that the shop can only select itself?
 
Level 3
Joined
Aug 4, 2009
Messages
54
Well, the intent was to have the shop buy its own items, which would then be given to the player's hero/unit. But if that's the case... Wierd.

Do lighthouses (and other buildings) have to have their own demolish ability, as opposed to simply giving the player heroes a "demolish my own building" ability?
 
Level 9
Joined
Aug 27, 2009
Messages
473
And this is the lame way to do it:

Event:
Unit - comes 500 to unit
Condition:
Player - Owner of trigger unit not equal to <unit to come close to>
Action:
Unit - issue order to move to point with polar offset

Action Facts:
Point: Position of Trigger Unit
Distance: 300
Polar Offset: Angle of Trigger unit + 180

Its maby the lamest ever, but it works.. ^^
Remember to remove the point leak.
 
Level 6
Joined
May 1, 2009
Messages
215
The problem with a trigger like that is it could be exploited -- like players could block path ways with it.

Perhaps... can you make a trigger which won't demolish the building if a player who doesn't own the building uses the demolish ability?
 
Level 3
Joined
Aug 4, 2009
Messages
54
I tried to look for that when he replied to my post. Unfortunately the closest thing I could find was a boolean to the effect of "If player owning the unit is/is not selecting the unit," which could allow for "If the owner isn't selecting it, don't demolish."

...But, this would only work if the owner were, in fact, not selecting the shop at the same time as the jerk demolisher.
 
Level 5
Joined
Sep 21, 2005
Messages
119
@Loval: Thanks for the idea, I can't actually put any more abilities INTO my command card for the main builders, and I don't want them to be able to destroy ANY building they own, so there would be a lot of checks. Also, I would have to make sure the lighthouse drops any item given to it by someone else.. But I guess so far, that's the best alternative.

@eleljrk: lol nice try man, that trigger would not work in so many ways though!

@Flowers: I think there's a JASS way of checking the player that clicks something. :S hmm.

I'm going to keep trying things. I really wish we had someone who knew JASS here lol.

~Gloom
 
Level 5
Joined
Nov 7, 2007
Messages
134
If they're not supposed to be able to destroy just any building, then add a trigger that has a condition that says if Demolish is used on any other building than the ones that are supposed to be "demolishable" then order unit to stop. That would only require one extra trigger. But you said you're builders can't have any more abilities? Are all of the current abilities absolutely necessary?
 
Level 6
Joined
May 1, 2009
Messages
215
uhh wut? Clicking the building? I meant this
  • Events
    • A unit sells an item
  • Conditions
    • Building = Lighthouse true
    • Item = Demolish true
  • Actions
    • IF / THEN / ELSE
      • IF - CONDITIONS
        • (selling unit) is selected by (owner of (selling unit)) equal to true
      • THEN
        • <demolish trigger>
      • Else
"is selected by" is a boolean option

if that isn't desirable, you could do "is enemy of player eqaul to false" then think of a boolean which would keep allies from doing it... I'll try to think of one, but there must be one you can use.
 
Last edited:
Level 3
Joined
Aug 4, 2009
Messages
54
Right, but like I said,
  • (selling unit) is selected by (owner of (selling unit)) equal to true
does not exclude having the ability triggered by someone other than the owner of the shop.

If a hostile "ally" picked up on the Demolish ability/item, while the owner of the shop was coincidentally selecting the shop at the same time, the shop would go up in flames.

However, going on your idea that the Demolish would be an item instead of ability...

  • Demolish
    • Events
      • Unit - A unit Sells an item (from shop)
    • Conditions
      • (Item-type of (Sold Item)) Equal to DEMOLISH (item)
      • (Owner of (Buying unit)) Equal to (Owner of (Selling unit))
    • Actions
      • <Demolish>
Should work.
 
Level 9
Joined
Aug 27, 2009
Messages
473
  • Demolish
    • Events
      • Unit - A unit Sells an item (from shop)
    • Conditions
    • Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Item-class of (Item being manipulated)) Equal to <Demolish Item>
          • ((Hero manipulating item) is in (Units owned by (Owner of (Selling unit)))) Equal to True
        • Then - Actions
          • Item - Remove (Item being manipulated)
          • Game - Display to (All players) the text: ((Name of (Owner of (Selling unit))) + ( has demolished + ((Name of (Selling unit)) + !)))
          • <Demolish Actions>
        • Else - Actions
          • Item - Remove (Item being manipulated)
          • Game - Display to (All players) the text: ((Name of (Owner of (Hero manipulating item))) + (, you cant demolish a unit owned by + ((Name of (Owner of (Selling unit))) + !)))
This works better.. ^^
And if you want a Trigger to not allow other players to buy from the shop, i can make one. And also give the payed value back! ;)
 
Level 5
Joined
Feb 19, 2008
Messages
110
Why dont you just make dummy units to order the ships to move out. Would work exactly the same, the only problem would be the cooldown i think. :\
 
Level 6
Joined
May 1, 2009
Messages
215
This works better.. ^^
And if you want a Trigger to not allow other players to buy from the shop, i can make one. And also give the payed value back! ;)

How does this work better? You're just making a unit into a unit group... which may complicate things, depending upon the different abilities present in the map (like, what if the player had a charm ability? I know only hero units can purchase, but still - it's just uncessary to use a unit group).

Loyal's solution is best, as it leaves no room for error.
 
Level 9
Joined
Aug 27, 2009
Messages
473
How does this work better? You're just making a unit into a unit group... which may complicate things, depending upon the different abilities present in the map (like, what if the player had a charm ability? I know only hero units can purchase, but still - it's just uncessary to use a unit group).

Loyal's solution is best, as it leaves no room for error.

What makes it error? Answer that please.
 
Level 6
Joined
May 1, 2009
Messages
215
You never specify how the unit group that this hero is belonging to is created.

Is it created every 60 seconds of game time? That would bug because if a unit is charmed, it belongs to the unit group and could demolish, but would belong to another player.

Is it created every time the trigger fires? Then it won't bug, but it's still inane. You'll have to use a variable to represent it (otherwise it will leak) - and what good is it? Only one unit can purchase an item at a time, and if only heroes can demolish buildings, and players are limited to 1 per player, it's further inane because you're created a unit group with one unit in it.

The trigger does not need a unit group, it's inefficient. Loyal's trigger is better because it references the unit that is buying the demolish item and checks who owns it, there's no need for it to check that it's in a unit group, which is simply less specific - and the less specific you get, the more prone you are to complications later on and I'll use that knowledge for my own reference in the future.

I'm arguing this on principle, no harm to you, but I want to make my own triggers as effeciently time-wise and memory/process-speed-wise as possible, if you think your trigger is somehow superior, explain to me why a unit group is necessary for this.
 
Level 5
Joined
Sep 21, 2005
Messages
119
Guys. there's one problem with the Demolish triggers you've been submitting, the main player's villager doesn't have to be within range in order to demolish the building.. using your triggers, demolish is always an item.. I need it to be able to be used remotely.. =\

Remember this is a 2 part question: 1. Demolish the building should only be used by owner. 2. Sell items to owner only.

In the second case:
Also.. the problem with both solutions for buying item is that you're not accounting for the replenish stock interval that will be created in the shop ... even if you take care of the item sold being removed, it still creates (in my case) a 2min interval to replenish that items' stock in the shop, which ruins the Merchant career option for a player in my game. (Especially if the jerk ally can get their money back, cause then they can buyout the entire lighthouse.)

~Gloom
 
Level 5
Joined
Sep 21, 2005
Messages
119
Yeah I know but say using your triggers; an item is bought and it goes into the wrong hands so it is 'removed'. What happens to the shop, the item would be considered Sold Out and has to suffer the replenish stock interval.

Unless you mean they can be customized with Triggers, which I didn't know..
Can you modify the replenish interval of a single item in a shop so that it instantly restocks?

~Gloom
 
Level 5
Joined
Nov 7, 2007
Messages
134
Perhaps you could try "Reset ability cooldowns" for the shop, but that might not affect items.

In case the owner of the shop would buy an item, is it necessary that the item decreases in stock? Otherwise, you could just set the stock replenishment interval to 0, that way there will be no cooldown on the item even if an allied hero tries to buy from the shop.

A pretty radical solution could also be to replace the shop with an identical shop if an allied hero tries to buy from it, since then it will seem as if the cooldowns are reset. Though that might cause some other problems depending on how the map looks, and if you have any triggers attached to the shop.
 
Level 5
Joined
Sep 21, 2005
Messages
119
The interval is definitely needed, unless there is a way to REMOVE item from being sold at shop, in which case it's fine too. (as long as it comes back with triggers as well)

That radical solution isn't a bad one, but what if you only bought HALF of the items sincerely, then you could have an ally helping you out by resetting all the CD's for the owner.

Interesting Insight though,
~Gloom
 
Level 6
Joined
May 1, 2009
Messages
215
Yeah I know but say using your triggers; an item is bought and it goes into the wrong hands so it is 'removed'. What happens to the shop, the item would be considered Sold Out and has to suffer the replenish stock interval.

Unless you mean they can be customized with Triggers, which I didn't know..
Can you modify the replenish interval of a single item in a shop so that it instantly restocks?

~Gloom

???

look at an item

read

"stock maximum"
"stock start/stop delay"
"stock delay"

stock maximum controls max number of item that a shop can carry
stock start/stop delay controlls when a new item will be made (start refers to map initialization)
dely refers to normal delay after 1 item is created

setting delay start/stop delay to 5 gives a pretty fast restock

it's under item and unit data in obj editor

Seriously lol :p
 
Level 5
Joined
Sep 21, 2005
Messages
119
Sorry, perhaps I wasn't clear what I was saying..

I mean to say that the player is NOT ALLOWED to buy the item too quickly, there needs to be a 2minute interval between purchases. If there is a quick stock replenish rate, then the player will be able to spam merchant ships which will give him a lot of unfair gold.

On the other hand, if you leave the delays IN, then if you remove/add new-same-shop on the map with the delays removed, then it would restock ALL the items the shop has.

~Gloom
 
Level 9
Joined
Aug 27, 2009
Messages
473
Sorry, perhaps I wasn't clear what I was saying..

I mean to say that the player is NOT ALLOWED to buy the item too quickly, there needs to be a 2minute interval between purchases. If there is a quick stock replenish rate, then the player will be able to spam merchant ships which will give him a lot of unfair gold.

On the other hand, if you leave the delays IN, then if you remove/add new-same-shop on the map with the delays removed, then it would restock ALL the items the shop has.

~Gloom

It no way to remove a item, and then put it back to the shop.
You can move it to the position of the shop, but not inside the shop agein.

Thats GUI at least, maby in vJASS or JASS its possible.

But you could Remove selling unit and create selling unit on possition of selling unit. Thats possible..
 
Level 6
Joined
May 1, 2009
Messages
215
Sorry, perhaps I wasn't clear what I was saying..

I mean to say that the player is NOT ALLOWED to buy the item too quickly, there needs to be a 2minute interval between purchases. If there is a quick stock replenish rate, then the player will be able to spam merchant ships which will give him a lot of unfair gold.

On the other hand, if you leave the delays IN, then if you remove/add new-same-shop on the map with the delays removed, then it would restock ALL the items the shop has.

~Gloom

You can give Demolish 1 stock 1 sec start/stop 1 sec delay

You can give Merchant ships 1 stock 1 start/stop 1 sec delay

If a player other than the owner of the building purchases a Merchant Ship, it fails. Same goes with Demolish. If a player purchases Merchant Ships before 2 minutes are up, it will fail. Players will have to gauge how long 2 minutes is, but it's doable.

The only problem I can see with this are the seeds... you want them to have a stock that replenishes slowly but you can't have that if you're afraid allied players will buy them up to spite their allies, so you can't give them slow restock times ....

I think this problem can only be solved using JASS, there are just too many conditions for simple solutions to work.
 
Level 3
Joined
Aug 4, 2009
Messages
54
Also.. the problem with both solutions for buying item is that you're not accounting for the replenish stock interval that will be created in the shop ... even if you take care of the item sold being removed, it still creates (in my case) a 2min interval to replenish that items' stock in the shop, which ruins the Merchant career option for a player in my game. (Especially if the jerk ally can get their money back, cause then they can buyout the entire lighthouse.)
I seem to recall suggesting earlier that you could give the shops their own inventory, and reduce the range of their unit-selector such that they could only sell to themselves, thus allowing you to pick up the item/demolish at your leisure, and have the lighthouse give the item to the villager/hero when he gets near it. :\
 
Level 5
Joined
Sep 21, 2005
Messages
119
Alright SO.. I have the solution.

Basically, shops can't select themselves to sell to right away, so that good inventory idea had to be modified slightly.

Now, my solutions:

1) For the Demolish ability; Since I only had 2 buildings with that problem, I made a new item that looked exactly like the ability (except the "1" in stock), and I made the lighthouse/warehouse sell it. Then I had a simple trigger to check whether or not the Owner of Buying unit matched the Owner of Selling unit, and if it is, kill the structure. So that's that.

2) For the items. I created a new custom "Select Hero" ability where I lowered the activation and cast radii to 25.00. Then, I created a trigger which activated when a structure is completed. I then used JASS to create a local unit (a dummy with inventory that flies) above the lighthouse upon completion. I waited 3 seconds (as the Select Hero doesn't activate right away), then I ordered the lighthouse to "right click" itself lol.. then I removed the flying dummy.

I can explain in more detail as to why it works, but it just does. Everything is fine now and items can't be given to the shop as they automatically sell (except un-sell-able items, which I created a small trigger to drop them from the lighthouse)

Anyway. Thanks a lot for all of your insights and helping me get this trigger to work.
I hope this really helps anyone in the future trying to do something similar.

+Rep
~Gloom
 
Level 5
Joined
Sep 21, 2005
Messages
119
lol lightning, check the topic, we already discussed that, and there is no "Unit selects lighthouse" lmao, it's PLAYER selects, and yes you COULD deselect unit for player, but that means you can't necessarily attack it or even check the health of it.. so yeah.

Although, that would be a great short-term solution for anyone not wanting to bother in my weird solution.
~Gloom
 
Level 13
Joined
Mar 4, 2009
Messages
1,156
i know about 5 ways,but 1. one is a bit weird

1.)
remove all abilities in your shop (shop sharing,select hero)
(makeing your shop don't have pathing map would be good)

-unit is ordered with no target
-ordered unit equal to SHOP
wait 0 sec
-give random item from items in x range from position of shop to Your Hero

2.)
SIMPLE way (delay about 0.3 sec,if player is really,really,really fast he can buy item,try it but its hard.....)
player 1,2,3,4,5..... selects a unit
triggering unit equal to shop
owner of triggering unit not equal to triggering player
-clear selection for triggering player
-game text to triggering player:"you can only buy items in your own shop!"

3.)
if you do not have start delay on your items
have only select hero ability
(enemies cant buy but allies can)
like this you can have any requirements for your items

so you have a dummy upgrade called "Only player 1 can buy this item"

all items for player 1 require that upgrade....

map initialization
set current research of "Only player 1 can buy this item" to 1 for player 1 red

This way is a bit stupid because u have to have 3 same items for 3 players .....


4.)

make shop sharing ability have range 0.01
put hero-dummy unit under your shop

when dummy unit acquires an item
give acquired item to Your Hero

(shop must have pathing map (i think arcane tower is enough)

BTW i suggest 4. or 2. way

If your map has more heroes i think you will have to give item to SELECTED hero
 
Level 5
Joined
Nov 7, 2007
Messages
134
Alien, check like two posts up and you'll see the problem is already fixed >.<

Should probably get an admin to lock this thread or something.
 
Level 13
Joined
Mar 4, 2009
Messages
1,156
i found one more way xD

Problem-shop will not have a display icon


so you do one shop that is just model and nothing else
(no icons,no abilities)
i will call it

SHOP "MODEL-PASS TO REAL SHOP"

than the real shop has no model (hold shift+enter and type .mdl on model file)
on that way real shop is unselectable for players
put real shop under fake one that is just a model

i will call it "NO MODEL,REAL SHOP"

every player that has event in this trigger will be able to go to real shop

player 1 selects a unit
player 2 selects a unit
-triggering unit equal to SHOP MODEL-PASS TO REAL SHOP
select NO MODEL,REAL SHOP for (triggering player)

This way is very good but you will not have display icon...i think its not matter at all.. -.-
 
Status
Not open for further replies.
Top