Difference between revisions of "SetEventScript"

From NWN Lexicon
Jump to: navigation, search
m (New working PC events)
m (clarified the oObject description)
 
Line 11: Line 11:
 
===Parameters===
 
===Parameters===
 
; oObject
 
; oObject
: The object to get the event script from.
+
: The object to set the event script on.
  
 
; nHandler
 
; nHandler

Latest revision as of 05:11, 15 August 2019

Warning icon orange.png Caution: This article documents NWN: Enhanced Edition content, not native BioWare scripts. It may not apply unless you're using NWN: Enhanced Edition.
Sets the given event script for the given object and handler.
int SetEventScript(
    object oObject,
    int nHandler,
    string sScript
);

Parameters

oObject
The object to set the event script on.
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