• 🏆 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!

Sell item to one player only?

Status
Not open for further replies.
Level 5
Joined
May 12, 2014
Messages
133
So I have a shop that sells "teleports" to places. If I want only one (or more) people to be able to buy a certain item while everyone else can't, how can I do this? There is only 1 shop and everyone uses it.
 
Level 12
Joined
Jan 4, 2014
Messages
543
I'm not the best at triggers, but the way i'd do it is
1. Create a variable (Player Group) that will represent each of the teleports
2. Add the players you want to the Player Group you want them to be able to use
3. Create an item representing each teleport (An empty consumable should be preferred)
4. When a unit acquires item equal to teleport, check if owner of unit is in player group that corresponds to the teleport, if not display a game message saying that they cannot use this teleport
 

Ardenian

A

Ardenian

There are many ways doing this, I think.

Easiest:
A dummy shop.
Add to the shop a dummy ability like 'Open Teleporter section'. If a unit uses this ability, then the current selection of the player is changed to an invisible dummy shop which sells the items.
You create one dummy shop per player, use a unit variable with an array to store the dummy shops and upon event select DummyShop[Playernumber] for the triggering player.
 
Level 5
Joined
May 12, 2014
Messages
133
I'm not the best at triggers, but the way i'd do it is
1. Create a variable (Player Group) that will represent each of the teleports
2. Add the players you want to the Player Group you want them to be able to use
3. Create an item representing each teleport (An empty consumable should be preferred)
4. When a unit acquires item equal to teleport, check if owner of unit is in player group that corresponds to the teleport, if not display a game message saying that they cannot use this teleport

I can't say I really want to do this. imo this sort of leads to confusion when you see something you can buy and then nothing happens when you do buy it. My own preference would be something like research requirements. Where you can't buy the item in the first place unless you have the research for example.
There are many ways doing this, I think.

Easiest:
A dummy shop.
Add to the shop a dummy ability like 'Open Teleporter section'. If a unit uses this ability, then the current selection of the player is changed to an invisible dummy shop which sells the items.
You create one dummy shop per player, use a unit variable with an array to store the dummy shops and upon event select DummyShop[Playernumber] for the triggering player.

I'll probably do this at a later point in time if I get really creative with teleporting, but it feels a bit clunky to me as there are only 3 teleports to be used. Although some people will only have access to 2 of them.

If no one has an awesome way of doing it, then I'll just settle for Bacon's way.
 
Status
Not open for further replies.
Top