0% found this document useful (0 votes)
1K views8 pages

AP's Guide To Custom NPC Text

The document provides instructions for customizing talking NPCs in MaNGOS using SQL tables. It explains how to define gossip options and text for NPCs by linking entries in the creature_template, gossip_menu, npc_text and gossip_menu_option tables. It also describes how to configure an NPC to say or emote something using the creature_ai_scripts table.

Uploaded by

astralproxy
Copyright
© Attribution Non-Commercial (BY-NC)
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
1K views8 pages

AP's Guide To Custom NPC Text

The document provides instructions for customizing talking NPCs in MaNGOS using SQL tables. It explains how to define gossip options and text for NPCs by linking entries in the creature_template, gossip_menu, npc_text and gossip_menu_option tables. It also describes how to configure an NPC to say or emote something using the creature_ai_scripts table.

Uploaded by

astralproxy
Copyright
© Attribution Non-Commercial (BY-NC)
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 8

AP's Guide to Custom Talking NPCs w/ MaNGOS

A few quick notes before we begin:


 APPLY UPDATE every time you change a record (row).
o In Navicat, click the checkmark in the lower left.
o Navicat does this automatically if you switch rows/records.
 This or a very similar approach will probably work for trinity/ascent/arcemu as well.
 I use Navicat, so whenever you see that word just read it as whatever SQL program you use.
 I use ID numbers far above the Blizz range to ensure no conflicts with future updates.
 I use specific numbers here; just replace them with whatever you want.
 To refer to certain fields within tables I use this format: table_name:column_name
 If I made a mistake or left something out, I apologize. But this guide should nevertheless give you a very
good idea of what to do. ;-)

OVERVIEW

Here is the trail you must follow from where you define your creatures/NPCs to what they say:
 creature_template:gossip_menu_id  gossip_menu:entry
 gossip_menu:text_id  npc_text:ID
 creature_template:gossip_menu_id  gossip_menu_option:menu_id

So, in Navicat open those 3 tables from the mangos category:


creature_template, gossip_menu, npc_text, and gossip_menu_option
Note: They will be tabbed in the table editor window.

In ‘creature_template’, Sort the first column ('entry') by Ascending.


Go to the last page of the Table and/or scroll to your entry.
In the ‘npcflag’ field, enter 1 to make your NPC gossip (talk in a dialogue window).

Scroll/Tab over to the column 'gossip_menu_id'.


Enter a number <= 65535 (max allowed; please tell me if you know how to increase this).
Note: I recommend starting at 65535 and working your way down.

APPLY UPDATES!

Open the ‘gossip_menu’ table.


Insert a new record (row).
Enter these values in the following fields:
 ‘entry’: 65535
 ‘text_id’: 1000001
 cond_1: 0, your NPC can only say one thing
1-7, to choose which thing to say if more than one
Note: I like to match the text_id here to my creature_template:entry to keep things more organized.

APPLY UPDATES!
To Simply Have the NPC Say One Thing

Open the ‘npc_text’ table.


Insert a new record (row).
Enter these values in the following fields:
 ‘ID’: 1000001
 ‘text0_0’: “What you want your NPC to say” [without quotes]
o Use special text: $B = line break, $N = name, $R = race, $C = class, $G = gender
 ‘lang0’: 0 [common], or 1-7 for a specific language
 ‘prob0’: 1 [use this; I’m not sure if/how probabilities work here]
o The probability the NPC will say text0_0
 ‘em0_0’: 0, or [see below]
o What the NPC emotes upon greeting the player
o EMOTE_STATE_DANCE = 10
o EMOTE_STATE_SLEEP = 12
o EMOTE_STATE_SIT = 13
o EMOTE_STATE_STAND = 26
o EMOTE_STATE_WORK = 28
o EMOTE_STATE_STUN = 64
o EMOTE_STATE_DEAD = 65
o EMOTE_STATE_KNEEL = 68
o EMOTE_ONESHOT_WAVE_NOSHEATHE = 70
o EMOTE_ONESHOT_CHEER_NOSHEATHE = 71
o EMOTE_ONESHOT_EAT_NOSHEATHE = 92
o EMOTE_STATE_WORK_NOSHEATHE = 173
o EMOTE_STATE_FISHING = 379
o EMOTE_ONESHOT_FISHING = 380
o EMOTE_ONESHOT_LOOT = 381
o EMOTE_STATE_WHIRLWIND = 382
o EMOTE_STATE_LAUGH = 392
o EMOTE_STATE_CANNIBALIZE = 398
o EMOTE_STATE_DANCESPECIAL = 400
o EMOTE_STATE_EXCLAIM = 412
o EMOTE_STATE_SIT_CHAIR_MED = 415

