|
by Flack 07/25/2012, 5:30pm PDT |
|
 |
|
 |
|
Would it be possible to track items in some sort of multi-dimensional array? For example, "Sword,X,Y,Z" where X would be how many of an item exists, Y would be what number out of X this particular sword is, and Z would be what character owns it.
So for example if Joe the Barbarian (character #35) found the first of 20 long swords, it could be stored as "Long Sword, 20, 1, 35". You could do some simple checking to ensure that Y is never greater than X (can't have sword #21 ...). You could even extend the array to store some other information like whether or not an item is magical (or cursed?), whether or not it's currently armed, what class it's in (weapon, armor, etc), maybe even how much damage it does. If each category was a number (weapon is 1, armor is 2, helmet is 3, etc) then if a character tries to put on a helmet it would check to make sure no other helmet is currently being worn.
I should note that the last two things I coded for work failed spectacularly so ... there ya go. |
|
 |
|
 |
|
|
|
Saving characters and character items by Ice Cream Jonsey 07/24/2012, 10:56am PDT 
damn that seems backwards by jeep 07/24/2012, 9:46pm PDT 
Re: damn that seems backwards by N 07/25/2012, 9:50pm PDT 
Re: damn that seems backwards by Ice Cream Jonsey 07/25/2012, 9:54pm PDT 
Wherein I make a load of assumptions by Entropy Stew 07/25/2012, 4:36pm PDT 
Re: Wherein I make a load of assumptions by Ice Cream Jonsey 07/25/2012, 10:01pm PDT 
yw! by Entropy Stew 07/25/2012, 10:39pm PDT 
Also by Entropy Stew 07/25/2012, 10:52pm PDT 
Re: Also by Ice Cream Jonsey 07/27/2012, 6:17am PDT 
Multi-dimensional array? by Flack 07/25/2012, 5:30pm PDT 
Re: Multi-dimensional array? by Ice Cream Jonsey 07/25/2012, 9:48pm PDT 
|
|