用户工具

站点工具


数据库:world数据库:smart_scripts

这是本文档旧的修订版!


smart_scripts 表


<-返回:World 数据库

The smart_scripts table has 31 attributes. It serves to make scripts in SQL language. The important thing is always to analyze, who is the event that motivates the execution of an action and of course, who is the objective. As a recommendation, you can review the scripts that are already inside the table, to understand how it works. The advantage, for which several use this method, is that it is not required to compile, when adding records, with restarting the server, if it is well programmed, you can appreciate the changes. Another reason is the portability, but it depends on the point of view of the developer, the response you can get.

表结构

FieldTypeAttributesKeyNullDefaultExtraComment
entryorguidINTSIGNEDPRINO
source_typeTINYINTUNSIGNEDPRINO0
idSMALLINTUNSIGNEDPRINO0
linkSMALLINTUNSIGNEDPRINO0
event_typeTINYINTUNSIGNED NO0
event_phase_maskSMALLINTUNSIGNED NO0
event_chanceTINYINTUNSIGNED NO100
event_flagsSMALLINTUNSIGNED NO0
event_param1INTUNSIGNED NO0
event_param2INTUNSIGNED NO0
event_param3INTUNSIGNED NO0
event_param4INTUNSIGNED NO0
event_param5INTUNSIGNED NO0
event_param6INTUNSIGNED NO0
action_typeTINYINTUNSIGNED NO0
action_param1INTUNSIGNED NO0
action_param2INTUNSIGNED NO0
action_param3INTUNSIGNED NO0
action_param4INTUNSIGNED NO0
action_param5INTUNSIGNED NO0
action_param6INTUNSIGNED NO0
target_typeTINYINTUNSIGNED NO0
target_param1INTUNSIGNED NO0
target_param2INTUNSIGNED NO0
target_param3INTUNSIGNED NO0
target_param4INTUNSIGNED NO0
target_xFLOATSIGNED NO0
target_yFLOATSIGNED NO0
target_zFLOATSIGNED NO0
target_oFLOATSIGNED NO0
commenttext NO Event Comment

字段说明


entryorguid

  • EntryOrGuid > 0: entry of the creature / game object / etc.
  • EntryOrGuid < 0: guid of the creature / game object / etc.
  • Depends on source_type.

When using GUID-specific SAI, the extra_flag DONT_OVERRIDE_SAI_ENTRY allows us to not require duplicating rows shared between all creatures of the same entry.

For example, you can keep all movement-related scripting in the GUID script, while combat scripting is handled by the ENTRY script.

For creatures that use this flag, SAI row IDs cannot overlap, thus we use row IDs starting with 1000 and incrementing it (e.g. 1000, 1001, 1002, …).

source_type

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

NameValue
SMART_SCRIPT_TYPE_CREATURE0
SMART_SCRIPT_TYPE_GAMEOBJECT1
SMART_SCRIPT_TYPE_AREATRIGGER2
SMART_SCRIPT_TYPE_TIMED_ACTIONLIST9

id

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

Simple event linking;

  • Example: if id = 0 and link = 1; id 1 will only be able to occur if id = 0 was triggered (id 1 has to use event_type SMART_EVENT_LINK).
  • Smart_event to be used.

Thanks to the use of links, you can execute several actions, keeping the same event.

event_phase_mask

When dealing with phases, phase IDs have to be used. There are 13 (12+1) different phases: 1, 2, … 12 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_BIT00x000Means all phases (1 … 12)
SMART_EVENT_PHASE_110x001Phase 1 only.
SMART_EVENT_PHASE_220x002Phase 2 only.
SMART_EVENT_PHASE_340x004Phase 3 only.
SMART_EVENT_PHASE_480x008Phase 4 only.
SMART_EVENT_PHASE_5160x010Phase 5 only.
SMART_EVENT_PHASE_6320x020Phase 6 only.
SMART_EVENT_PHASE_7640x040Phase 7 only.
SMART_EVENT_PHASE_81280x080Phase 8 only.
SMART_EVENT_PHASE_92560x100Phase 9 only.
SMART_EVENT_PHASE_105120x200Phase 10 only.
SMART_EVENT_PHASE_1110240x400Phase 11 only.
SMART_EVENT_PHASE_1220480x800Phase 12 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

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

NameFlagHexComment
SMART_EVENT_FLAG_NOT_REPEATABLE10x01Event can not repeat
SMART_EVENT_FLAG_DIFFICULTY_020x02Event only occurs in normal dungeon
SMART_EVENT_FLAG_DIFFICULTY_140x04Event only occurs in heroic dungeon
SMART_EVENT_FLAG_DIFFICULTY_280x08Event only occurs in normal raid
SMART_EVENT_FLAG_DIFFICULTY_3160x10Event only occurs in heroic raid
SMART_EVENT_FLAG_RESERVED_5320x20
SMART_EVENT_FLAG_RESERVED_6640x40
SMART_EVENT_FLAG_DEBUG_ONLY1280x80Event only occurs in debug build
SMART_EVENT_FLAG_DONT_RESET2560x100Event will not reset in SmartScript::OnReset()
SMART_EVENT_FLAG_WHILE_CHARMED5120x200Event occurs even if AI owner is charmed

