Adventure Game Studio

AGS Support => Beginners' Technical Questions => Topic started by: on Thu 26/01/2006 09:12:15

Title: Item combination in invwntory. Help needed.
Post by: on Thu 26/01/2006 09:12:15
I want to have in my game possibility to combine two or more things in inventory Can anyone provide help? Where to begin... how to script.
Thanks in forward
Title: Re: Item combination in invwntory. Help needed.
Post by: Khris on Thu 26/01/2006 10:06:21
In AGS, click on Inventory items in the left menu, then select the item from the list, then click on the Interaction... button.
A window opens, there you double-click on Use inventory on this item.

Now you can add interactions, or you choose Run Script, click on Edit script... and enter the appropriate code in the text window.
If you decide to script rather than use interactions, your code should look something like this:

if (player.ActiveInventory==iMatches) {
Ã,  player.LoseInventory(iCandle);
Ã,  player.AddInventory(iBurningcandle);
Ã,  player.Say("The candle is burning now.");
}
else if (player.ActiveInventory==iKnife) {
Ã,  player.LoseInventory(iCandle);
Ã,  player.AddInventory(iFigurine);
Ã,  player.Say("I've carved a small figurine out of the candle.");
}
else {
Ã,  player.Say("What's the point?");
}


In this case, the script would be the candle's, with the if-clauses checking which object was used on it.
Title: Re: Item combination in invwntory. Help needed.
Post by: on Thu 26/01/2006 13:29:29
Thanks.
Altough I know, how to add interactions, idea with script example was great... that was what I was lookin for.