Hi guys! I wonder if we can make "pre-hooks" in Papyrus. Certain programming languages have something like "EventHookMode_Pre" parameter when hooking an event, which is very convenient. Anyway, how can I prevent player from adding a certain item to the inventory BEFORE he tries to add it? At the moment, my script has something like that: Event OnItemAdded(Form akBaseItem, int aiItemCount, ObjectReference akItemReference, ObjectReference akSourceContainer)
Actor ak = Game.GetPlayer()
if akBaseItem as Armor ;not exactly this, but some condition
int Count = ak.GetItemCount(Keyword.GetKeyword("ArmorHelmet")) + ak.GetItemCount(Keyword.GetKeyword("ClothingHead"))
int nCount = Count - 1
if Count > 1
ak.RemoveItem(akBaseItem, nCount, true)
akSourceContainer.AddItem(akBaseItem, nCount, true)
endIf
endIf
endEvent So the item goes to the player's inventory and THEN if goes back to the source container (and if the container is a dead body that was equipping a cuirass, cuirass won't equip back on that body), but I want to make the script check if the item suits a condition and only THEN allow or disallow player to take it. Sorry for bad english if it's bad :)