Sets if the event should not repeat or should only happen in a given instance/dungeon difficulty (if applicable); Values can be added together (bitwise math).

event_type

Name Value Param1 Param2 Param3 Param4 Param5 Param6 Comment SMART_EVENT_UPDATE_IC 0 InitialMin InitialMax RepeatMin RepeatMax In combat. SMART_EVENT_UPDATE_OOC 1 InitialMin InitialMax RepeatMin RepeatMax Out of combat. SMART_EVENT_HEALTH_PCT 2 HPMin% HPMax% RepeatMin RepeatMax Health Percentage SMART_EVENT_MANA_PCT 3 ManaMin% ManaMax% RepeatMin RepeatMax Mana Percentage SMART_EVENT_AGGRO 4 On Creature Aggro SMART_EVENT_KILL 5 CooldownMin CooldownMax Player only (0/1) Creature entry (if param3 is 0) On Creature Kill SMART_EVENT_DEATH 6 On Creature Death SMART_EVENT_EVADE 7 On Creature Evade Attack SMART_EVENT_SPELLHIT 8 SpellID School CooldownMin CooldownMax On Creature/Gameobject Spell Hit SMART_EVENT_RANGE 9 InitialMin InitialMax RepeatMin RepeatMax MinDist MaxDist On Victim In Range SMART_EVENT_OOC_LOS 10 NoHostile MaxRange CooldownMin CooldownMax 0/1 Player Only On Target In Distance Out of Combat SMART_EVENT_RESPAWN 11 type (None = 0, Map = 1, Area = 2) MapId ZoneId On Creature/Gameobject Respawn SMART_EVENT_TARGET_HEALTH_PCT 12 HPMin% HPMax% RepeatMin RepeatMax On Target Health Percentage SMART_EVENT_VICTIM_CASTING 13 RepeatMin RepeatMax Spell id (0 any) On Target Casting Spell SMART_EVENT_FRIENDLY_HEALTH 14 HPDeficit Radius RepeatMin RepeatMax On Friendly Health Deficit SMART_EVENT_FRIENDLY_IS_CC 15 Radius RepeatMin RepeatMax SMART_EVENT_FRIENDLY_MISSING_BUFF 16 SpellId Radius RepeatMin RepeatMax onlyInCombat On Friendly Lost Buff SMART_EVENT_SUMMONED_UNIT 17 CretureId (0 all) CooldownMin CooldownMax On Creature/Gameobject Summoned Unit SMART_EVENT_TARGET_MANA_PCT 18 ManaMin% ManaMax% RepeatMin RepeatMax On Target Mana Percentage SMART_EVENT_ACCEPTED_QUEST 19 QuestID (0 any) CooldownMin CooldownMax On Target Accepted Quest SMART_EVENT_REWARD_QUEST 20 QuestID (0 any) CooldownMin CooldownMax On Target Rewarded Quest SMART_EVENT_REACHED_HOME 21 On Creature Reached Home SMART_EVENT_RECEIVE_EMOTE 22 EmoteId CooldownMin CooldownMax On Receive Emote. SMART_EVENT_HAS_AURA 23 SpellID Stacks RepeatMin RepeatMax On Creature Has Aura SMART_EVENT_TARGET_BUFFED 24 SpellID Stacks RepeatMin RepeatMax On Target Buffed With Spell SMART_EVENT_RESET 25 After Combat, On Respawn or Spawn SMART_EVENT_IC_LOS 26 NoHostile MaxRange CooldownMin CooldownMax 0/1 Player Only On Target In Distance In Combat SMART_EVENT_PASSENGER_BOARDED 27 CooldownMin CooldownMax SMART_EVENT_PASSENGER_REMOVED 28 CooldownMin CooldownMax SMART_EVENT_CHARMED 29 onRemove (0 - on apply, 1 - on remove) On Creature Charmed SMART_EVENT_CHARMED_TARGET 30 On Target Charmed SMART_EVENT_SPELLHIT_TARGET 31 SpellId School RepeatMin RepeatMax On Target Spell Hit SMART_EVENT_DAMAGED 32 MinDmg MaxDmg RepeatMin RepeatMax On Creature Damaged SMART_EVENT_DAMAGED_TARGET 33 MinDmg MaxDmg RepeatMin RepeatMax On Target Damaged SMART_EVENT_MOVEMENTINFORM 34 MovementType (0=any) PointID ESCORT_MOTION_TYPE = 17, POINT_MOTION_TYPE = 8 SMART_EVENT_SUMMON_DESPAWNED 35 Entry CooldownMin CooldownMax On Summoned Unit Despawned SMART_EVENT_CORPSE_REMOVED 36 On Creature Corpse Removed SMART_EVENT_AI_INIT 37 SMART_EVENT_DATA_SET 38 Field Value CooldownMin CooldownMax On Creature/Gameobject Data Set, Can be used with SMART_ACTION_SET_DATA SMART_EVENT_WAYPOINT_START 39 PointId (0 any) pathId (0 any) On Creature Waypoint ID Started SMART_EVENT_WAYPOINT_REACHED 40 PointId (0 any) pathId (0 any) On Creature Waypoint ID Reached SMART_EVENT_AREATRIGGER_ONTRIGGER 46 TriggerId (0 any) SMART_EVENT_TEXT_OVER 52 creature_text.GroupID creature.id (0 any) On TEXT_OVER Event Triggered After SMART_ACTION_TALK SMART_EVENT_RECEIVE_HEAL 53 MinHeal MaxHeal CooldownMin CooldownMax On Creature Received Healing SMART_EVENT_JUST_SUMMONED 54 On Creature Just spawned SMART_EVENT_WAYPOINT_PAUSED 55 PointId (0 any) pathID (0 any) On Creature Paused at Waypoint ID SMART_EVENT_WAYPOINT_RESUMED 56 PointId (0 any) pathID (0 any) On Creature Resumed after Waypoint ID SMART_EVENT_WAYPOINT_STOPPED 57 PointId (0 any) pathID (0 any) On Creature Stopped On Waypoint ID SMART_EVENT_WAYPOINT_ENDED 58 PointId (0 any) pathID (0 any) On Creature Waypoint Path Ended SMART_EVENT_TIMED_EVENT_TRIGGERED 59 Id SMART_EVENT_UPDATE 60 InitialMin InitialMax RepeatMin RepeatMax SMART_EVENT_LINK 61 Used to link together multiple events as a chain of events. SMART_EVENT_GOSSIP_SELECT 62 gossip_menu_option.MenuID gossip_menu_option.OptionID On gossip clicked (gossip_menu_option). SMART_EVENT_JUST_CREATED 63 SMART_EVENT_GOSSIP_HELLO 64 On Right-Click Creature/Gameobject that have gossip enabled. SMART_EVENT_FOLLOW_COMPLETED 65 SMART_EVENT_EVENT_PHASE_CHANGE 66 event phase mask On event phase mask set SMART_EVENT_IS_BEHIND_TARGET 67 InitialMin InitialMax RepeatMin RepeatMax RangeMin RangeMax On Creature is behind target. SMART_EVENT_GAME_EVENT_START 68 game_event.eventEntry On game_event started. SMART_EVENT_GAME_EVENT_END 69 game_event.eventEntry On game_event ended. SMART_EVENT_GO_STATE_CHANGED 70 State (0 - Active, 1 - Ready, 2 - Active alternative) SMART_EVENT_GO_EVENT_INFORM 71 EventId SMART_EVENT_ACTION_DONE 72 EventId SMART_EVENT_ON_SPELLCLICK 73 SMART_EVENT_FRIENDLY_HEALTH_PCT 74 InitialMin InitialMax RepeatMin RepeatMax Hp Percentage Range When a friendly creature within range falls below the HP Percentage SMART_EVENT_DISTANCE_CREATURE 75 database guid database entry distance repeat interval (ms) On creature guid OR any instance of creature entry is within distance. SMART_EVENT_DISTANCE_GAMEOBJECT 76 database guid database entry distance repeat interval (ms) On gameobject guid OR any instance of gameobject entry is within distance. SMART_EVENT_COUNTER_SET 77 counterID value cooldownMin cooldownMax If the value of specified counterID is equal to a specified value SMART_EVENT_SUMMONED_UNIT_DIES 82 CreatureId(0 all) CooldownMin CooldownMax SMART_EVENT_NEAR_PLAYERS 101 minPlayers Range (yards) FirstCheck (ms) RepeatMin (ms) RepeatMax (ms) Event will trigger if there are more or equal than minPlayers in range. SMART_EVENT_NEAR_PLAYERS_NEGATION 102 maxPlayers Range (yards) FirstCheck (ms) RepeatMin (ms) RepeatMax (ms) Event will trigger if there are less than maxPlayers in range. SMART_EVENT_NEAR_UNIT 103 Unit type to check (0: creature 1: gob) Entry (template) Count Range Timer (ms) Will check for >= count of specified entry within range SMART_EVENT_NEAR_UNIT_NEGATION 104 Unit type to check (0: creature 1: gob) Entry (template) Count Range Timer (ms) Will check for < count of specified entry within range SMART_EVENT_AREA_CASTING 105 InitialMin InitialMax RepeatMin RepeatMax RangeMin RangeMax Check threat list for hostiles casting. If none are found, repeat in 1200ms SMART_EVENT_AREA_RANGE 106 InitialMin InitialMax RepeatMin RepeatMax RangeMin RangeMax Check threat list for hostiles in range. If none are found, repeat in 1200ms

