smart_scripts

smart_scripts

Manual editing smart_scripts table can be tedious and difficult, for easier writing scripts you can use additional TrinityCore tools like WoW Database Editor.

Table Structure

Field

Type

Attributes

Key

Null

Default

Extra

Comment

entryorguid

bigint(20)

signed

PRI

NO

0

 

 

source_type

tinyint(3)

unsigned

PRI

NO

0

 

 

id

smallint(5)

unsigned

PRI

NO

0

 

 

ink

smallint(5)

unsigned

PRI

NO

0

 

 

event_type

tinyint(3)

unsigned

 

NO

0

 

 

event_phase_mask

tinyint(3)

unsigned

 

NO

0

 

 

event_chance

tinyint(3)

unsigned

 

NO

100

 

 

event_flags

tinyint(3)

unsigned

 

NO

0

 

 

event_param1

int(10)

unsigned

 

NO

0

 

 

event_param2

int(10)

unsigned

 

NO

0

 

 

event_param3

int(10)

unsigned

 

NO

0

 

 

event_param4

int(10)

unsigned

 

NO

0

 

 

event_param5

int(10)

unsigned

 

NO

0

 

 

action_type

tinyint(3)

unsigned

 

NO

0

 

 

action_param1

int(10)

unsigned

 

NO

0

 

 

action_param2

int(10)

unsigned

 

NO

0

 

 

action_param3

int(10)

unsigned

 

NO

0

 

 

action_param4

int(10)

unsigned

 

NO

0

 

 

action_param5

int(10)

unsigned

 

NO

0

 

 

action_param6

int(10)

unsigned

 

NO

0

 

 

target_type

tinyint(3)

unsigned

 

NO

0

 

 

target_param1

int(10)

unsigned

 

NO

0

 

 

target_param2

int(10)

unsigned

 

NO

0

 

 

target_param3

int(10)

unsigned

 

NO

NO

 

 

target_param4

int(10)

unsigned

 

NO

NO

 

 

target_x

float

signed

 

NO

0

 

 

target_y

float

signed

 

NO

0

 

 

target_z

float

signed

 

NO

0

 

 

target_o

float

signed

 

NO

0

 

 

comment

text

signed

 

NO

 

 

Event Comment

Description of the fields

Please note:

 means that the feature/option is not (yet) implemented.

entryorguid

  • EntryOrGuid > 0: entry of the creature / game object / etc.

  • EntryOrGuid < 0: guid of the creature / game object / etc.

  • Depends on source_type.

source_type

  • Object type: creature, game object, spell. see table below for values

     

id

  • Incremental id bound to each entryorguid & source_type (0, 1, 2, ...).

link

  • Simple event linking;

  • Example: if id = 0 and link = 1; id 1 will only be able to occur if id = 0 was triggered.

  • Smart_event to be used.

event_phase_mask

When dealing with phases, phase IDs have to be used. There are 10 (9+1) different phases: 1, 2, ... 9 and the default 0.

Example: The script is in phase 0 by default - If we want it to go to phase 1, we got two choices:

  • SMART_ACTION_INC_PHASE by 1 or SMART_ACTION_SET_PHASE 1

If the script is in phase 0 and want to skip to phase 2:

  • SMART_ACTION_INC_PHASE by 2 or SMART_ACTION_SET_PHASE 2

If the script is in phase 1 and want to skip to phase 2:

  • SMART_ACTION_INC_PHASE by 1 or SMART_ACTION_SET_PHASE 2

Name

Flag

Hex

Comment

SMART_EVENT_PHASE_ALWAYS_BIT

0

0x000

Means all phases (1 ... 9)

SMART_EVENT_PHASE_1

1

0x001

Phase 1 only.

SMART_EVENT_PHASE_2

2

0x002

Phase 2 only.

SMART_EVENT_PHASE_3

4

0x004

Phase 3 only.

SMART_EVENT_PHASE_4

8

0x008

Phase 4 only.

SMART_EVENT_PHASE_5

16

0x010

Phase 5 only.

SMART_EVENT_PHASE_6

32

0x020

Phase 6 only.

SMART_EVENT_PHASE_7

64

0x040

Phase 7 only.

SMART_EVENT_PHASE_8

128

0x080

Phase 8 only.

SMART_EVENT_PHASE_9

256

0x100

Phase 9 only.

 

  • Event will only be able to occur if creature/GO is in this phase.

  • Example: If we want an event to only be able to occure in phase 1 and 4, event_phase_mask = 1+8 = 9

  • (Inverse of EAI: event_inverse_phase_mask).

event_chance

This is the probability of the event to occur as a percentage from 0-100. So, if you want the event to occur roughly half of the time, then set this to 50. 

event_flags

Name

Flag

Hex

Comment

SMART_EVENT_FLAG_NOT_REPEATABLE

1

0x01

Event can not repeat

SMART_EVENT_FLAG_DIFFICULTY_0

2

0x02

Event only occurs in normal dungeon

SMART_EVENT_FLAG_DIFFICULTY_1

4

0x04

Event only occurs in heroic dungeon