Change objectX to Active Inventory image and show inv name and not ID..

Started by Slasher, Thu 03/04/2014 08:41:17

Previous topic - Next topic

Slasher

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


Crimson Wizard

#1
I think this:
Code: ags

if (player.ActiveInventory != null)
{
    objectX.Graphic = player.ActiveInventory.Graphic;
}
else
{
    objectX.Graphic = N; // where N is a "no item" graphic.
}

Slasher

#2
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
 objectX.Graphic=player.ActiveInventory.CursorGraphic;


Happy days (laugh)

EDIT: Secondary question regarding above:
Code: ags
 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




Adeel

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

cCharles.Say("I don't think %s will do much", player.ActiveInventory.Name); 

Slasher



SMF spam blocked by CleanTalk