APPLY UPDATES!
To Have a Path of Dialogue/Options

Open the ‘gossip_menu_option’ table.


Insert a new record (row).
Enter these values in the following fields:
 ‘menu_id’: 65535
 ‘id’: 1, [or an integer; must be unique]
o Note: Multiple records can be created with the same ‘menu_id’, but each must have a
unique ‘id’. By doing this, you can have multiple options in the window at one time. The
records with lower ‘id’s appear at the bottom of the window.
 ‘option_icon’: 0 – 10
o GOSSIP_ICON_CHAT = 0, //white chat bubble
o GOSSIP_ICON_VENDOR = 1, //brown bag
o GOSSIP_ICON_TAXI = 2, //flight
o GOSSIP_ICON_TRAINER = 3, //book
o GOSSIP_ICON_INTERACT_1 = 4, //interaction wheel
o GOSSIP_ICON_INTERACT_2 = 5, //interaction wheel
o GOSSIP_ICON_MONEY_BAG = 6, //brown bag w/ yellow dot
o GOSSIP_ICON_TALK = 7, //white chat bubble w/ black dots
o GOSSIP_ICON_TABARD = 8, //tabard
o GOSSIP_ICON_BATTLE = 9, //two swords
o GOSSIP_ICON_DOT = 10, //yellow dot
 ‘option_text’: “The text you want displayed for this option…” [without quotes]
 ‘option_id’: 0 – 19
o What this option allows the NPC to do on the next screen
o GOSSIP_OPTION_NONE = 0
o GOSSIP_OPTION_GOSSIP = 1
o GOSSIP_OPTION_QUESTGIVER = 2
o GOSSIP_OPTION_VENDOR = 3
o GOSSIP_OPTION_TAXIVENDOR = 4
o GOSSIP_OPTION_TRAINER = 5
o GOSSIP_OPTION_SPIRITHEALER = 6
o GOSSIP_OPTION_SPIRITGUIDE = 7
o GOSSIP_OPTION_INNKEEPER = 8
o GOSSIP_OPTION_BANKER = 9
o GOSSIP_OPTION_PETITIONER = 10
o GOSSIP_OPTION_TABARDDESIGNER = 11
o GOSSIP_OPTION_BATTLEFIELD = 12
o GOSSIP_OPTION_AUCTIONEER = 13
o GOSSIP_OPTION_STABLEPET = 14
o GOSSIP_OPTION_ARMORER = 15
o GOSSIP_OPTION_UNLEARNTALENTS = 16
o GOSSIP_OPTION_UNLEARNPETTALENTS = 17
o GOSSIP_OPTION_LEARNDUALSPEC = 18
o GOSSIP_OPTION_OUTDOORPVP = 19
o GOSSIP_OPTION_MAX
 ‘npc_option_npcflag’
o Must match up to the above ‘option_id’ to have that display
‘option_id’ ‘npc_option_npcflag’
0 0
1 1
2 2
3 128
4 8192
5 16
6 16384
7 32768
8 65536
9 131072
10 262144
11 524288
12 1048576
13 2097152
14 4194304
15 4096
16 16
17 16
18 16
19 [added by code]*
* option for outdoor pvp creatures
 ‘action_menu_id’: 65534 [or, the next ‘menu_id’ option to go to]
 ‘action_poi_id’
o To make a POI (point of interest) display on the minimap, use the value from
points_of_interest:entry
 ‘box_coded’
o Pops up a box where you can enter some code.
 ‘box_money’
o Pops up a box where you can enter an amount of money.
 ‘box_text’: “String of text to give player a choice…” [without quotes]
o Pops up an Accept/Cancel box. Choosing Accept progresses the conversation; choosing
Cancel ends it (and won’t let you speak to that NPC again until you relog?).

To Have Your NPC Say/Yell/Whisper Something

First, open the ‘creature_template’ table.


Go to the record for your NPC.
In the ‘AIName’ column, put: “EventAI” [without quotes]

Open the ‘creature_ai_scripts’ table.


Insert a new record (row).
Enter these values in the following fields:
 ‘id’: 99999999
 ‘creature_id’: 1000001
 event_type: [0 – 26, as defined below]

 0 = EVENT_T_TIMER: COMBAT ONLY! - Expires first between (Param1) and (Param2)


