Forum Overview :: Wasteland 2
 
Multi-dimensional array? 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.
PREVIOUS NEXT REPLY QUOTE
 
Saving characters and character items by Ice Cream Jonsey 07/24/2012, 10:56am PDT NEW
    damn that seems backwards by jeep 07/24/2012, 9:46pm PDT NEW
        Re: damn that seems backwards by N 07/25/2012, 9:50pm PDT NEW
        Re: damn that seems backwards by Ice Cream Jonsey 07/25/2012, 9:54pm PDT NEW
    Wherein I make a load of assumptions by Entropy Stew 07/25/2012, 4:36pm PDT NEW
        Re: Wherein I make a load of assumptions by Ice Cream Jonsey 07/25/2012, 10:01pm PDT NEW
            yw! by Entropy Stew 07/25/2012, 10:39pm PDT NEW
                Also by Entropy Stew 07/25/2012, 10:52pm PDT NEW
                    Re: Also by Ice Cream Jonsey 07/27/2012, 6:17am PDT NEW
    Multi-dimensional array? by Flack 07/25/2012, 5:30pm PDT NEW
        Re: Multi-dimensional array? by Ice Cream Jonsey 07/25/2012, 9:48pm PDT NEW
 
powered by pointy