====== Scripting Events ====== Scripting events have 3 properties: - The Moment and Condition in Which They Are Called (Event Name) - The Event System Used (Event Type) \\ This determine how to register the event and access the parameters. - The Script to Execute \\ This is your script or someone else script that you registered to a specific event to perform a specific behaviour on specific objects. ===== Event Systems ===== * Blueprints Events \\ Those are the base game events, blueprints have a specific field for them and their parameter can be accessed with specific NWscript functions. They have not been changed so you will have to google for more documentation, here's a place to start: [[https://nwn.fandom.com/wiki/Event]] * [[.:events:script_based]] * [[.:events:variable_based]] ===== New Internal Events ===== Sinfar server side plugin adds many new events, they can be [[.:events:script_based]] or [[.:events:variable_based]]. \\ \\ Here's the list of the new [[.:events:variable_based]]: ^Variable Name^Description^Caller^Parameters^Return Value / BypassEvent() Result^Example^ |EVENT_CANUSE|Called before determining if an item can be used or not.|The Item|0: The item possessor|Boolean: Wether or not the item can be used (SetEventResultInt(TRUE or FALSE))|[[https://nwn.sinfar.net/res_nss_edit.php?name=scroll_w_canuse|scroll_w_canuse]]| |EVENT_RECVITEM|An item is about to be added to an object inventory|The object that will acquire the item|0: The Item \\ 1: The current item possessor|Boolean: Wether or not the item should be added to the caller's inventory|[[https://nwn.sinfar.net/res_nss_edit.php?name=mail_putinbox|mail_putinbox]]| |EVENT_CLEARALLACTIONS|Called when an object actions list is about to be cleared. \\ It is one way to know when an action has been interrupted (for any reason)|The object|None|None|TODO| |EVENT_PCENTERED|Called when a PC has entered an area.|Area|None|None|This is actually called from the PC action queue.| |EVENT_PCENTERAREA|Called when a PC has entered an area.|PC|None|None| |EVENT_AREALOADED|Called when a PC has entered an area.|Area|None|None|This is called before the PC is actually moved to the new area, so GetArea() will not work. If the area is needed use EVENT_PCENTERED.| |EVENT_PCLEAVEAREA|Called when a PC has exited an area.|PC|None|None| |EVENT_AREAUNLOADED|Called when a PC has exited an area.|Area|None|None| |EVENT_USEFEAT_%FEAT2DAROWNUMB%|Called when a PC uses the specified feat|PC|0:feat \\ 1: target \\ 2: target position|None| |EVENT_USEFEAT|Called when a PC uses any feat|PC|0:feat \\ 1: target \\ 2: target position|None|