SetEventScript(object, int, string)

From NWN Lexicon
Revision as of 21:30, 17 May 2018 by Squatting Monk (talk | contribs) (New working PC events)
Jump to: navigation, search
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.
Sets the given event script for the given object and handler.
int SetEventScript(
    object oObject,
    int nHandler,
    string sScript


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


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.


While this can set creature events for the PC, the only events that actually work on PCs are OnConversation, OnDeath, OnHeartbeat, and OnUserDefined. In development build 1.74.8171, OnCombatRoundEnd, OnPerception, and OnSpellCastAt now work for PCs as well.



See Also

functions: GetEventScript()
constants: EVENT_SCRIPT_* Constant Group