• 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.
  • Vote for the theme of Hive's HD Modeling Contest #7! Click here to vote! - Please only vote if you plan on participating❗️

[General] Simple Shop System

Status
Not open for further replies.
Level 9
Joined
May 21, 2014
Messages
580
Hello again, Hive.

I am planning to make a simple Shop System where items bought by a buyer will be automatically bought by other units surrounding the buyer with the corresponding costs.

I just don't know how to detect the unit that is targeted by the shop.

I also have a question of what is the proper way of doing this. Storing the buyer to a variable won't work, but there can be an instance where there are more than 1 players who are going to be in the shop, or one or more units of a player can go into different shops.

Thanks! :ogre_kawaii:
 
An array will do fine.

Setup:
set ItemType[1] = crown of kings
set ItemCost[1] = 500
set ItemType[2] = blades of attack
set ItemCost[2] = 200
set ItemMax = 2 (the highest array number from the list)

On purchase:
for loop Integer_A from 1 to ItemMax do:
if item type of item being manipulated equal to ItemType[Integer_A] then set temp_cost = ItemCost[IntegerA]
 
Level 9
Joined
May 21, 2014
Messages
580
Level 9
Joined
May 21, 2014
Messages
580
An array will do fine.

Setup:
set ItemType[1] = crown of kings
set ItemCost[1] = 500
set ItemType[2] = blades of attack
set ItemCost[2] = 200
set ItemMax = 2 (the highest array number from the list)

On purchase:
for loop Integer_A from 1 to ItemMax do:
if item type of item being manipulated equal to ItemType[Integer_A] then set temp_cost = ItemCost[IntegerA]

I have reimplemented my Bulk Buying System into Array format since my last hashtable had bugs due to lack of knowledge of hashtables.

Then, I suddenly realized that I have not implemented (even in hashtables) detecting the stock amount of the item. How do I get the remaining stock value of the item in shop?
 
Status
Not open for further replies.
Top