Adventure Game Studio

AGS Support => Beginners' Technical Questions => Topic started by: Slasher on Thu 03/04/2014 08:41:17

Title: Change objectX to Active Inventory image and show inv name and not ID..
Post by: Slasher on Thu 03/04/2014 08:41:17
Hi,

at the moment I have an object (objectX) that reflects whatever inventory graphic is currently active.

I usually do this inventory item by inventory item and change objectX's graphic accordainly.

What would be the best way to change objectX to reflect active inventory graphic without have to list each one?

cheers for any help

thanks

Title: Re: Change objectX to Active Inventory image
Post by: Crimson Wizard on Thu 03/04/2014 08:56:13
I think this:
Code (ags) Select

if (player.ActiveInventory != null)
{
    objectX.Graphic = player.ActiveInventory.Graphic;
}
else
{
    objectX.Graphic = N; // where N is a "no item" graphic.
}
Title: Change objectX to Active Inventory image
Post by: Slasher on Thu 03/04/2014 10:09:33
Thanks Crimson (nod)

Of course I overlooked one thing, my inventory items have a black background whereas their cursor images have not :~(

This sorts out that issue:
Code (ags) Select
objectX.Graphic=player.ActiveInventory.CursorGraphic;

Happy days (laugh)

EDIT: Secondary question regarding above:
Code (ags) Select
cCharles.Say("I don't think %d will do much",player.activeinv);
Shows inventory ID whereas I would like the Inventory NAME ie Grease, Cloth etc etc

As like:  "I don't think Cloth will do much"

cheers



Title: Re: Change objectX to Active Inventory image and show inv name and not ID..
Post by: Adeel on Thu 03/04/2014 15:33:42
I'm surfing using my mobile atm. So, I can't test it. But the code should be something along the lines of:

Code (ags) Select

cCharles.Say("I don't think %s will do much", player.ActiveInventory.Name);
Title: SOLVED: Change objectX to Active Inventory image and show inv name and not ID..
Post by: Slasher on Thu 03/04/2014 15:41:49
(laugh) Just beat me too the punch Adeel...

Already implemented..

;)
Title: Re: Change objectX to Active Inventory image and show inv name and not ID..
Post by: Adeel on Thu 03/04/2014 15:46:52
Glad to hear that you had already figured it out! :)