Difference between revisions of "SetEventScript"

From NWN Lexicon
Jump to: navigation, search
(OnDeath confirmed to work as well)
m (New working PC events)
Line 27: Line 27:
  
 
===Remarks===
 
===Remarks===
While this can set creature events for the PC, the only events that actually work on PCs are [[OnConversation]], [[OnDeath]], [[OnHeartbeat]], and [[OnUserDefined]].
+
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 [https://trello.com/c/YnOjfAyW/130-fixes 1.74.8171], [[OnCombatRoundEnd]], [[OnPerception]], and [[OnSpellCastAt]] now work for PCs as well.
  
 
===Version===
 
===Version===

Revision as of 21:30, 17 May 2018

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
);

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, OnDeath, OnHeartbeat, and OnUserDefined. In development build 1.74.8171, OnCombatRoundEnd, OnPerception, and OnSpellCastAt now work for PCs as well.

Version

1.74.8164

See Also

functions: GetEventScript()
constants: EVENT_SCRIPT_* Constant Group