Hey,
I am trying to think of a way to store a characters inventory in an RPG style game. I wasn't sure how it's normally done, but what I could think of so far was the following:
Items have a unique ID number. This ID number corresponds to their position in a list.
Ex. a one-hand sword ID#4.
LDAMAG(4) would be the swords damage.
LCOSTS(4) would be the swords cost.
etc.
Issue being the name, since it seems I would need to store the alphabetical numeric in a list. This would mean you don't know the length of the name. I suppose you could have a name maximum, let's say 20 characters. So you would do ID#4 is position 80-100 in LNAMES. So you pull those 20, and drop the empty positions.
So, when the user goes to their inventory, you would loop through a list with their item IDs they own, and then pull the data from individual lists based on the ID to display and allow them to use.
Is there a much easier way to go about this?
I am trying to think of a way to store a characters inventory in an RPG style game. I wasn't sure how it's normally done, but what I could think of so far was the following:
Items have a unique ID number. This ID number corresponds to their position in a list.
Ex. a one-hand sword ID#4.
LDAMAG(4) would be the swords damage.
LCOSTS(4) would be the swords cost.
etc.
Issue being the name, since it seems I would need to store the alphabetical numeric in a list. This would mean you don't know the length of the name. I suppose you could have a name maximum, let's say 20 characters. So you would do ID#4 is position 80-100 in LNAMES. So you pull those 20, and drop the empty positions.
So, when the user goes to their inventory, you would loop through a list with their item IDs they own, and then pull the data from individual lists based on the ID to display and allow them to use.
Is there a much easier way to go about this?