Jump to content

OnPlayerBowShot, Not activating at all


Recommended Posts

If you carefully condition your IF blocks on the OnItemRemoved event, you can probably be safe not using the AddInventoryEventFilter. It is good practice to be aware of its existence and try to use it if possible. The code I posted most recently will get triggered any time an item is removed but the very next line is a check to make sure that the item removed is ammo. It should safely fail without creating a stack dump in most cases.

 

It has been my experience that even tho papyrus creates a stack dump in the log, nothing has been skipped in the actual code. But it is always better to be safe than sorry whenever possible.

 

You will want to see how it behaves with the bound bow. I believe that it will make the bound arrows "unlimited" as well. If that is not desirable, you will need to condition them out, possibly with a property and an additional AND statement to the IF block.

 

If you do want to use an inventory event filter, you can create a formlist in the CK, add whatever ammo you want from the base game and dlc, then set up a function that will be called in both an Oninit() event and OnPlayerLoadGame() event. This function would use GetFormFromFile to pull every ammo you want to work with from other mods and add them to your formlist. OnInit for when the mod starts up and OnPlayerLoadGame in case the player adds a supported mod mid-game.

 

Example:

 

 

FormList Property AmmoList Auto
 
Event OnInit()
  AddInventoryEventFilter(AmmoList)
  FillAmmoList(AmmoList)
EndEvent
 
Event OnPlayerLoadGame()
  FillAmmoList(AmmoList)
EndEvent
 
Function FillAmmoList(FormList TheList)
  TheList.AddForm(Game.GetFormFromFile(0x00123456,"SomeMod.esp")
EndFunction
 
;rest of script

 

 

 

Link to comment
Share on other sites

  • Recently Browsing   0 members

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