Forum rules - please read before posting.

Equipment window

13

Comments

  • edited September 2021

    Ah, I found the issue: The inventory property and the variable have to have the same name!

    Ok so the script works fantastically now except for one tiny detail; until I equip or unequip an item, the variables are all displayed as 0. As soon as I put an item there, all the stats change to their correct value, and when I remove the item the values go down to their intended base values. Hopefully this is just a final little tweak :)

  • Done. Give the updated script another try.

  • No change :(
    The first time I open the equipment window, all values are set to 0.
    If I play around with the equipment items, the values are immediately set to their correct values, and if I close the window and re-open it, the correct values are there. So it's only in an untouched condition that the values are 0.

  • Where is the script placed, exactly?

    Try adding this additional function to the script:

    private void Start ()
    {
        UpdateStats ();
    }
    

    In the UpdateStats function, add at the top:

    Debug.Log ("Update all stats");
    

    What is the full message (stacktrace included) in the Unity Console for the first instance of the new "Update all stats" message?

  • That additional function did the trick!

    You're the best, ChrisIceBox :)

  • Ok, I returned here to solve a mostly cosmetic issue.

    So I have the equipment containers graphically linked to a human body. When I click on the container to return the item to the inventory bar, the slot disappears, even though I have checked "clear content" (and not disable content) and chosen an empty slot texture. I would prefer to have the empty frame a part of the container element instead of pre-painted on the menu background, for practical reasons.
    I've also enabled "items can be re-ordered in menus".

    How do I get the "empty slot texture" to show up?

    I also checked "highlight empty slots" but this is also not working since, well, the slots aren't there.

  • I'll need to see your exact settings to be able to recreate the problem. Can you share screenshots of your Menu + Element properties, and (if using Unity UI) your linked Inventory button / image objects? I'll need your AC/Unity versions as well.

    An image of the equipment menu as it appears in-game, showing the issue, will also help to clarify the issue.

  • The containers are invisible when empty:

    How it looks when an item is placed in a container:

    Menu settings:


    General inventory settings:

  • Thanks for the details, I'll look into it.

  • Recreated. I shall work on a fix, but in the meantime you can get around this by switching your element's Size property to Manual.

  • Yes, that works perfectly! Thanks :)

  • Hello again,
    Everything is working as intended here, except that the content of the containers isn't saved when I save/load the game.
    The containers have Remember Container components added.
    The parent to all four containers have Constant ID and Don't Destroy Me components - do I have to add those to each individual container as well?

  • Try unparenting the Containers instead - so that you have four Containers, no parent, each with Dont Destroy Me and Remember Container components.

  • edited January 2022

    I'll try that, but where does the custom script go (the one we've named StatUpdateExample)?
    This was previously a component of the container parent.

  • edited January 2022

    I put the script as a component to each of the containers.
    Either way, it still doesn't work - when I load, not only is the container not saved, the item in it disappears, so it's neither in the inventory or the container.

    More specifically; if I "equip" something, that is, move from inventory to designated container, and then save, then unequip the item so that it moves back to inventory, and load, then the item is gone from both container and inventory.

  • Temporarily leave the script out of things for the moment - the first thing is to get items placed in the containers saving correctly.

    I shall test things on my end as well.

  • edited January 2022

    I cannot recreate the issue on my end - multiple Containers parented to an object that's set to DontDestroyOnLoad have their contents saved correctly.

    The Remember Container components do, however, need to have Retain in prefab? checked - is this the case?

  • Just to be perfectly clear; you now wrote DontDestroyOnLoad, whereas I've previously used a script called DontDestroyMe.
    Are we talking about different things, and in that case, how do I implement the other script?

    I checked the Retain in prefab (could have sweared I tried this) and now the item isn't gone any longer. However, there's still this issue:
    If I equip an item, save, un-equip it and load, the child object of the character that represents the item (in this case a cap) isn't visible anymore. So it seems the visibility state of the game objects isn't saved. The game object is a part of a prefab with a recorded constantID. I've made sure to check the Retain in prefab on each of them.

  • Just to be perfectly clear; you now wrote DontDestroyOnLoad, whereas I've previously used a script called DontDestroyMe.

    I was referring to the function that the script calls - not the script name. We're talking about the same thing.

    the child object of the character that represents the item (in this case a cap) isn't visible anymore. So it seems the visibility state of the game objects isn't saved.

    How are you updating the cap's visibility when equipping/unequipping the item, and what Remember components are associated with it?

  • edited January 2022

    I make it visible in an action list (object visibility), via the use inventory object.
    I make it invisible using the script StatUpdateExample, in which I disable the sprite renderer every time a container is emptied.
    It works splendidly, but I can't seem to get the visibility state saved (I tried adding remember visibility on the object as well, but to no avail)

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.