Question about loading a scene, keeping a weapon.

sneekyo

Member
I have a runtime knife that I am picking up in one scene, then I use the UCCSAVER and save system to load the next scene, when the next scene is loaded I can see that current inventory shows I have 1 count of the knife still, so that appears to be working, but I can't seem to equip it. Any idea why?
 
I've been talking to Tony about if for a while, it's a tough one for sure. That's why I thought I'd reach out to you guys in case there was something I could be missing on the UCC side of things. When I look at the code I don't see any thing mentioning equipping a specific weapon, how does it know what to equip?
 
Wait I see it, I'll have to give this a test, any idea why it wouldn't be showing up automatically though? Is that normal?
 
Item Set Index is defined in the character's Item Set Manager.

As far as I'm aware there's nowhere in an inspector that exposes the Category Index of a particular item., but you can use ItemType.GetItemCategory() to return the item's category and get its ID - IItemCategoryIdentifier.ID
 
My mistake, I'm always confusing item category ID and item category index. The item category index is just the index of that item category within the item collection's array of categories.

You could do something like during runtime:

C#:
int GetActiveItemCategoryIndex() {
    var inventory = GetComponent<Inventory>();
    var activeItemType = (ItemType)inventory.GetActiveItem(0).ItemDefinition;
    uint categoryID = activeItemType.GetItemCategory().ID;

    for (int i = 0; i < itemCollection.Categories.Length; i++) {
        if (itemCollection.Categories[i].ID == categoryID) {
            return i;
        }
    }
    return -1;
}

Or just look in the array of categories in the Item Type Manager ('categories' tab). The categories will be ordered from top to bottom, starting at 0.

What do you need this for anyway?
 
It's a bit of a long story but Justin is taking a look at my project, I sent a link to support. Basically I pick up a knife - change to a different level using UCCSaver, when it gets to the new level I can see that it saved the item in the inventory count : 1, but I can't equip the item. Tony and Justin determined it was something on the UFPS end and not the UCCSAVER end.
 
Top