The Daily Click ::. Forums ::. Klik Coding Help ::. Inventory system
 

Post Reply  Post Oekaki 
 

Posted By Message

lembi2001



Registered
  01/04/2005
Points
  608

VIP MemberIt's-a me, Mario!Wii OwnerI like Aliens!Has Donated, Thank You!PS3 OwnerI am an April Fool
21st April, 2008 at 12:27:07 -

I have created a working inventory system which uses data store x to load and save the data but i have come across a huge issue which will need a lot of coding....
When a selection is made for the part of the body the inventory system then displays all objkects related to that part of the body:

for instance. clicking on a hand will display a wieldable objects. Legs will display a wearable objects etc...

The problem is that i am having to manually check whether an item has been collected the display it if it has. I am doing this using the code

Only one action when event loops
+Global Sore X integer (number) <> 0
+Selection Tree Object = Hand

(Using tree object to isplay things a certain way.)

you can see that for over 100 objects this is going to be a lot of work so i was wondering if anyone knows of a quicker way of doing things.

 
n/a

Cecilectomy

noPE

Registered
  19/03/2005
Points
  305

Has Donated, Thank You!VIP MemberWeekly Picture Me This Winner!Cardboard BoxGhostbuster!Pokemon Ball!ComputerBox RedSanta HatSnowman
I am an April Fool
21st April, 2008 at 13:32:41 -

how does data store object work?

is it an array? if so how many dimensions?

when working with arrays or lists you need to use loops and indexes to run through and check things. if possible you can have a preset or loaded list of items that correspond to numbers that would be in the data store object to check against.

 
n/a

lembi2001



Registered
  01/04/2005
Points
  608

VIP MemberIt's-a me, Mario!Wii OwnerI like Aliens!Has Donated, Thank You!PS3 OwnerI am an April Fool
21st April, 2008 at 15:37:59 -

it is sort of like an array but can be used to store strings, integers, booleans and shorts <-- not sure what they are

i have set up the strings and integers to load upto 999 records for each of them.

 
n/a

Windybeard Games



Registered
  14/04/2005
Points
  219

You've Been Circy'd!VIP MemberCandy Cane
22nd April, 2008 at 16:39:23 -

i dont know but to code 2 lines 100 times wouldnt take more than 30 mins if its the same code over and over with only a small difference.

Im always having this trouble, mainly cause i cant get my thick skull around fast loops, and i dont think i ever will. I take the LOOOONG route to success but god damn does it taste sweet....like cakes! but not rice cakes as they are more of the savoury persuasion.

 
n/a

Del Duio

Born in a Bowling Alley

Registered
  29/07/2005
Points
  1078

GOTW WINNER CUP 1!GOTW WINNER CUP 2!GOTW WINNER CUP 3!GOTW WINNER CUP 4!Evil klikerHasslevania 2!The OutlawSanta Boot
24th April, 2008 at 09:04:18 -


Originally Posted by Antworx
i dont know but to code 2 lines 100 times wouldnt take more than 30 mins if its the same code over and over with only a small difference.

Im always having this trouble, mainly cause i cant get my thick skull around fast loops, and i dont think i ever will. I take the LOOOONG route to success but god damn does it taste sweet....like cakes! but not rice cakes as they are more of the savoury persuasion.




Hahaha, I take the longest route to success also. It's good to see others who code improperly

My computer teacher in high school told me that before too, but this was BASIC (1992).

 
--

"Del Duio has received 0 trophies. Click here to see them all."

"To be a true ninja you must first pick the most stealthy of our assorted combat suits. Might I suggest the bright neon orange?"

DXF Games, coming next: Hasslevania 2- This Space for Rent!

Assault Andy

Administrator
I make other people create vaporware

Registered
  29/07/2002
Points
  5686

Game of the Week WinnerVIP Member360 OwnerGOTM JUNE - 2009 - WINNER!GOTM FEB - 2010 - WINNER!	I donated an open source project
24th April, 2008 at 20:15:35 -

One good way of doing it would be to store the inventory objects as values in a list/array. Then for each object you have one different item as a different animation.

You can then simply run a fast loop through all the objects in your inventory and then set its animation to the value retrieved from your inventory.

eg.
List of objects in your inventory:
14
12
8
5
3
11

Each object represents a different object (3 might be a sword for example.)

Then you have your 'slots' - each slot has 100 animations (or however many objects you have.) and each animation corresponds to a different object. So instead of manually having to say if x = 3, then set the picture to a sword, all you have to do is say:
Set [animation of slot] to [value from list].

 
Creator of Faerie Solitaire:
http://www.create-games.com/download.asp?id=7792
Also creator of ZDay20 and Dungeon Dash.
http://www.Jigxor.com
http://twitter.com/JigxorAndy

lembi2001



Registered
  01/04/2005
Points
  608

VIP MemberIt's-a me, Mario!Wii OwnerI like Aliens!Has Donated, Thank You!PS3 OwnerI am an April Fool
25th April, 2008 at 17:26:38 -

@Assault Andy - this sounds like the method i was using but the problem is i want it to display ONLY the objects you have acquired in your inventory. this way the playerr can pick and choose what they equip.

 
n/a

Assault Andy

Administrator
I make other people create vaporware

Registered
  29/07/2002
Points
  5686

Game of the Week WinnerVIP Member360 OwnerGOTM JUNE - 2009 - WINNER!GOTM FEB - 2010 - WINNER!	I donated an open source project
25th April, 2008 at 21:16:58 -

I didn't explain myself well.

Here's an example:
http://myfreefilehosting.com/f/c71282767b_0.03MB

You can load hundreds of items with a few lines of code.

 
Creator of Faerie Solitaire:
http://www.create-games.com/download.asp?id=7792
Also creator of ZDay20 and Dungeon Dash.
http://www.Jigxor.com
http://twitter.com/JigxorAndy

lembi2001



Registered
  01/04/2005
Points
  608

VIP MemberIt's-a me, Mario!Wii OwnerI like Aliens!Has Donated, Thank You!PS3 OwnerI am an April Fool
26th April, 2008 at 16:52:18 -

Cheers Andy. I'll take a look at that.

 
n/a
   

Post Reply



 



Advertisement

Worth A Click