Adventure Game Studio

AGS Support => Beginners' Technical Questions => Topic started by: barefoot on Sat 05/12/2009 20:36:26

Title: Specifying Inventory to use
Post by: barefoot on Sat 05/12/2009 20:36:26
Hi

Can someone tell me the best way to script on how to select specific inv items to use on character??

if you have a few items in inv then i need each to do a specific task..

With the UseInv it only gives ()

many thanks
barefoot



Title: Re: Specifying Inventory to use
Post by: monkey0506 on Sat 05/12/2009 20:59:10
You should be able to use the player's active inventory such as:

function cWally_UseInv() {
 if (player.ActiveInventory == iKey) {
   player.Say("Wally doesn't need the key.");
 }
 else if (player.ActiveInventory == iHat) {
   cWally.Say("Ah, you found my hat!");
 }
 else {} // you may want to put a call to unhandled_event or something here
}
Title: Re: Specifying Inventory to use
Post by: barefoot on Sat 05/12/2009 21:35:18
Hi Monkey

thanks for that.. 

If i have say 4 items in inventory i want each one to do a specific thing when used on the main character.. which is Redpant and the inv item i want to use is yhat.. so using inv yhat on Redpants gets Redpants to do certain things..

If I use gun on Redpants  then that would give a different set of things.. etc etc

:)
barefoot

Title: Re: Specifying Inventory to use
Post by: Lufia on Sun 06/12/2009 09:54:26
Well, monkey gave you the way to do that. What's the problem ?
Title: Re: Specifying Inventory to use
Post by: barefoot on Mon 07/12/2009 18:59:25
Well,   

ive only just got up to speed... and yes, he did, once my brain woke up and I finally realised ;)

Anyhow, it takes a little time to work things out, especially coming straight from 2.6..

You're never to old to learn....(im 54) lol

cheers
barefoot