The author of the code below passes the player reference to the Activate
function to loot an item to the player's inventory.
If kItem
kItem.Activate(Game.GetPlayer())
EndIf
There is a game engine issue where if the player reference is passed as the activator to the Activate
function, the game may crash or freeze for some players, especially if this function is executed rapidly and frequently.
Activate
function.Actor Property PlayerRef Auto
Event OnInit()
AddInventoryEventFilter(None)
EndEvent
Event OnItemAdded(Form akBaseItem, Int aiItemCount, ObjectReference akItemReference, ObjectReference akSourceContainer)
Self.RemoveItem(akBaseItem, aiItemCount, False, PlayerRef)
EndEvent