Adventure Game Studio

AGS Support => Beginners' Technical Questions => Topic started by: on Sat 04/02/2006 22:27:58

Title: How to do "use inventory item on object?" (Solved)
Post by: on Sat 04/02/2006 22:27:58
How would I script/otherwise make it so that you can use an inventory item on an object?
Title: Re: How to do "use inventory item on object?"
Post by: Mugs on Sun 05/02/2006 05:39:18
-First of all, give your inventory item a "Script-O-name" (ex.: iItem)
-Second, in the "object interaction editor", run a script under "Use inventory on object" and type in this function:


if (player.ActiveInventory=="Item Script-O-name"){

}

Here's an example using iItem as the object's name:

if (player.ActiveInventory==iItem){

//type script here

}
Title: Re: How to do "use inventory item on object?"
Post by: Ashen on Sun 05/02/2006 13:57:58
BFAQ Updated (http://americangirlscouts.org/agswiki/index.php/GUI%2C_Inventory_%26_Menu#Using_a_specific_inventory_item_to_trigger_an_action) to include new scripting.

Also, you don't have to give your items Script-O-Names - one will be generated based on the item's name (although you can change it if you want).
Title: Re: How to do "use inventory item on object?"
Post by: on Sun 05/02/2006 14:14:56
It worked, thanks.