View Full Version : Inventory Thread
Lord Rahl
July 17th, 2005, 12:52 PM
Alright, its been awhile since i'v been online and on this site. But, i'll put it straight out. I am making a game that follows the story of a book i'm writing. So far I have:
1.)The main characters made and in MC's.
2.)The main character MC that the player will be playing as.
3.)Title menu, control menu, etc.
4.)Wall collision and background design.
5.)Doors and barriers.
6.)Random battle script.
7.)Battle system.
8.)Custom music made in Fruityloops.
There are perhaps a few other things I have, but in general I have all the basic things I need for the game to play except one thing that I think every RPG needs. A inventory system. Though i'm not sure how i'm going to do it. Perhaps like a similar style like the FF series. I also gotta make a save system as well now that I think about it. Anyone got a good web address for saving information in cookies? Oh, and the main point of this thread was to ask for help on the inventory system. Thanks
Enix591
July 17th, 2005, 02:28 PM
For your inventory, you can use an regular array, and add the new items to it when you hit them, using the "Array.push(Value)".Then when you use them, you would Remove them from the array using the "Array.slice(Index)", also executing a specified function.
For saving, send the variable/Array to a php file using the "Loadvars.send()" the in php you can put the vaibles in one long string where each variable and value are separated by the "&" symbol,then open and write the variables to a text file using the "fopen(Name,Action)" and "fwrite(Text)" php functions.Or if you were making a online game you could write it to a database.
For Loading,load the vaiables from the text using the "LoadVars.load()" and write them to some new variables in the flash.
Lord Rahl
July 17th, 2005, 08:49 PM
Ok, great. So now I got a basic idea of what I should do for those sections. But still some questions in how to do this. How would I go about setting this up, and making it so the items in the array are in a layout like in the FF series. Like the picture layout I attached, and when something new is added it places it in the next empty spot underneath or to the right or left of last item. If the item is already in the inventory then it adds a quanity number beside it. Get what I mean? I'll end this at that for the moment, before pressing on with my question attacks. =D thanks so far!
Enix591
July 17th, 2005, 11:00 PM
This '.fla' shoud help you out some.Check out the attachment.
Lord Rahl
July 18th, 2005, 11:57 AM
Oh, very nice Enix. That should give me enough info to start the inventory, just need to add some stuff. Like quantity numbers next to the name and such. But very big help. Thanks :smirk:
Enix591
July 18th, 2005, 02:45 PM
Oh, very nice Enix. That should give me enough info to start the inventory, just need to add some stuff. Like quantity numbers next to the name and such. But very big help. Thanks :smirk:Before you say thanks here is an update that covers quatities.I once tried to make an rpg and know how hard it was to do so,in the end i stopped the project and deleted it but i still know the troubles, so i dont mind helping someone else out.Check the attachment.You should copy some of the items on the screen just to make sure and see how it works.
Smee
July 19th, 2005, 12:40 AM
I'm building an RPG right now too (Who isn't?) with someone, and something I've noticed is that every RPG needs a somewhat "tailor made" inventory. Every time I make something with an inventory of some sort, I try to just copy and paste from it one of my previous attempts. That hasn't worked yet, because each game tends to use the inventory differently.
One thing I keep among all of them is that I use an object to store the information of the item, and another object to store how many of each item I have. Here is an example (Please excuse the long variable names):
List_Of_All_Items_In_The_Game = {
Big_Bad_Blade: {
damage: 20,
price_Buy: 100,
price_Sell: 50
},
Proficiently_Purifying_Potion: {
health: 200,
mana: 200,
price_Buy: 250,
price_Sell: 125
}
}
inventory = new Object();
function changeItemSupply(itemName, amount){
if(inventory[itemName] == undefined){
inventory[itemName] = 0;
}
inventory[itemName] += amount;
if(inventory[itemName] <= 0){
delete inventory[itemName];
}
}
// When items are to be given
changeItemSupply("Big_Bad_Blade", 2);
changeItemSupply(" Proficiently_Purifying_Potion", 5);
// When items are to be taken
changeItemSupply("Big_Bad_Blade", -1);
changeItemSupply(" Proficiently_Purifying_Potion", -3);
That should allow for basic managment, then you can "tailor" your game to pull stuff out of there as it needs it.
Lord Rahl
July 19th, 2005, 12:36 PM
Thanks so far. Enix, checking out your file and its script and its great so far. May have other quetions though so I may post back later. Thanks
Smee, interesting script. Gonna check it out. May have questions in a bit about it as well.
badmonur
March 10th, 2006, 02:21 PM
My inventory is kinda different and I wonder if you could help whith it.
if you see the flash file link below, you will see that there is a potion, an inventory box, and a person constantly holding out his hand.........thats my inventory system and have no idea how to make it work. I want to have an item in the game area and when you drag it out to the inventry box it registers the item so you cant take it back out into the game area, and if you want to use it, drag it over to the person holding out his hand and the player will use the item so that it disappears
http://www.rapidsharing.com/aa578bcc44b975a3ec3c814b6dee9df0
ricer
April 2nd, 2006, 04:15 PM
link is broken please rehost
xxj4dx
August 5th, 2006, 12:57 PM
when i tried to open the TestInventory.fla it said "unexpected file format", i too am in need of a good inventory and saving system, if you could post it as like mx or somthing that would be auaome :)
xxj4dx
August 13th, 2006, 08:48 PM
still sosent work :( but i tried to make my own :pleased: but ended up with like a cave man inventory:drool: its like, the itemes are in the inventory and wen u buy them :hitman: the x/y changens so you can view and equip :nerd:
now i have to find a way to equip more that one :beer: item :hitman2:
hope that helped some body somewere.... out there... in the world :smirk2:
muhahahahahahaha(cough) gack!(weeze)... i swalowed my mint :hugegrin:
Powered by vBulletin® Version 4.1.10 Copyright © 2012 vBulletin Solutions, Inc. All rights reserved.