Inventory Tutorial?

Don't know how to make something and can't find a tutorial? Ask for one here.

Inventory Tutorial?

Postby BlenderFreak » Wed Nov 03, 2010 7:56 am

Screenshot-Lighttest.jpg
Screenshot for "The Nightmare Sword".
I do not take credit for the building models in the background, though I did do several tweaks to them. The sky, lighting, ground, and characters, however, are mine, as are all of the 2D sprites used to create this scene.

So it's been a while since I've posted any questions on here... thanks for keeping me so well-informed! I'm really excited about how my game is starting to turn out (haven't started the real coding yet, but I've gotten a lot of tips and my artwork is pretty good for a 2D game). However, I now come with yet another question.
In "The Nightmare Hour", the main story quest can only be played during a certain magical hour in the game which only lasts a brief spanse of time. When that "hour" (it's not really an hour, but in the game's time measurement it is) is over, your character can't proceed in the main quest - he has to wait until the hour comes again. There's a very large time gap between the periods of time during which you can play the main story. So, in order to create something other than exploration to fill in that time interval, I'd like to create side quests to complete. The biggest side quest would be retrieving items requested by other villagers. This event could take you across multiple .ged files depending on where the desired item is located. What I am wanting to know is...
1.How can I set it so that your character can accept a side quest
2.How can I set it so that when the character has accepted the side quest, certain aspects of the world change to allow the desired object to be found
3.How can I create an inventory screen (which will be brought up when the game is paused) that will include the item (and its graphic/sprite) AFTER it is retrieved
4.How can I set the game up so that when the item is retrieved, it will vanish from your inventory when you speak to the proper character, and you will receive the desired reward


I know that's a lot, but if someone could provide a tutorial or link me to a good one, that would be fantastic.
There's not much there yet, but you can find information on my current projects here.

https://sites.google.com/site/darkst3am/
User avatar
BlenderFreak
 
Posts: 55
Joined: Sun Sep 26, 2010 5:46 am
Location: His Computer
Score: 2 Give a positive score

Re: Inventory Tutorial?

Postby skydereign » Wed Nov 03, 2010 8:46 pm

1. If you are going to use multiple geds in this process you will need to save variables from one and load it in the next. So I'd create a player savegroup, and save/load appropriately. One of these variables should be a quest variable. For each sidequest, you could have your variable hold a different value, so if sidequest equal 0, the player is not on a quest. If it is 1, then you are.

2. When you load the game, or set the variable if the quest is within the same ged, then you change things. So for the script that you enter a level would be a good time to change things if sidequest equals something of importance. I'd use a switch statement for that.

3. Inventories can be quite variable. If there is only one item in the inventory at a time then that is easy, but if not it will get a little more complex. I've helped some other users with inventories, but again the problem is that it really depends on what you want it to do.

4. This would be easy, as the inventory will be using variables, so you would set it to 0, and the display should no longer show it.


Here's an example of an inventory mechanism, if it is not what you want then please explain further.
http://game-editor.com/forum/viewtopic.php?f=6&t=6673&hilit=+inventory
http://game-editor.com/forum/search.php?keywords=inventory&terms=all&author=skydereign&sc=1&sf=all&sr=topics&sk=t&sd=d&st=0&ch=300&t=0&submit=Search
User avatar
skydereign
 
Posts: 3510
Joined: Mon Jul 28, 2008 8:29 am
Score: 589 Give a positive score

Re: Inventory Tutorial?

Postby BlenderFreak » Wed Nov 03, 2010 9:11 pm

Thanks again, man! You've been really helpful in my time here!

