The Daily Click ::. Forums ::. Klik Coding Help ::. Making a large inventory in TGF (100+ items)
 

Post Reply  Post Oekaki 
 

Posted By Message

Mr Fwibbles



Registered
  12/08/2006
Points
  8
16th August, 2006 at 17:06:17 -

Hi,

This is my first post here. I'm having a problem with TGF and it's driving me insane; none of the tutorials are really helping with what I want to do. Basically, I'm using an INI to keep track of an RPG-style inventory for items. Currently it's programmed to accept entries for 30 slots, but I could narrow that down for testing purposes. I don't need any help with saving to INI - the problem is the way I want to load in the data. Since I intend for the finished game to have hundreds of items, that's 100x30 lines of "code" for the various possibilities, and manually coding it like that is impossible since TGF appears to only accept 1024 lines for a single "level". I also want the scope for releasing patches with more items later on, so I don't want to tie myself down by saying something like "it will have exactly 123 items" or whatever.

What I want to do is have an inventory screen ("level") that displays icons (active objects) to show what you're carrying in each slot. The only inventory tutorials I've seen involve either edit objects (which I very much do NOT want to use, because you just get dull plain text and your game looks like it was made for DOS), or have a very limited number of items and thus do not have this "1024 lines" problem.

For some images depicting my problem, please see http://grandia.rpgplanet.gamespy.com/carro/ (I'm using style 2). Is there any way I can do this in TGF? Maybe I need a plug-in? People have suggested using loops to load the data, but I wouldn't know where to start. MMORPG makers, this is directed at you especially! How can I get this to work?

 
n/a

Deleted User
16th August, 2006 at 17:31:59 -

Im sure more people will answer, but im making an example to show you how i wouldve solved it. I think i know a pretty good idea...

 

defenestrator

Old

Registered
  12/07/2003
Points
  724
16th August, 2006 at 17:58:09 -

Mr Fwibbles, do you smoke crack?
I don't understand why you need 100 lines of code for each slot. If you have 100+ items and 30 slots... here, try this:

-Make an extra counter object.
-Give each item an identifying number. You can use one of the alterable values for this. Just make sure you use the same alterable value for each item (but, of course, a different identifying number). So, healing potions would have an identifying number of 1, for example.
-Whenever the cursor is over a slot, set the new counter to that item's identifying number. Then, you change the text according to what the counter says. So, if the counter says 1, you have the description text says something like, "This is a healing potion. It tastes like chalk, but will heal you."

That should resolve the problem you describe, unless I am the one smoking crack and I have totally misunderstood what the problem was.

 
n/a

Ski

TDC is my stress ball

Registered
  13/03/2005
Points
  10130

GOTW WINNER CUP 1!GOTW WINNER CUP 2!GOTW WINNER CUP 3!KlikCast HelperVIP MemberWii OwnerStrawberryPicture Me This Round 28 Winner!PS3 OwnerI am an April Fool
Candy Cane
16th August, 2006 at 17:59:34 -

We found Cannabis plants in my grandmas garden today. It turns out it was quite innocent, the bird seed she buys contains hemp seeds or something, my uncle was trying to explain lol

 
n/a

Mr Fwibbles



Registered
  12/08/2006
Points
  8
16th August, 2006 at 18:09:06 -

Defenestrator, displaying the description text isn't the problem. It's getting the relevant active object ("item") to create/position inside the "slot" without making an individual event for each active object. I don't have much experience with alterable values, could you please make an example .gam for me?

Image Edited by the Author.

 
n/a

defenestrator

Old

Registered
  12/07/2003
Points
  724
16th August, 2006 at 19:27:40 -

Oh, yeah. I think TGF only allows 3 alterable values per active object. I mean, you only need one, but... yeah, I forget a lot of the TGF stuff because I don't have it installed any more, which is also why I can't get you an example.

If it's the placement of things in the inventory that you're worried about, you can use the same system as I described before. I guess you don't need to worry about the alterable values as long as you have some way of keeping track of all your items. Number all your items and write it down someplace. You can use these numbers in your INI too, if you like. Let's pretend you've done that, so the hero has 30 slots. In slot one, he has a healing potion (ID number 1). In slot 4, he has a Elf Decapitation Sword (ID number 12). Slots 2 and 3 are empty (ID 0). So, when you display the inventory, you have two unseen counters and an active object. One counter is the Slot Number and the other is the Inventory ID Number of the current item. The active object is what will be used to tell the program where to place the item. The Slot Number's default value should be 1 because you want to start with the first number. You'll need 30 actions for the slots. So, if Slot Number=1, you place the Active Object at the x and y coordinates of the first slot. You also set the Item ID Number counter to whatever item ID is in the first slot in the INI. Use the "retrieve value from object" or whatever it's called. That's all you do. Now, make 29 other actions just like that one, for each of the different slot numbers. So, if Slot Number=2, move Active to where slot 2 is and change the Item ID Number to whatever slot 2 shows in the INI. Now, once you have 30 of those, you need 100 actions for the items. In each, you'll tell the program what to do if the Item ID Number is equal to a certain value. So, if Item ID Number=1, create healing potion at Active Object and add 1 to Slot number. Now don't tell me it doesn't work or that you don't understand or I will find you and eat you.

 
n/a

Deleted User
16th August, 2006 at 19:37:15 -

Im gonna do an EASY solution. Wait a couple of minutes and its done.

 

Deleted User
16th August, 2006 at 19:56:04 -

Im way too tired to make a more detailed example ^^'
Sorry! I apologise.

But this might give you an idea on how to do it
http://www.freewebs.com/klik-domain/Solution.gam
Click the inventory boxes to change items.
The thing it does is use one direction for each different item. With more than 32 items, just make it display another animation if its itemnumber is greater than 32.

Hope it helps a bit

 

Joe.H

Evil Faker

Registered
  19/08/2002
Points
  3305
16th August, 2006 at 19:59:55 -

You could use the picture object, and load an image from a string in an ini file to display different objects.

 
My signature is never too big!!!

Deleted User
16th August, 2006 at 20:00:25 -

Or use my fantastic idea

 

Joe.H

Evil Faker

Registered
  19/08/2002
Points
  3305
16th August, 2006 at 20:15:58 -

but your idea stores an ini file in the windows directory instead of somewhere people will look when deleting the game >.<

 
My signature is never too big!!!

Deleted User
16th August, 2006 at 20:37:45 -

Yes cuz im clever

 

Joe.H

Evil Faker

Registered
  19/08/2002
Points
  3305
16th August, 2006 at 20:48:13 -

you could use appdrive$ + appdir$ + "file.ini" in the event editor >.>

 
My signature is never too big!!!

DanielRehn



Registered
  18/09/2002
Points
  139
16th August, 2006 at 21:53:04 -

Don't store stuff in the windows folder ffs! -.-

 
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
17th August, 2006 at 21:47:39 -

This may or not help you, but what I did for Captain of the Guard 2's small inventory is along the lines of what defenestrator is talking about. I had 3 counters, each of which had 10 pictures to them. Like this:

Animation Frame / Value:

1 = Empty Box
2 = Red Water
3 = Blue Water
4 = Killer Fart
5 = Bowling Ball
6 = Electric Shield

etc, etc..

Then, I used an array to store the actual values of what Daxon had on him, where the array's values called up the picture box like this- Array Value(1) = 2 meant that in box #1 he had a Red Water, and it showed a picture of the Red Water in the first inventory box. It's pretty simple-ish, and I don't know if it'd be good for a big inventory like you're planning, but maybe that will give you some ideas for what you want to try.

 
--

"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!
   

Post Reply



 



Advertisement

Worth A Click