Forum rules - please read before posting.

Change graphic for inventory items that can have multiple carried?

edited March 13 in Technical Q&A

Hi all,

I was wondering if it is possible to change the graphics for inventory items that can have multiple being carried.

The inventory item of "multiple being carried" is 5 berries in my case, so each time the player picks up a berry, I want the graphic to be updated.

E.g.:
When the player has 1 of this item, the graphic shows only one berry and the label is "1 berry".
When the player has 2 of this item, the graphic is updated to show two berries (separate png file that I have) and the label is "2 berries".
...
When the player has 5 of this item, the graphic is updated to show 5 items (another separate png file) an the label says "5 berries".

With that being said, is it possible to accomplish this?
Thank you!

Comments

  • It's possible with scripting. I've added a script to handle this on the AC wiki here:
    https://adventure-creator.fandom.com/wiki/Changing_item_graphics_with_amount

  • Thank you so much! Will take a look :)

  • @ChrisIceBox
    Is there a way I could manipulate the script so that the cursor changes as well?

    I noticed that the count near the cursor is appearing correctly, but only the default graphic shows up in the inventory box and the cursor.

  • Ah nevermind, just realized I could add
    invInstance.CursorIcon.texture = ag.texture;

    One other thing that came up though -- is it possible to change the label as well, like above?

    I noticed that the label does not change as the amounts increase, although the graphics are changing correctly!

    Any help is appreciated, thank you!

  • Currently not - you'd have to update the label of the original Item itself.

    I shall look into how this might be added, however.

  • Got it, thanks for the heads up!

  • OK - v1.77.0 is out, and I've included a similar "ItemLabel" property to the InvInstance class that you can use to override an item's name:

    int count = invInstance.Count;
    if (count == 1) invInstance.ItemLabel = "1 apple";
    else invInstance.ItemLabel = count + " apples";
    
  • Ooh thank you so much! Really appreciate it! :)

  • Is v1.77.0 a stable release by any chance? Was checking for Adventure Creator updates, but it's showing v1.76.3 only it seems.

    Thanks!

  • v1.77.1 is now the latest, and should indeed be stable. If you encounter issues, however, just let me know.

  • Thanks for the heads up!
    Ah, would I have to upgrade to v1.76.3 before upgrading to v1.77.1, or could this be done directly?

    My current version is v1.76.2, this is the screenshot that I am getting.

  • You can upgrade directly to v1.77.1 - try it now, just be sure to backup your project first.

  • Great, thank you so much! Looks like it shows up as v1.77.1!

Sign In or Register to comment.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Welcome to the official forum for Adventure Creator.