I plan on the inventory being sort of Rune Factory/Zelda-like, though I would prefer that the player be able to rearrange the items as desired. Sort of like a grid for the inventory, and if the player wants to put, say "Leather Boot" in a slot that is containing "Cherry Pie" (just random objects I'm coming up with off the top of my head), the "Leather Boot" would snap to the selected box of the inventory grid, and the "Cherry Pie" would snap to the box in the inventory grid previously occupied by the "Leather Boot".

There's also something else I was wondering, so if you know the answer it would really help. When making a game for the GP2X (I haven't ordered mine yet, so I can't test out the theory), will the mouse events translate to stylus events? So that instead of "Mouse over this" it'll be "Stylus over this"? Or do I have to code that myself?

Thanks again for all your help!
There's not much there yet, but you can find information on my current projects here.

https://sites.google.com/site/darkst3am/
User avatar
BlenderFreak
 
Posts: 55
Joined: Sun Sep 26, 2010 5:46 am
Location: His Computer
Score: 2 Give a positive score

Re: Inventory Tutorial?

Postby skydereign » Wed Nov 03, 2010 11:17 pm

Well here is a demo of the inventory. It's just the skeleton of what you are aiming for, if you need help adding to it or you want me to explain something just ask. The inventory variable is declared with gameEditor's variable system, so if you need to change the number of items you would set the array size to something else. Also, yes mouse events are the same as stylus events.
Attachments
inventoryDemo.zip
(10.59 KiB) Downloaded 277 times
User avatar
skydereign
 
Posts: 3510
Joined: Mon Jul 28, 2008 8:29 am
Score: 589 Give a positive score

Re: Inventory Tutorial?

Postby BlenderFreak » Thu Nov 04, 2010 8:49 am

Ah thanks a lot! :D This is really helpful - it's already close to exactly how I wanted the script to run! Shouldn't be too difficult to make necessary adjustments and such. Thanks again, Skydereign!
There's not much there yet, but you can find information on my current projects here.

https://sites.google.com/site/darkst3am/
User avatar
BlenderFreak
 
Posts: 55
Joined: Sun Sep 26, 2010 5:46 am
Location: His Computer
Score: 2 Give a positive score

Re: Inventory Tutorial?

Postby DollMaster » Sun Sep 11, 2011 4:52 pm

Bear with me, my knowledge of arrays and matrix are poor. I looked at a few examples, including this one, but I am still lost. I'm trying to make a Zelda/Eye of the Beholder style inventory. Two vertical rows of 10 next to each other. For now, I want to touch an item and pick it up. When I press a button, I have an inventory screen appear. Along with a cursor on one of the inventory boxes.

1)How would I go about setting up my arrays to store what item I picked up?

Well, lets just start with that. I can probably figure out aesthetics of the cursor, and images on the inventory system if someone can walk me through this.
DollMaster
 
Posts: 65
Joined: Fri Jun 16, 2006 2:38 am
Score: 2 Give a positive score

Re: Inventory Tutorial?

Postby DollMaster » Sun Sep 11, 2011 4:56 pm

Also, I'm not seeing the functions in this code, where would I find them?
DollMaster
 
Posts: 65
Joined: Fri Jun 16, 2006 2:38 am
Score: 2 Give a positive score

Re: Inventory Tutorial?

Postby skydereign » Sun Sep 11, 2011 8:21 pm

The functions are in global code. Either you can press [Script] -> [Global Code] -> [Choose] -> [inventoryFunctions], or get to global code through the script editor, and follow the same path. The basic idea that that demo uses is each sub of the array holds a possible item. Depending on the value, it holds a type of item. So, if it holds a 0, that means there is no item, while if it holds 1, it has a red mushroom, and 2 for a green mushroom.
User avatar
skydereign
 
Posts: 3510
Joined: Mon Jul 28, 2008 8:29 am
Score: 589 Give a positive score

Re: Inventory Tutorial?

Postby DollMaster » Mon Sep 12, 2011 2:06 am

Thanks! Figured it out! I now have a working, unfunctional inventory system where I collect things, and they are stored.
DollMaster
 
Posts: 65
Joined: Fri Jun 16, 2006 2:38 am
Score: 2 Give a positive score

Re: Inventory Tutorial?

Postby sonicfire » Sat Sep 17, 2011 4:18 pm

working AND unfunctional?? :)
sonicfire
 
Posts: 425
Joined: Wed Nov 01, 2006 9:34 pm
Location: berlin germany
Score: 16 Give a positive score

Re: Inventory Tutorial?

Postby DollMaster » Tue Sep 27, 2011 10:21 pm

What I mean by unfunctional is that it makes an inventory, and you collect things, but you can't interact with said items you collected. =P Currently adding functionality to the items now...er trying to.
DollMaster
 
Posts: 65
Joined: Fri Jun 16, 2006 2:38 am
Score: 2 Give a positive score


Return to Tutorial Requests

Who is online

Users browsing this forum: No registered users and 1 guest