Adventure Game Studio

AGS Support => Beginners' Technical Questions => Topic started by: remmies on Wed 23/06/2004 17:54:00

Title: help with inventory
Post by: remmies on Wed 23/06/2004 17:54:00
 :ook i am jus lerning how to use ags and i wunted to do an object for the player to pik it up and it turned into a blue cup in hi inventory screen.so i looked it up in the knowledge base and read the steps on what to do but i got lost aorund the step where it told me to clik on the data column can sumone pleez simplify this for me and tell me what i hav to do so the item appears like itt should in the inventory screen
Title: Re: help with inventory
Post by: Estaog on Wed 23/06/2004 18:15:58
Well first you have to make an interaction for the object so that the player can pick it up, and then you create an inventry object (the blue cup) so the user can get that inventry item.

Use this code for the object:

AddInventory(1);

(Will add inventry 1 to the players items)

As for the blu cup, its the default image for everything. You need to import a new image and then change it from the Inventry Items section.

Hope this helps
Title: Re: help with inventory
Post by: Goot on Thu 24/06/2004 01:44:26
An object you pick up is different from an object in the inventory.
In the AGS editor, there are different buttons on the side, such as characters, room editor, game settings, palette.... One of them is inventory. Go there and define the inventory items. There are 2 preset for you, a key and a pink poster. You can add more by clicking on New Inventory Item or something like that, at the bottom. When you click on an inventory item in the list, a picture of the item comes up. Below there is a button for changing the picture so you can change the inventory item's picture to one of your sprites.
Title: Re: help with inventory
Post by: remmies on Thu 24/06/2004 02:06:21
hmmm well i tried that but when i test the game and i pik up the object(key)and look in my inventory it appears as a blue cup how do i fix that i tried q12 in the faq's but i didn't get it ???
Title: Re: help with inventory
Post by: Estaog on Thu 24/06/2004 08:07:37
Your getting a blue cup because you created a new object and didnt give it an image. The blue cup is the default image thats why your getting it.
Title: Re: help with inventory
Post by: remmies on Thu 24/06/2004 17:45:57
PROBLEM
When the player picks up an object in your room, it shows up as a blue cup in the player's inventory window.
CAUSE
This problem is caused by either:
Not selecting an inventory item to add, or
Not setting a graphic for the inventory item
It is not a bug in AGS.
MORE INFORMATION
You need to bear in mind that an Object is not the same thing as an inventory item:
Objects are room-based, where each room may have up to 10 objects, and you set the object interactions in the Rooms, Objects tab of RoomEdit. For example, object 0 in room 1 is completely different to object 0 in room 5.
Inventory items are game-based, where each inventory item remains the same for the whole game, so inventory item 3 is the same everywhere in the game.
Suppose you have a hamburger, set as object 0 in room 2, which you want the player to be able to pick up. You need to follow these steps to make sure it is available as an inventory item:

In RoomEdit, go to the GAME tab, and select the INVENTORY button on the left of the screen.
Click the "New item..." button in the bottom half of the screen.
Type in "Hamburger" or a name describing your inventory item, and press return.
In the top-middle of the screen will be a picture of a blue cup. Click on it, and the Sprite Manager appears.
Select the graphic that you want to use instead of the blue cup by clicking on it. You will be returned to the Inventory screen and your new picture should be displayed instead of the cup.
Note down the number of this inventory item. The number is displayed on the left hand side of the screen in the item list beside the name you typed in.
Go to the ROOM tab, and load Room 2 (or whichever room contains the object).
Click the OBJECTS button on the left of the screen, and cycle through so that your hamburger object is selected. Click the INTERACTION button.
Add a "Interact with object" event, and set it to "REMV OBJ %d, ADD INV".
You are asked to type in a number. Type the number of the room object (probably 0).
Click the Data column, and type in the Inventory item number (that is, the number you noted down earlier).
Save the room, then save the game and try it out. Now, when the player clicks the hand on the room object you should find a hamburger added to the inventory.

ok i do all of this but what is the data column???
"Click the Data column, and type in the Inventory item number (that is, the number you noted down earlier). "
Title: Re: help with inventory
Post by: Scorpiorus on Thu 24/06/2004 18:35:32
Ah, it's an old information regarding the old AGS version. So you clicked object interaction button, chose "Interact with object" interaction.

Now select a "Player - Give the player an inventory item" command and change inventory item number to the one you have in the inventory pane.

Then add another action after this one:
"Object - Remove an object from the room" and put a room object number here.
Title: Re: help with inventory
Post by: remmies on Thu 24/06/2004 20:55:14
 :o  finally i got it thanx soo much all the info helped a really lot