Jump to content

When does an OnLoad or OnDrop block of a dropped item run?


Recommended Posts

Wanting to have the player drop an item to get an equipment item OnUnEquip script event to run which at present locks up the Pip-Boy screen.whenever the player tries to unequip within the Pip-Boy. The UnEquip block runs just fine when called from the console, SO......is there a way the player can DROP a scripted item which will do what the Console commands do in an OnLoad (of the mesh that is dropped) OR OnDrop (IF the script waits to run till the player closes their Pip-Boy) so they don't have their Pip-Boy Lock up on them?

 

i.e. PlayerRef.UnEquip OBJECTID is ALL I want it to do BUT it's gotta run OUTSIDE the Pip-Boy.

Link to comment
Share on other sites

There is an event triggered when the pipboy opens or closes, but I would not recommend you use it as you then have an object(s) getting the event every time the player opens/closes the pipboy - anywhere.

 

Unequiping is different from dropping so you could have a delay triggered by the unequip that does an explicit item.drop() - however you then still need to syncronise with the pipboy menu (to see if it is still open etc). Messy.

 

What exactly are you trying to achieve as I don't understand your reference to 'pipboy lockup'? Are you trying to drop a quest item?

Link to comment
Share on other sites

There is an event triggered when the pipboy opens or closes, but I would not recommend you use it as you then have an object(s) getting the event every time the player opens/closes the pipboy - anywhere.

 

Unequiping is different from dropping so you could have a delay triggered by the unequip that does an explicit item.drop() - however you then still need to syncronise with the pipboy menu (to see if it is still open etc). Messy.

 

What exactly are you trying to achieve as I don't understand your reference to 'pipboy lockup'? Are you trying to drop a quest item?

Thanks for the reply. I have an equipment item with a script that SKK50 gave me which works PERFECTLY for Equipping and giving an NPC an AnimFlavor then Unequipping and taking the animflavor away. The OnEquip script block also works perfectly for the player, NO issues, but......whenever the item is UneQuipped from the Pip-Boy, the Pip-Boy screen locks up. BUT, if I use the console to unequip the item, THEN, the script works perfectly and the player reverts to a null set animflavor. SO.....all I want to do is figure out a script that will run on a DROPPED item, so that I can get the UnEquip block to run OUTSIDE the Pip-Boy.

 

That's why I asked "WHEN" does the script actually fire off, because if it fires off immediately whenever the item is dropped, then that defeats the purpose. I was thinking of an OnLoad block if OnDrop didn't work which would fire off once the player closes the Pip-Boy and the items' mesh loads. All this script of the dropped item has to do is Unequip ONE item from the player, which will then cause the OnUnequip script block to run properly.

Link to comment
Share on other sites

There is an event called OnDrop but this is pertaining to the in-world physics based 'grab' (z-keying). Just a heads-up.

 

IF the object is a persistent ref (i.e. is placed in the world through the editor and not created at runtime) you can easily use this:

https://www.creationkit.com/fallout4/index.php?title=OnContainerChanged_-_ObjectReference

 

 

Otherwise you need register an inventory event filter, and when OnItemRemoved fires, check whether there is *no receiver*. This means the object, or an item of specific Form, has been dropped into the world (same principle goes for the aforementioned)

 

The registration is moderately finicky to set up but you are in luck as you are targeting one specific object/form that you can filter for.

 

The CK wiki has all the necessary specifics.

 

https://www.creationkit.com/fallout4/index.php?title=AddInventoryEventFilter_-_ObjectReference

 

https://www.creationkit.com/fallout4/index.php?title=OnItemRemoved_-_ObjectReference

Link to comment
Share on other sites

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...