Difference between revisions of "Event Handling"

512 bytes added ,  16:43, 11 February 2017
no edit summary
imported>Odessa
(+note its in nvse 4.6)
imported>Ana
 
(4 intermediate revisions by 2 users not shown)
Line 5: Line 5:
An event handler allows response to game events, without having to attach scripts directly to objects. Instead, the scripter uses [[SetEventHandler]] to register a [[User Defined Function]] as a handler for a specific event. When an event occurs during gameplay, NVSE will invoke any handlers that correspond to it, passing information about the event to their function through its arguments.
An event handler allows response to game events, without having to attach scripts directly to objects. Instead, the scripter uses [[SetEventHandler]] to register a [[User Defined Function]] as a handler for a specific event. When an event occurs during gameplay, NVSE will invoke any handlers that correspond to it, passing information about the event to their function through its arguments.


Each event expects its handlers to accept a specific set of arguments. The in built events, including any required arguments (listed in the order in which they should appear in the function definition) are listed in the table below. In addition, [[User Defined Events]] are possible.
Each event expects its handlers to accept a specific set of arguments. The in built events, including any required arguments (listed in the order in which they should appear in the function definition) are listed in the table below. In addition, [[User Defined Event]]s are possible.


{| class="wikitable" style="width:100%; text-align:left"  align="center"  
{| class="wikitable" style="width:100%; text-align:left"  align="center"  
Line 18: Line 18:
|| [[OnActorUnequip]] || Unequipped || Unequipped
|| [[OnActorUnequip]] || Unequipped || Unequipped
|-
|-
|| [[OnAdd]] || AddedTo || AddedItem
|| [[OnAdd]] || AddedItem || AddedTo
|-
|-
|| [[OnClose]] || Closed || Closer
|| [[OnClose]] || Closed || Closer
Line 46: Line 46:
|| [[OnPackageDone]] || Actor || Package
|| [[OnPackageDone]] || Actor || Package
|-
|-
|| [[OnReset]] || WhatsReset
|| [[OnReset]] || WhatsReset || WhatsReset (duplicate of first parameter)
|-
|-
|| [[OnSell]] || SoldInvItem || Seller (Player only?)
|| [[OnSell]] || SoldInvItem || Seller (Player only?)
Line 102: Line 102:
*[http://obse.silverlock.org/obse_command_doc.html#Events OBSE Documentation]
*[http://obse.silverlock.org/obse_command_doc.html#Events OBSE Documentation]
*[http://www.loverslab.com/topic/39417-tutorial-nvse4-part-5-event-handlers-user-defined-events-udes/ A tutorial on NVSE Events]
*[http://www.loverslab.com/topic/39417-tutorial-nvse4-part-5-event-handlers-user-defined-events-udes/ A tutorial on NVSE Events]
==Note on OnActorEquip==
GetType 40 (=weapons) on rEquipped will return false, because rEquipped is the ammo loaded on the weapon itself. So, if there are no avaiable ammos, or it's a melee weapon, it won't even fire up. Also, on load, if the weapon is out it will fire the event, since it loads ammos.
==Note on OnAdd==
11/feb/2017 - OnAdd seems firing only in Gamemode when picking something from the ground, but not in MenuMode when moving stuff on containers.




Anonymous user