Enable an itemset and equip directly corresponding weapon

Iguane

New member
Hello !

I'm trying to enable a new itemset and its attached weapon within a script but I can't get the weapon to equip directly.

With the following code I can enable the itemset, but a I have to press next key at runtime to enable the weapon :

C#:
itemset.CategoryItemSets[categoryID].ItemSetList[itemSetID].Enabled = true;

With the following code the weapon is displayed but the animation is still that of the previous itemset.

C#:
var itemID = itemset.CategoryItemSets[categoryID].ItemSetList[itemSetID].ItemIdentifiers[slotID];
inventory.EquipItem(itemID, slotID, true);

I'm missing something, does anyone have any advice?
 
I don't think I've ever manually enabled an itemset during runtime from code - can I ask what's the functionality you're trying to create by doing this?

Regardless, you may need to call ItemSetManagerBase.UpdateActiveItemSet() to update the character's active item set to the one you've just enabled. You'll need to pass in the category index and item set index.
 
Thank you for your reply.

I have created an itemset for each type of weapon a character can occupy: (1H) mace, sword, axe, (2H) staff, bow etc.

The player will always have 3 active itemsets allowing to switch from a one-handed weapon configuration to a two-handed weapon configuration (the 3rd itemet being the fists).

I have developed an inventory where the player can unequip a weapon and equip a new one. If a player switches from a sword to an axe, I have to dynamically deactivate the sword item set, and activate the axe item set.

For this I used the following code to activate a new itemset and it seems to work:

C#:
itemset.CategoryItemSets[categoryID].ItemSetList[itemSetID].Enabled = true;
itemset.CategoryItemSets[categoryID].ItemSetList[itemSetID].Active = true;
GetComponent<UltimateCharacterLocomotion>().GetAbility<EquipUnequip>().StartEquipUnequip(itemSetID);

But I'm still not sure if I'm making good use of this itemset system :D
 
Ah ok well as long as it works for your case, I don't see any problems! Glad you figured it out
 
Top