Adventure Game Studio

AGS Support => Beginners' Technical Questions => Topic started by: anguruso on Sun 12/07/2009 11:18:23

Title: Inventory Questions
Post by: anguruso on Sun 12/07/2009 11:18:23
Hi AGSers,

I want to give an inventory item to another character in my game, and when the EGO gives it to the other character I want it to be removed from cEgo's inventory. Simple enough, but I can't seem to find the correct function call after browsing through the intellisense.

At the moment I have this

Quote
function cBaker_UseInv()
{
    dBakerBuyMCD.Start();
}

I believe any inventory item will trigger this function and that is not what I want, also the Inventory Item (A McDonalds Meal) stays inside the inventory. Which is not what I want.

Thanks,
Angus
Title: Re: Inventory Questions
Post by: Mazoliin on Sun 12/07/2009 11:47:28
You need to use player.ActiveInventory and player.LoseInventory, you can look them up in the manual to see how to use them.
Title: Re: Inventory Questions
Post by: on Sun 12/07/2009 12:37:15
And to check what inventory item was used, you can check against player.ActiveInventory, which holds the currently selected item, like so:


if (player.ActiveInventory == iNecronomicon)
{
 cCrowley.Say("Hah. Bedtime stories.");
 player.Say("Ah. He's not impressed.");
}


edit:
Maz- you said almost the same thing. I need to stop flash-reading.
Title: Re: Inventory Questions
Post by: anguruso on Sun 12/07/2009 12:45:18
Thank you very much for your two helpful posts. I've implemented both of your suggestions and its working perfectly. I really like coding this stuff! Always is a sinch.