ShowOff:OnPreDropInventoryItem

From GECK
Jump to: navigation, search

An event handler added by the ShowOff NVSE Plugin version 1.50.

Description

This event runs before an item in the player's inventory is manually dropped by the player (doesn't account for Drop-style functions).

If the function returns false (0) via SetFunctionValue, then dropping that item is prevented.

  • Since multiple handlers can be set for the event, it only takes a minimum of 1 handler to return false for activation to be prevented.
  • If SetFunctionValue is NOT called, or if it is set with a non-zero value, then the handler will not prevent the item from being dropped.

The calling reference will always be the player.

The 1st UDF arg is the item BaseForm, while the 2nd is an Inventory Reference of the item.

The 3rd arg, bIsDroppingNotPrevented, informs if activation would already be prevented by a handler that ran just before.

Syntax

Use SetEventHandler / SetEventHandlerAlt with the event name "ShowOff:OnPreDropInventoryItem".

Handler Script

A skeleton handler script for this event:

scn TestOnPreDropInventoryItem

ref rBaseItem
ref rInvRef
short bIsDroppingNotPrevented

begin Function { rBaseItem, rInvRef, bIsDroppingNotPrevented }

    ; GetSelf = player

    printvar rBaseItem
    printvar rInvRef
    printvar bIsDroppingNotPrevented

    SetFunctionValue 0  ;prevent the item from being dropped 
    print "TestOnPreDropInventoryItem >> RAN!"

end

Example

SetEventHandlerAlt "ShowOff:OnPreDropInventoryItem" TestOnPreDropInventoryItem

Will run right before any item is dropped from the player's inventory.

SetEventHandlerAlt "ShowOff:OnPreDropInventoryItem" TestOnPreDropInventoryItem 1::Stimpack

Will run right before a Stimpack is dropped from the player's inventory.

SetEventHandlerAlt "ShowOff:OnPreDropInventoryItem" TestOnPreDropInventoryItem 3::1

Will run right before any item is dropped from the player's inventory, but only if dropping hasn't been cancelled already by handlers that ran first.

See Also