[SOLVED]objects converting to inventory items?

Started by Anpiel, Sun 16/11/2014 22:12:57

Previous topic - Next topic

Anpiel

I am trying to do a basic item pick up. Here is what code I used.
Code: asg

function oGiantKey1_Interact ()
{
oGiantKey.Visible = false;
player.AddInventory (oGiantKey1);
}

Why is nothing going on?
Angels they fell first but I'm still here

Vincent

#1
Why the @#[* you are not creating an inventory item in the editor ?! :)

From the Manual :

Every inventory item which the player may carry during the game at one time or another is listed under the "Inventory items" node. Here, each item has a number and a script name which you use in scripts to identify the object. To create a new item, right-click on the "Inventory items" node.


The script then should look like something like this.

Code: ags

function oGiantKey1_Interact ()
{
oGiantKey.Visible = false;
player.AddInventory(iGiantKey1); //add the inventory item
}

Anpiel

I am doing that because this is day four for me working on this stuff. Thank you a thousand times over!~
Angels they fell first but I'm still here

Vincent

Oh well, good luck then, you're welcome ~

Anpiel

Angels they fell first but I'm still here

Vincent

Okay :)

Did you create the Inventory item ?

To create a new item, right-click on the "Inventory items" node in the tree.

Change the script name of the item, call it :

iGiantKey1

Then, when you interact with the object :
Code: ags

function oGiantKey1_Interact()
{
oGiantKey.Visible = false;
player.AddInventory(iGiantKey1); //add the inventory item
}



Anpiel

I made the inventory item but cannot get it into my room. Sorry for being such a n00b about all this.
Angels they fell first but I'm still here

Vincent

Let's say that you have created your inventory item in the node tree, and you rename it : iGiantKey1
Then you can choose if the player start with that item when the game first start
(but this is optional, not to solve this issue)
After this, you interact with your object.
By doing this the object become not visible and the player add the Inventory item, of course, not the object.
So then, where you want to store it ?
In an InventoryWindow i guess.
Just create a Gui. Inside of it add an InventoryWindow.

All you need is to read the dynamic helps. You can check the dynamic helps inside AGS by pressing F1

Anpiel

Thank you so much. I was misreading the dynamic help.
Angels they fell first but I'm still here

Adeel

Hello Anpiel.

There are some tutorials which can help you get started with the AGS. There are video tutorials too. :)

Anpiel

Angels they fell first but I'm still here

SMF spam blocked by CleanTalk