action_type

NameValueValueParam2Param3Param4Param5Param6Comment
SMART_EVENT_UPDATE_IC0InitialMinInitialMaxRepeatMinRepeatMax In combat.
SMART_EVENT_UPDATE_OOC1InitialMinInitialMaxRepeatMinRepeatMax Out of combat.
SMART_EVENT_HEALTH_PCT2HPMin%HPMax%RepeatMinRepeatMax Health Percentage
SMART_EVENT_MANA_PCT3ManaMin%ManaMax%RepeatMinRepeatMax Mana Percentage
SMART_EVENT_AGGRO4 On Creature Aggro
SMART_EVENT_KILL5CooldownMinCooldownMaxPlayer only (0/1)Creature entry (if param3 is 0) On Creature Kill
SMART_EVENT_DEATH6 On Creature Death
SMART_EVENT_EVADE7 On Creature Evade Attack
SMART_EVENT_SPELLHIT8SpellIDSchoolCooldownMinCooldownMax On Creature/Gameobject Spell Hit
SMART_EVENT_RANGE9InitialMinInitialMaxRepeatMinRepeatMaxMinDistMaxDistOn Victim In Range
SMART_EVENT_OOC_LOS10NoHostileMaxRangeCooldownMinCooldownMax0/1 Player Only On Target In Distance Out of Combat
SMART_EVENT_RESPAWN11type (None = 0, Map = 1, Area = 2)MapIdZoneId On Creature/Gameobject Respawn
SMART_EVENT_TARGET_HEALTH_PCT12HPMin%HPMax%RepeatMinRepeatMax On Target Health Percentage
SMART_EVENT_VICTIM_CASTING13RepeatMinRepeatMaxSpell id (0 any) On Target Casting Spell
SMART_EVENT_FRIENDLY_HEALTH14HPDeficitRadiusRepeatMinRepeatMax On Friendly Health Deficit
SMART_EVENT_FRIENDLY_IS_CC15RadiusRepeatMinRepeatMax
SMART_EVENT_FRIENDLY_MISSING_BUFF16SpellIdRadiusRepeatMinRepeatMaxonlyInCombat On Friendly Lost Buff
SMART_EVENT_SUMMONED_UNIT17CretureId (0 all)CooldownMinCooldownMax On Creature/Gameobject Summoned Unit
SMART_EVENT_TARGET_MANA_PCT18ManaMin%ManaMax%RepeatMinRepeatMax On Target Mana Percentage
SMART_EVENT_ACCEPTED_QUEST19QuestID (0 any)CooldownMinCooldownMax On Target Accepted Quest
SMART_EVENT_REWARD_QUEST20QuestID (0 any)CooldownMinCooldownMax On Target Rewarded Quest
SMART_EVENT_REACHED_HOME21 On Creature Reached Home
SMART_EVENT_RECEIVE_EMOTE22EmoteIdCooldownMinCooldownMax On Receive Emote.
SMART_EVENT_HAS_AURA23SpellIDStacksRepeatMinRepeatMax On Creature Has Aura
SMART_EVENT_TARGET_BUFFED24SpellIDStacksRepeatMinRepeatMax On Target Buffed With Spell
SMART_EVENT_RESET25 After Combat, On Respawn or Spawn
SMART_EVENT_IC_LOS26NoHostileMaxRangeCooldownMinCooldownMax0/1 Player Only On Target In Distance In Combat
SMART_EVENT_PASSENGER_BOARDED27CooldownMinCooldownMax
SMART_EVENT_PASSENGER_REMOVED28CooldownMinCooldownMax
SMART_EVENT_CHARMED29onRemove (0 - on apply, 1 - on remove) On Creature Charmed
SMART_EVENT_CHARMED_TARGET30 On Target Charmed
SMART_EVENT_SPELLHIT_TARGET31SpellIdSchoolRepeatMinRepeatMax On Target Spell Hit
SMART_EVENT_DAMAGED32MinDmgMaxDmgRepeatMinRepeatMax On Creature Damaged
SMART_EVENT_DAMAGED_TARGET33MinDmgMaxDmgRepeatMinRepeatMax On Target Damaged
SMART_EVENT_MOVEMENTINFORM34MovementType (0=any)PointID ESCORT_MOTION_TYPE = 17, POINT_MOTION_TYPE = 8
SMART_EVENT_SUMMON_DESPAWNED35EntryCooldownMinCooldownMax On Summoned Unit Despawned
SMART_EVENT_CORPSE_REMOVED36 On Creature Corpse Removed
SMART_EVENT_AI_INIT37
SMART_EVENT_DATA_SET38FieldValueCooldownMinCooldownMax On Creature/Gameobject Data Set, Can be used with SMART_ACTION_SET_DATA
SMART_EVENT_WAYPOINT_START39PointId (0 any)pathId (0 any) On Creature Waypoint ID Started
SMART_EVENT_WAYPOINT_REACHED40PointId (0 any)pathId (0 any) On Creature Waypoint ID Reached
SMART_EVENT_AREATRIGGER_ONTRIGGER46TriggerId (0 any)
SMART_EVENT_TEXT_OVER52creature_text.GroupIDcreature.id (0 any) On TEXT_OVER Event Triggered After SMART_ACTION_TALK
SMART_EVENT_RECEIVE_HEAL53MinHealMaxHealCooldownMinCooldownMax On Creature Received Healing
SMART_EVENT_JUST_SUMMONED54 On Creature Just spawned
SMART_EVENT_WAYPOINT_PAUSED55PointId (0 any)pathID (0 any) On Creature Paused at Waypoint ID
SMART_EVENT_WAYPOINT_RESUMED56PointId (0 any)pathID (0 any) On Creature Resumed after Waypoint ID
SMART_EVENT_WAYPOINT_STOPPED57PointId (0 any)pathID (0 any) On Creature Stopped On Waypoint ID
SMART_EVENT_WAYPOINT_ENDED58PointId (0 any)pathID (0 any) On Creature Waypoint Path Ended
SMART_EVENT_TIMED_EVENT_TRIGGERED59Id
SMART_EVENT_UPDATE60InitialMinInitialMaxRepeatMinRepeatMax
SMART_EVENT_LINK61 Used to link together multiple events as a chain of events.
SMART_EVENT_GOSSIP_SELECT62gossip_menu_option.MenuIDgossip_menu_option.OptionID On gossip clicked (gossip_menu_option).
SMART_EVENT_JUST_CREATED63
SMART_EVENT_GOSSIP_HELLO64 On Right-Click Creature/Gameobject that have gossip enabled.
SMART_EVENT_FOLLOW_COMPLETED65
SMART_EVENT_EVENT_PHASE_CHANGE66event phase mask On event phase mask set
SMART_EVENT_IS_BEHIND_TARGET67InitialMinInitialMaxRepeatMinRepeatMaxRangeMinRangeMaxOn Creature is behind target.
SMART_EVENT_GAME_EVENT_START68game_event.eventEntry On game_event started.
SMART_EVENT_GAME_EVENT_END69game_event.eventEntry On game_event ended.
SMART_EVENT_GO_STATE_CHANGED70State (0 - Active, 1 - Ready, 2 - Active alternative)
SMART_EVENT_GO_EVENT_INFORM71EventId
SMART_EVENT_ACTION_DONE72EventId
SMART_EVENT_ON_SPELLCLICK73
SMART_EVENT_FRIENDLY_HEALTH_PCT74InitialMinInitialMaxRepeatMinRepeatMaxHp PercentageRangeWhen a friendly creature within range falls below the HP Percentage
SMART_EVENT_DISTANCE_CREATURE75database guiddatabase entrydistancerepeat interval (ms) On creature guid OR any instance of creature entry is within distance.
SMART_EVENT_DISTANCE_GAMEOBJECT76database guiddatabase entrydistancerepeat interval (ms) On gameobject guid OR any instance of gameobject entry is within distance.
SMART_EVENT_COUNTER_SET77counterIDvaluecooldownMincooldownMax If the value of specified counterID is equal to a specified value
SMART_EVENT_SUMMONED_UNIT_DIES82CreatureId(0 all)CooldownMinCooldownMax
SMART_EVENT_NEAR_PLAYERS101minPlayersRange (yards)FirstCheck (ms)RepeatMin (ms)RepeatMax (ms) Event will trigger if there are more or equal than minPlayers in range.
SMART_EVENT_NEAR_PLAYERS_NEGATION102maxPlayersRange (yards)FirstCheck (ms)RepeatMin (ms)RepeatMax (ms) Event will trigger if there are less than maxPlayers in range.
SMART_EVENT_NEAR_UNIT103Unit type to check (0: creature 1: gob)Entry (template)CountRangeTimer (ms) Will check for >= count of specified entry within range
SMART_EVENT_NEAR_UNIT_NEGATION104Unit type to check (0: creature 1: gob)Entry (template)CountRangeTimer (ms) Will check for < count of specified entry within range
SMART_EVENT_AREA_CASTING105InitialMinInitialMaxRepeatMinRepeatMaxRangeMinRangeMaxCheck threat list for hostiles casting. If none are found, repeat in 1200ms
SMART_EVENT_AREA_RANGE106InitialMinInitialMaxRepeatMinRepeatMaxRangeMinRangeMaxCheck threat list for hostiles in range. If none are found, repeat in 1200ms

