• Check out the results of the Techtree Contest #19!
  • 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 void inspired texture for Warcraft 3 and enter Hive's 34th Texturing Contest: Void! Click here to enter!
  • The Hive's 22nd Icon Contest: Creep Abilities is now concluded, time to vote for your favourite set of icons! Click here to vote!

Make an Unit Inventory to a shop

Status
Not open for further replies.
Level 3
Joined
Nov 28, 2010
Messages
42
Hello!

I'm making an Rpg at the moment and i want to create a system where you can trade with NPCs that travel around the world.

These NPCs sell an Item that is called 'trade'. If you buy that a shop appears in front of the player.

Now the part where i need help.

I want the shop to sell the Items that the NPC has in his Inventory. For Example: The NPC has a healing potion. You click on trade and in the shop there is a healing potion.

Hopefully you can help me. Sorry for any grammar or spelling mistakes, im not american.

Taz Dingo
 
First, you need to create a https://www.hiveworkshop.com/forums/general-mapping-tutorials-278/shop-within-shop-193048/

If you did that, you can create a trigger that changes the stock of said merchant based on the items in his inventory.

You need to create triggers for the following cases:

--> if the player trys to get access to the inner shop, loop through the inventory and add those items to the stock
--> if a player buys an item from the shop, remove the inventory item and the stock item
--> if a player sells an item to the shop, add this item to the inventory and to the stock

However, I think having a shop with an actual inventory might bug in several cases (as selling and item to the shop and giving an item is done by the same player action: right clicking an item in inventory and left clicking the unit), so you might want to not make that unit allied, so that one of these possibilities is disabled.
 
Thanks for your reply!

Is it possible to create it like i described it?

A new building is created and this is the shop. Not shop within a shop.
 
Could you maybe show me how i do it with variables?

These NPCs will go around and collect items. They never have the same Items in the same game. I created 6 variables. Each of them save 1 inventory slot. But i can't find an option where i can add these variables to the shop.
 
Status
Not open for further replies.
Back
Top