Default creature scripts and the variables used to attach event behavior.
On this page
Default scripts
Sinfar uses a custom system by which you can assign default scripts to a monster then use variables to inject a script and its behavior onto the monster based on the event.

The default scripts are as following:
| Field | Default Script |
|---|---|
| OnBlocked | nw_c2_defaulte |
| OnDamaged | nw_c2_default6 |
| OnDeath | nw_c2_default7 |
| OnConversation | nw_c2_default4 |
| OnDisturbed | nw_c2_default8 |
| OnCombatRoundEnd | nw_c2_default3 |
| OnHeartbeat | nw_c2_default1 |
| OnPhysicalAttacked | nw_c2_default5 |
| OnPerception | nw_c2_default2 |
| OnRested | x2_def_rested |
| OnSpawn | nw_c2_default9 |
| OnSpellCast | nw_c2_defaultb |
| OnUserDefined | x2_def_userdef |
- The only script that isn't defined by Sinfar edits is OnUserDefined (as far as I know). The UserDefined event does not have an associated EVENT variable and should be set directly. See more below.
- It is recommended you create a monster and assign the default scripts to it in the toolset, and 'save the script set' and inject it to all monsters hereon. This way you can use 'load script' to inject all the code at once.
- When creating creatures directly on the Builder Website, the correct scripts are automatically assigned.
The variables
The variables in bold are what you would use to put on your monster.
| Script | Script description | Event Name String | Pre-event description |
|---|---|---|---|
| nw_c2_default1 | Script descriptionOn Heartbeat event | Event Name StringEVENT_AI_HEARTBEAT (string) | Pre-event descriptionScript name for pre-event use. |
| nw_c2_default2 | Script descriptionOn Perception event | Event Name StringEVENT_AI_PERCEPTION (string) | Pre-event descriptionScript name for pre-event use. |
| nw_c2_default3 | Script descriptionOn Combat Round End event | Event Name StringEVENT_AI_ENDCOMBATROUND (string) | Pre-event descriptionScript name for pre-event use. |
| nw_c2_default4 | Script descriptionOn Conversation event | Event Name StringEVENT_AI_CONVERSATION (string) | Pre-event descriptionScript name for pre-event use. |
| nw_c2_default5 | Script descriptionOn Attacked event | Event Name StringEVENT_AI_ATTACKED (string) | Pre-event descriptionScript name for pre-event use. |
| nw_c2_default6 | Script descriptionOn Damaged event | Event Name StringEVENT_AI_DAMAGED (string) | Pre-event descriptionScript name for pre-event use. |
| nw_c2_default7 | Script descriptionOn Death event | Event Name StringEVENT_AI_DEATH (string) | Pre-event descriptionScript name for pre-event use. |
| nw_c2_default8 | Script descriptionOn Disturbed event | Event Name StringEVENT_AI_DISTURBED (string) | Pre-event descriptionScript name for pre-event use. |
| nw_c2_default9 | Script descriptionOn Spawned event | Event Name StringEVENT_AI_SPAWN (string) | Pre-event descriptionScript name for pre-event use. |
| nw_c2_defaultb | Script descriptionOn Spell Cast At event | Event Name StringEVENT_AI_CASTAT (string) | Pre-event descriptionScript name for pre-event use. |
| nw_c2_defaulte | Script descriptionOn Blocked event | Event Name StringEVENT_AI_BLOCKED (string) | Pre-event descriptionScript name for pre-event use. |
OnUserDefined
For OnUserDefined functions, you would apply the script directly onto the monster.Note : nw_c2_default9 uses the variable ENTIRE_APPEARANCE2 already
You can also register these events dynamically using Variable Based Events.