Predefined SAI templates

Description Name Value (Param1) Param2 Param3 Param4 Param5 Param6 Comment SMARTAI_TEMPLATE_BASIC 0 SMARTAI_TEMPLATE_CASTER 1 spellid repeatMin repeatMax range manaPCT +JOIN: target_param1 as castFlag SMARTAI_TEMPLATE_TURRET 2 spellid repeatMin repeatMax range manaPCT +JOIN: target_param1 as castflag SMARTAI_TEMPLATE_PASSIVE 3 SMARTAI_TEMPLATE_CAGED_GO_PART 4 creatureID give credit at point end (0/1) SMARTAI_TEMPLATE_CAGED_NPC_PART 5 gameObjectID despawntime run (0/1) dist TextGroupID

target_type

Name Value target_param1 target_param2 target_param3 target_param4 target_x target_y target_z target_o Comment SMART_TARGET_NONE 0 None. SMART_TARGET_SELF 1 Self cast. SMART_TARGET_VICTIM 2 Our current target. (ie: highest aggro) SMART_TARGET_HOSTILE_SECOND_AGGRO 3 Max Range (0: Unlimited) Player Only (0/1) Power Type + 1 Missing Aura Second highest aggro. SMART_TARGET_HOSTILE_LAST_AGGRO 4 Max Range (0: Unlimited) Player Only (0/1) Power Type + 1 Missing Aura Dead last on aggro. SMART_TARGET_HOSTILE_RANDOM 5 Max Range (0: Unlimited) Player Only (0/1) Power Type + 1 Missing Aura Just any random target on our threat list. SMART_TARGET_HOSTILE_RANDOM_NOT_TOP 6 Max Range (0: Unlimited) Player Only (0/1) Power Type + 1 Missing Aura Any random target except top threat. SMART_TARGET_ACTION_INVOKER 7 Unit who caused this Event to occur. SMART_TARGET_POSITION 8 x y z o Use xyz from event params. SMART_TARGET_CREATURE_RANGE 9 creature_template.entry (0 any) minDist maxDist alive state (1 alive, 2 dead, 0 both) All creatures with the specified ID within the specified range and the specified alive state. SMART_TARGET_CREATURE_GUID 10 creature.guid creature_template.entry getFromHashMap (0/1, this does not work in instances!) Creature with specified GUID and/or specified creature template ID. SMART_TARGET_CREATURE_DISTANCE 11 creature_template.entry (0 any) maxDist alive state (1 alive, 2 dead, 0 both) All creatures with the specified ID within the specified distance and the specified alive state. SMART_TARGET_STORED 12 id Uses pre-stored target(list) SMART_TARGET_GAMEOBJECT_RANGE 13 gameobject_template.entry (0 any) minDist maxDist All game objects with the specified ID within the specified range. SMART_TARGET_GAMEOBJECT_GUID 14 gameobject.guid gameobject_template.entry getFromHashMap (0/1, this does not work in instances!) Object with specified GUID and/or specified game object template ID. SMART_TARGET_GAMEOBJECT_DISTANCE 15 gameobject_template.entry (0 any) maxDist All objects with the specified ID within the specified distance. SMART_TARGET_INVOKER_PARTY 16 Invoker's party members SMART_TARGET_PLAYER_RANGE 17 minDist maxDist maxCount When target.o is set and it didnt find any targets in min-max range, it will try all possible targets in max range instead. All players up to maxCount within the specified range. Excluding GMs and Dead. SMART_TARGET_PLAYER_DISTANCE 18 maxDist All players within the specified distance. SMART_TARGET_CLOSEST_CREATURE 19 creature_template.entry (0 any) maxDist (Can be from 0-100 yards) dead? (0/1) Closest creature with the specified ID within the specified range. SMART_TARGET_CLOSEST_GAMEOBJECT 20 gameobject_template.entry (0 any) maxDist (Can be from 0-100 yards) Closest object with specified ID within specified range. SMART_TARGET_CLOSEST_PLAYER 21 maxDist Closest player within specified range. SMART_TARGET_ACTION_INVOKER_VEHICLE 22 Unit's vehicle who caused this Event to occur SMART_TARGET_OWNER_OR_SUMMONER 23 use owner of owner (0/1) Unit's owner or summoner SMART_TARGET_THREAT_LIST 24 maxDist (0 any) All units on creature's threat list within the specified distance if maxDist > 0 SMART_TARGET_CLOSEST_ENEMY 25 maxDist playerOnly (0/1) Any attackable target (creature or player) within maxDist SMART_TARGET_CLOSEST_FRIENDLY 26 maxDist playerOnly (0/1) Any friendly unit (creature, player or pet) within maxDist SMART_TARGET_LOOT_RECIPIENTS 27 All players that have tagged this creature (for kill credit) SMART_TARGET_FARTHEST 28 maxDist playerOnly (0/1) isInLos (0/1) Farthest unit on the threat list SMART_TARGET_VEHICLE_PASSENGER 29 seat number (vehicle can target it's own accessory) SMART_TARGET_PLAYER_WITH_AURA 201 spellID Negative (0/1) MaxDist MinDist Number to resize the target list Target players with or without aura SMART_TARGET_RANDOM_POINT 202 range (yards) amount (for summoning creature) self as middle (0/1) else use xyz This only works with SMART_ACTION_SUMMON_CREATURE, SMART_ACTION_MOVE_TO_POS and SMART_ACTION_JUMP_TO_POS SMART_TARGET_ROLE_SELECTION 203 rangeMax (yards) TargetMask (Tanks (1), Healer (2) Damage (4)) Resize list Target a Tank/Healer/DPS role. Based on the players spec. SMART_TARGET_SUMMONED_CREATURES 204 creature_template.Entry SMART_TARGET_INSTANCE_STORAGE 205 data index Type (creature (1), gameobject (2))

comment

Commenting on SAI uses a template which is the following: (with an example)

“Creature name - Event - Action”

“Minion of Gurok - On spawn - Set Random Movement”

Quick notes:

Always update creature_template,gameobject_template or areatrigger_scripts with: UPDATE `creature_template` SET `AIName` = 'SmartAI' WHERE `entry` = y;

UPDATE `gameobject_template` SET `AIName` = 'SmartGameObjectAI' WHERE `entry` = y;

INSERT INTO `areatrigger_scripts` (`entry`, `ScriptName`) VALUES (y, 'SmartTrigger'); If the creature or GO is inside a dungeon, set event_flags accordingly to the instance difficulty (heroic, 25 man, etc.). In case of doubt about an Event, Action_or _Target,_check source code (_src/server/game/AI/SmartScripts files; mainly *SmartScript.cpp)

Cast Flags

Name Flag Hex Comment SMARTCAST_INTERRUPT_PREVIOUS 1 0x001 Interrupt any spell casting SMARTCAST_TRIGGERED 2 0x002 Triggered (this makes spell cost zero mana and have no cast time) SMARTCAST_AURA_NOT_PRESENT 32 0x020 Only casts the spell if the target does not have an aura from the spell SMARTCAST_COMBAT_MOVE 64 0x040 Prevent combat movement on cast, allow on fail range, mana, LOS SMARTCAST_THREATLIST_NOT_SINGLE 128 0x080 Only cast if the source's threatlist is higher than one. This includes pets SMARTCAST_TARGET_POWER_MANA 256 0x100 Only cast if the target has power type mana

Triggered Flags

Name Flag Hex Comment TRIGGERED_NONE 0 0x00000000 Not triggered TRIGGERED_IGNORE_GCD 1 0x00000001 Will ignore GCD TRIGGERED_IGNORE_SPELL_AND_CATEGORY_CD 2 0x00000002 Will ignore Spell and Category cooldowns TRIGGERED_IGNORE_POWER_AND_REAGENT_COST 4 0x00000004 Will ignore power and reagent cost TRIGGERED_IGNORE_CAST_ITEM 8 0x00000008 Will not take away cast item or update related achievement criteria RIGGERED_IGNORE_AURA_SCALING 16 0x00000010 Will ignore aura scaling TRIGGERED_IGNORE_CAST_IN_PROGRESS 32 0x00000020 Will not check if a current cast is in progress TRIGGERED_IGNORE_COMBO_POINTS 64 0x00000040 Will ignore combo point requirement TRIGGERED_CAST_DIRECTLY 128 0x00000080 In Spell::prepare, will be cast directly without setting containers for executed spell TRIGGERED_IGNORE_AURA_INTERRUPT_FLAGS 256 0x00000100 Will ignore interruptible aura's at cast TRIGGERED_IGNORE_SET_FACING 512 0x00000200 Will not adjust facing to target (if any) TRIGGERED_IGNORE_SHAPESHIFT 1024 0x00000400 Will ignore shapeshift checks TRIGGERED_IGNORE_CASTER_AURASTATE 2048 0x00000800 Will ignore caster aura states including combat requirements and death state TRIGGERED_IGNORE_CASTER_MOUNTED_OR_ON_VEHICLE 8192 0x00002000 Will ignore mounted/on vehicle restrictions TRIGGERED_IGNORE_CASTER_AURAS 65536 0x00010000 Will ignore caster aura restrictions or requirements TRIGGERED_DISALLOW_PROC_EVENTS 131072 0x00020000 Disallows proc events from triggered spell (default) TRIGGERED_DONT_REPORT_CAST_ERROR 262144 0x00040000 Will return SPELL_FAILED_DONT_REPORT in CheckCast functions TRIGGERED_FULL_MASK 524287 0x0007FFFF All triggered flags TRIGGERED_IGNORE_EQUIPPED_ITEM_REQUIREMENT 524288 0x00080000 Will ignore equipped item requirements TRIGGERED_NO_PERIODIC_RESET 1048576 0x00100000 Periodic aura tick wont be reset on override TRIGGERED_FULL_DEBUG_MASK 4294967295 0xFFFFFFFF NOTICE: If triggeredFlags = 0, cast will trigger with TRIGGERED_FULL_MASK = 524287.

React States

Name Value Comment REACT_PASSIVE 0 Does not defend or attack at all. Does nothing. REACT_DEFENSIVE 1 Only attacks back when attacked. REACT_AGGRESSIVE 2 Will attack if on threat list and in threat radius. (default)

Summon Types

Name Value Comment TEMPSUMMON_TIMED_OR_DEAD_DESPAWN 1 Despawns after a specified time OR when the creature disappears. TEMPSUMMON_TIMED_OR_CORPSE_DESPAWN 2 Despawns after a specified time OR when the creature dies. TEMPSUMMON_TIMED_DESPAWN 3 Despawns after a specified time. TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT 4 Despawns after a specified time after the creature is out of combat. TEMPSUMMON_CORPSE_DESPAWN 5 Despawns instantly after death. TEMPSUMMON_CORPSE_TIMED_DESPAWN 6 Despawns after a specified time after death. TEMPSUMMON_DEAD_DESPAWN 7 Despawns when the creature disappears. TEMPSUMMON_MANUAL_DESPAWN 8 Despawns when UnSummon() (or Force Despawn action) is called.

Smart Follow Types

Name Value Comment FOLLOW_TYPE_CIRCLE 1 360º Degrees around leader. 90º Degrees is the maximum angle. FOLLOW_TYPE_SEMI_CIRCLE_BEHIND 2 180º Degrees behind leader. FOLLOW_TYPE_SEMI_CIRCLE_FRONT 3 180º Degrees in front of leader. FOLLOW_TYPE_LINE 4 Front → Back → Front → Back. FOLLOW_TYPE_COLUMN 5 Left → Right → Left → Right. FOLLOW_TYPE_ANGULAR 6 Geese-like formation 135º and 225º degrees behind leader.

Power Types

Name Value POWER_MANA 0 POWER_RAGE 1 POWER_FOCUS 2 POWER_ENERGY 3

Invoker:

white list of events that actually have an invoker passed to them
Actions like SMART_ACTION_INVOKER_CAST and targets like SMART_TARGET_ACTION_INVOKER will work only if the event is in this list:
  • SMART_EVENT_AGGRO
  • SMART_EVENT_DEATH
  • SMART_EVENT_KILL
  • SMART_EVENT_SUMMONED_UNIT
  • SMART_EVENT_SPELLHIT
  • SMART_EVENT_SPELLHIT_TARGET
  • SMART_EVENT_DAMAGED
  • SMART_EVENT_RECEIVE_HEAL
  • SMART_EVENT_RECEIVE_EMOTE
  • SMART_EVENT_JUST_SUMMONED
  • SMART_EVENT_DAMAGED_TARGET
  • SMART_EVENT_SUMMON_DESPAWNED
  • SMART_EVENT_PASSENGER_BOARDED
  • SMART_EVENT_PASSENGER_REMOVED
  • SMART_EVENT_GOSSIP_HELLO
  • SMART_EVENT_GOSSIP_SELECT
  • SMART_EVENT_ACCEPTED_QUEST
  • SMART_EVENT_REWARD_QUEST
  • SMART_EVENT_FOLLOW_COMPLETED
  • SMART_EVENT_ON_SPELLCLICK
  • SMART_EVENT_GO_LOOT_STATE_CHANGED
  • SMART_EVENT_AREATRIGGER_ONTRIGGER
  • SMART_EVENT_IC_LOS
  • SMART_EVENT_OOC_LOS
  • SMART_EVENT_DISTANCE_CREATURE
  • SMART_EVENT_FRIENDLY_HEALTH
  • SMART_EVENT_FRIENDLY_HEALTH_PCT
  • SMART_EVENT_FRIENDLY_IS_CC
  • SMART_EVENT_FRIENDLY_MISSING_BUFF
  • SMART_EVENT_ACTION_DONE
  • SMART_EVENT_TARGET_HEALTH_PCT
  • SMART_EVENT_TARGET_MANA_PCT
  • SMART_EVENT_RANGE
  • SMART_EVENT_VICTIM_CASTING
  • SMART_EVENT_TARGET_BUFFED
  • SMART_EVENT_IS_BEHIND_TARGET
  • SMART_EVENT_INSTANCE_PLAYER_ENTER
  • SMART_EVENT_TRANSPORT_ADDCREATURE
  • SMART_EVENT_DATA_SET
  • SMART_EVENT_AREA_CASTING
  • SMART_EVENT_AREA_RANGE
数据库/world数据库/smart_scripts.1696326966.txt.gz · 最后更改: 2023/10/03 17:56 由 admin

Donate Powered by PHP Valid HTML5 Valid CSS Driven by DokuWiki