and then between every (Param3) and (Param4).
o Parameter 1: InitialMin
o Parameter 2: InitialMax
o Parameter 3: RepeatMin
o Parameter 4: RepeatMax

 1 = EVENT_T_TIMER_OOC: OUT OF COMBAT - Expires first between (Param1) and


(Param2) and then between every (Param3) and (Param4).
o Parameter 1: InitialMin
o Parameter 2: InitialMax
o Parameter 3: RepeatMin
o Parameter 4: RepeatMax

 2 = EVENT_T_HP: Expires when HP is between (Param1) and (Param2). Will repeat


every (Param3) and (Param4).
o Parameter 1: HPMax% (Note: Max goes before Min here. Don't get confused.)
o Parameter 2: HPMin%
o Parameter 3: RepeatMin
o Parameter 4: RepeatMax

 3 = EVENT_T_MANA: Expires once Mana% is between (Param1) and (Param2). Will


repeat every (Param3) and (Param4).
o Parameter 1: ManaMax%
o Parameter 2: ManaMin%
o Parameter 3: RepeatMin
o Parameter 4: RepeatMax

 4 = EVENT_T_AGGRO: Expires upon initial aggro (does not repeat).

 5 = EVENT_T_KILL: Expires upon killing a player. Will repeat every (Param1) and
(Param2).
o Parameter 1: RepeatMin
o Parameter 2: RepeatMax

 6 = EVENT_T_DEATH: Expires upon Death.

 7 = EVENT_T_EVADE: Expires upon creature EnterEvadeMode().

 8 = EVENT_T_SPELLHIT: Expires upon Spell hit. If (param1) is set will only


expire on that spell. If (param2) will only expire on spells of that school.
Will repeat every (Param3) and (Param4) .
o Parameter 1: SpellID
o Parameter 2: School
o Parameter 3: RepeatMin
o Parameter 4: RepeatMax

 9 = EVENT_T_RANGE: Expires when the highest threat target distance is greater


than (Param1) and less than (Param2). Will repeat every (Param3) and (Param4) .
o Parameter 1: MinDist
o Parameter 2: MaxDist
o Parameter 3: RepeatMin
o Parameter 4: RepeatMax

 10 = EVENT_T_OOC_LOS: Expires when a unit moves within distance


(MaxAllowedRange) of a creature. If (Param1) is zero it will expire only when
unit is hostile, friendly otherwise (Param1 = 1), depends generally on faction.
Will repeat every (Param3) and (Param4). Does not expire when the creature is in
combat.
o Parameter 1: Hostile-or-Not
o Parameter 2: MaxAllowedRange
o Parameter 3: RepeatMin
o Parameter 4: RepeatMax
 11 = EVENT_T_SPAWNED: Expires at initial spawn and at creature respawn (useful
for setting ranged movement type)

 12 = EVENT_T_TARGET_HP: Expires when Current Target's HP is between (Param1) and


(Param2). Will repeat every (Param3) and (Param4) .
o Parameter 1: HPMax%
o Parameter 2: HPMin%
o Parameter 3: RepeatMin
o Parameter 4: RepeatMax

 13 = EVENT_T_TARGET_CASTING: Expires when the player is casting a spell. Will


repeat every (Param1) and (Param2) .
o Parameter 1: RepeatMin
o Parameter 2: RepeatMax

 14 = EVENT_T_FRIENDLY_HP: Expires when a friendly unit in radius(param2) has at


least (param1) hp missing. Will repeat every (Param3) and (Param4) .
o Parameter 1: HPDeficit
o Parameter 2: Radius
o Parameter 3: RepeatMin
o Parameter 4: RepeatMax

 15 = EVENT_T_FRIENDLY_IS_CC: Expires when a friendly unit is Crowd controlled


within the given radius (param2). Will repeat every (Param3) and (Param4) .
o Parameter 1: DispelType
o Parameter 2: Radius
o Parameter 3: RepeatMin
o Parameter 4: RepeatMax

 16 = EVENT_T_MISSING_BUFF: Expires when a friendly unit is missing aura's given


by spell (param1) within radius (param2). Will repeat every (Param3) and
(Param4) .
o Parameter 1: SpellId
o Parameter 2: Radius
o Parameter 3: RepeatMin
o Parameter 4: RepeatMax

 17 = EVENT_T_SUMMONED_UNIT: Expires after creature with entry(Param1) is spawned


or for all spawns if param1 = 0. Will repeat every (Param2) and (Param3) .
o Parameter 1: CreatureId
o Parameter 2: RepeatMin
o Parameter 3: RepeatMax

 18 = EVENT_T_TARGET_MANA:
o Parameter 1: ManaMax%
o Parameter 2: ManaMin%
o Parameter 3: RepeatMin
o Parameter 4: RepeatMax

 21 = EVENT_T_REACHED_HOME: Expires when creature reach it's home(spawn) location


after Evade.

 22 = EVENT_T_RECEIVE_EMOTE: Expires when creature receive emote with text emote


id(enum TextEmotes). Condition can be defined. If set, then most conditions has
additional value [see table enum ConditionType]
o Parameter 1: EmoteId
o Parameter 2: Condition
o Parameter 3: CondValue1
o Parameter 4: CondValue2

 23 = EVENT_T_BUFFED: Expires when creature have spell (Param1) auras applied


stack greater or equal provided in Param2 amount. Will repeat every (Param3) and
(Param4).
o Parameter 1: SpellId
o Parameter 2: AmmountInStack
o Parameter 3: RepeatMin
o Parameter 4: RepeatMax

 24 = EVENT_T_TARGET_BUFFED: Expires when target unit have spell (Param1) auras


applied stack greater or equal provided in (Param2) amount. Will repeat every
(Param3) and (Param4).
o Parameter 1: SpellId
o Parameter 2: AmmountInStack
o Parameter 3: RepeatMin
o Parameter 4: RepeatMax

 25 = EVENT_T_SUMMONED_JUST_DIED: Expires after creature with entry = (Param1)


dies. Expires for all spawns if (Param1) = 0. Will repeat every (Param2) and
(Param3).
o Parameter 1: CreatureId
o Parameter 2: RepeatMin
o Parameter 3: RepeatMax

 26 = EVENT_T_SUMMONED_JUST_DESPAWN: Expires before creature with entry =


(Param1) is despawned. Expires for all spawns if (Param1) = 0. Will repeat every
(Param2) and (Param3).
o Parameter 1: CreatureId
o Parameter 2: RepeatMin
o Parameter 3: RepeatMax

[Continuation of ‘creature_ai_scripts’]
 ‘event_chance”: 100
 ‘event_flags’: 1 [a bitmask Value from the following table]
o Add Values to allow for NPCs in instances.
Bit / Value* Name Description
Event repeats (Does not repeat if this flag is not
0 / 1 EFLAG_REPEATABLE
set)
Event only occurs in instance difficulty 0 (will not
1 / 2 EFLAG_DIFFICULTY_0
occur if not set)
Event only occurs in instance difficulty 1 (will not
2 / 4 EFLAG_DIFFICULTY_1
occur if not set)
Event only occurs in instance difficulty 2 (will not
3 / 8 EFLAG_DIFFICULTY_2
occur if not set)
Event only occurs in instance difficulty 3 (will not
4 / 16 EFLAG_DIFFICULTY_3
occur if not set)
7 / 128 EFLAG_DEBUG_ONLY Event only occurs in debug build

* = Represents what the value in the field would be with no other additive flags.

 ‘action1_type’: 1
 ‘action1_param1’: - 999999 [corresponds to creature_ai_texts:entry]
Open the ‘creature_ai_texts’ table.
Insert a new record (row).
Enter these values in the following fields:
 ‘entry’: -999999
o Note: This number is always negative.
 ‘content_default’: “What you want the NPC to say…” [without quotes]
o Note: This is the actual text presented in the default language (English).
 ‘type’: [value corresponding to the method of display]
Value Type
0 Say
1 Yell
2 Text Emote
3 Boss Emote
4 Whisper
5 Boss Whisper

 ‘sound’: The sound ID that will play with along with the text. All sounds are from sounds.dbc.
 ‘language’: The in-game language of the text. Languages are from Languages.dbc.
 ‘emote’: The emote that the creature performs along with the text.

If something in these directions did not make sense, check out:


http://trinitycore.info/index.php/Event_AI

And… that’s it! Go spawn your NPC ;-)

Other things to try:


 Use this link to read up on conditions. You can require the player to have a certain item
(equipped), complete a certain quest, have a certain aura, etc. before the NPC will say a certain
thing to them.

Thanks to: MaNGOS, Darkrulerz, trinitycore.info

You might also like