testiger2 Posted February 10, 2020 Share Posted February 10, 2020 (edited) Hi guys, i am having a super weird issue when trying to capture dropped items from OnItemRemoved() i need my script to drop the current selected entry in the inventory and then wait for the OnItemRevoved to capture the item(s) to process them further. Because DropObject is too unreliable for which object it drops i'm using a different approach. I basically emulate the user pressing the drop key from the inventory so the right items get dropped.Now naturally whenever the highlighted item stack has x amount of items you have to select the amount to drop.And here in lies the issue since whenever i select the whole stack 1 item always gets lost, like completely gone... OnItemRemoved() always fires twice in that case. One time with correct data except it only counts (max -1) items and the second time it fires for the missing 1 item but it returns no reference. This item simply dissapeares completely, not dropped to ground or whatever.This does not happen if i drop less then the maximum stack and it does not happen outside of this script either(when the player organically drops the items) It is the weirdest thing ever because all the script is actually doing is pressing the R key for the player but it still always show the same behavior and i have no idea why, I use a fresh stack of items for testingadded with player.additem so there are no issues with persistent refs but its always the same Here is part of the code State DropState Event OnItemRemoved(Form akBase, int aiCount, ObjectReference akRef, ObjectReference akDest) debug.messageBox("onitemRemoved\n" + akRef + "\n" + aiCount) ;Do processing GoToState("") EndEvent EndState Function PrepareDropEvent(Form oldBase, Form newBase) if newBase && newBase != oldBase ; just form args passed from previos function tmpNewBase = newBase ; tmp storage GoToState("DropState") ;AddInventoryEventFilter(oldBase) ;optional UI.Invoke("InventoryMenu", "_root.Menu_mc.DropItem") ;one liner doing the same as: ;int k = input.GetMappedKey("Ready Weapon") ;input.TapKey(k) ;RemoveInventoryEventFilter(oldBase) ;optional endif EndFunction EDIT: Found the solution, it has to do with the object beeing equipped before dropping it.If you unequip it the event will properly grab all instances Edited February 10, 2020 by testiger2 Link to comment Share on other sites More sharing options...
Recommended Posts