Inventory Questions

Started by anguruso, Sun 12/07/2009 11:18:23

Previous topic - Next topic

anguruso

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

Mazoliin

You need to use player.ActiveInventory and player.LoseInventory, you can look them up in the manual to see how to use them.

Ghost

#2
And to check what inventory item was used, you can check against player.ActiveInventory, which holds the currently selected item, like so:

Code: ags

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.

anguruso

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.

SMF spam blocked by CleanTalk