RPG inventory system

For questions about using Classic.

Post » Fri Apr 08, 2011 7:32 pm

Hello,
In my game player's progress is stored in the hash. We've got there statistics and decisions player made. There are 10 inventory slots named as ItemSlot-x, where x is nuber of a slot. Item-slot-x stores string - name of the item, which is used to reffer to hash values containing info about item. For example: Player gets a pipe, simplest weapon. ItemSlot-1 contains "Pipe". When player attacks, game reffers to newly created hash values: Item-Pipe-AttackBonus, Item-Pipe-Strenght and Item-Pipe-WhiteW (as players with special skill uses white weapons better than others), so yes, it's like Item-[value of ItemSlot-1]-SpecifiedStat
The question is: how to write down all the statistics of an item on the inventory screen or delete all of Item-Pipe-* values along with the item? You see, they cannot be constant, as there is "handyman" skill which can upgrade some items.
B
1
G
1
Posts: 2
Reputation: 429

Post » Sun Apr 10, 2011 2:40 am

The examples in this thread might help you out.

viewtopic.php?f=3&t=8122&p=62428&hilit=inventory#p62428

Not sure I really understand your problem from your post, but I believe the examples will help.

If I do understand it...I don't see a good reason to store the item powers and other stats in a hashtable. It makes more sense to store those in an array or to just compute them all on the fly. You could have a base array with all the default values for the item, # items, power, weight, attack bonus, etc. Then you could use the hash table to store the name of the item and the value would hold the index to the array. To delete an item you simply remove it from the hashtable. I did something similar in the Mikeys Adventure tutorial part 5: viewtopic.php?f=8&t=4421
B
8
S
3
G
7
Posts: 835
Reputation: 5,313


Return to Help & Support using Construct Classic

Who is online

Users browsing this forum: No registered users and 1 guest