Hi there,
I have a script that sets a variable to true if the selected item is multiple in inventory in this way:
private void OnInventorySelect(InvItem invItem)
{
if (invItem.count > 1)
{
AC.GlobalVariables.SetBooleanValue(28, true);
}
}
this works flawlessly if I give myself the item by checking "carry on start": writing in console invItem.count
returns the actual number of item in inventory and boolean is set to true, but somehow when I take the item through the action Inventory-> Add invItem.count is always 1. It happens both if selection mode is single or all.
Am I missing something? Thanks a lot
It looks like you're new here. If you want to get involved, click one of these buttons!
Comments
Admittedly it's a little confusing, but a by-product of improvements to the inventory system from the older releases.
Esssentially, the InvItem class always refers to the original data - as set in the Inventory Manager. For runtime data, you'll need to access InvInstance instead.
If you hook into the OnInventorySelect_Alt event instead of OnInventorySelect, that'll give you the associated InvInstance class - with the correct count value.
I'm afraid I need further assistance here.
This is (part of) my original script:
changing it into
doesn't give any error but invitem.count stills returns 1 as before.
if doing like this:
I got this error:
No overload for 'OnInventorySelect' matches delegate 'EventManager.Delegate_Inventory_Alt'
OnInventorySelect_Alt is a separate event with its own parameters - see the link to it above.