Difference between revisions of "SetEventScript"

From NWN Lexicon
Jump to: navigation, search
(Initial page creation)
 
(Other events can work on PCs as well)
Line 28: Line 28:
  
 
===Remarks===
 
===Remarks===
While this can set creature events for the PC, the only event that actually work on PCs is OnHeartbeat.
+
While this can set creature events for the PC, the only events that actually work on PCs are [[OnConversation]], [[OnHeartbeat]], and [[OnUserDefined]].
  
 
===Version===
 
===Version===

Revision as of 02:57, 18 March 2018

Sets the given event script for the given object and handler.

Nwnee logo.jpg Note: This article documents Neverwinter Nights: Enhanced Edition new content or changes/updates/fixes to 1.69 functions. These are all listed under the category and patches pages.
int SetEventScript(
    object oObject,
    int nHandler,
    string sScript
);

Parameters

oObject
The object to get the event script from.
nHandler
An EVENT_SCRIPT_* constant matching the event to set the script on.
sScript
The script to attach to the event.

Description

Sets the given event script for the given object and handler.

Returns 1 on success, 0 on failure.

Will fail if oObject is invalid or does not have the requested handler.

Remarks

While this can set creature events for the PC, the only events that actually work on PCs are OnConversation, OnHeartbeat, and OnUserDefined.

Version

1.74.8164

See Also

functions: GetEventScript()
constants: EVENT_SCRIPT_* Constant Group