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

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 http://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.
 
Level 3
Joined
Nov 28, 2010
Messages
42
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.
 
Level 3
Joined
Nov 28, 2010
Messages
42
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.
Top