Creature Event System: Difference between revisions

From Sinfar
(Showed how to use events)
 
No edit summary
Line 70: Line 70:


For OnUserDefined Functions, you would apply the script -directly- onto the monster.
For OnUserDefined Functions, you would apply the script -directly- onto the monster.
[[File:OnUserDefinedScreenshot.png|thumb|At the very bottom, you would hardcode and directly use the script name on the OnUserDefined event.]]
[[File:OnUserDefinedScreenshot.png|thumb|At the very bottom, you would hardcode and directly use the script name on the OnUserDefined event.]]Note : nw_c2_default9 uses the variable ENTIRE_APPEARANCE2 already

Revision as of 08:19, 14 January 2024

Creature Event System

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:

[ResRefs]

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

- 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.

Screenshot of what the script and save scriptset/load script set buttons look like in the toolset underneath the 'scripts' tab on creature editors.


The variables:

The variables in bold are what you would use to put on your monster.

Example of the EVENT_AI_DEATH use


nw_c2_default1 - On Heartbeat event : EVENT_AI_HEARTBEAT (string) - Script name for pre-event use.

nw_c2_default2 - On Perception event : EVENT_AI_PERCEPTION (string) - Script name for pre-event use.

nw_c2_default3 - On Combat Round End event : EVENT_AI_ENDCOMBATROUND (string) - Script name for pre-event use.

nw_c2_default4 - On Conversation event : EVENT_AI_CONVERSATION (string) - Script name for pre-event use.

nw_c2_default5 - On Attacked event : EVENT_AI_ATTACKED (string) - Script name for pre-event use.

nw_c2_default6 - On Damaged event : EVENT_AI_DAMAGED (string) - Script name for pre-event use.

nw_c2_default7 - On Death event : EVENT_AI_DEATH (string) - Script name for pre-event use.

nw_c2_default8 - On Disturbed event : EVENT_AI_DISTURBED (string) - Script name for pre-event use.

nw_c2_default9 - On Spawned event : EVENT_AI_SPAWN (string) - Script name for pre-event use.

nw_c2_defaultb - On Spell Cast At event : EVENT_AI_CASTAT (string) - Script name for pre-event use.

nw_c2_defaulte - On Blocked event : EVENT_AI_BLOCKED (string) - Script name for pre-event use.


For OnUserDefined Functions, you would apply the script -directly- onto the monster.

At the very bottom, you would hardcode and directly use the script name on the OnUserDefined event.

Note : nw_c2_default9 uses the variable ENTIRE_APPEARANCE2 already