nested types (a la rpg inventory system)
Blitz3D Forums/Blitz3D Beginners Area/nested types (a la rpg inventory system)
| ||
hiya. haven't visited the blitz language in a while and trying to dust off the skills.i was trying to write a simple inventory (well, really a shop ) system for a equally simple rpg type game. i have types set up for various items (potions/swords/armor/etc). something like this: Type potion Field ID% ;id number associated to the potion Field name$ ;name of the potion Field potType% ;type of potion 1=heal,2=buff, etc Field value% ;buy/sell value of potion End Type then have a type set up for the shop Type shop Field ID% Field name$ Field owner$ Field potions.potion Field armors.armor Field swords.sword Field sellerGold% End Type and here is where my brain is sorta getting fuzzy: ;make a potion potions.potion=New potion potions\ID=1234 potions\name="healing elixir" potions\potType=1 potions\value=20 ;make a shop shops.shop=New shop shops\ID=4567 shops\name="house of goods" shops\owner="yo mamma" .... ... . pretty much, i'm trying to achieve creating the items and assigning them to the shopkeepers shop. does that make any sense? i suppose the same would be true for a "inventory" system (like what items are being carried on a player, etc. right? any direction here would be nice,or a codearchive/thread i've missed in my search. thanks much. edit: i guess i overlooked this link: http://www.blitzbasic.com/Community/posts.php?topic=41453 i'm guessing this would be the way to do what i'm thinking? |
| ||
An array is a "Box" to store things in so....... A List is a "List" of things so ....... Basicly, make potions field of Shop either an array or a list. If you have a small number of shops, with a limeted shelf space, go for an array. If shelf space isnt limeted then list Note Maybe you would be better with a "types of Potion Type", then each potion would have a field for typeofpotion |
| ||
@DQ: If you will need to perform checks against the players inventory you might want to check out --> this. I'm using this system to perform checks against everything the Player can do in my FPSRPG game. Use the Item's ClassID and ID to point to a specific Custom Type record with more details. A simple Select...Case should do the job easily. Example: |
| ||
fan-freakin-tastic. thanks.. i'll take this and run with it and see where i get. :D |