Creature speech

From Project Skyfire
Revision as of 14:57, 18 September 2011 by Marqin (talk | contribs) (decat)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

This is step-by-step guide to make your creature talking.

1. Get the text. You can use wowpedia for that (example).

2. Get speech entries. They can be found in dbc, which you could explore by using any utility that reads dbc - for example, dbc-viewer or dbc-util (simplier in use). Just read with chosen utility `SoundEntries.dbc` and find entries. For bosses, that could be done just by doing text search of boss-name. For example, for Sinestra, with dbc-util, you firstly convert dbc to csv, then open it in excel and `ctrl-f -> Sinestra -> enter`. From that entries you will need two fields: speech-sound-id and speech-sound-name, they are 1st and 3rd columns correspondingly.

3. Associate texts with sounds. Now you need to dive into the client mpq-files. You can use mpq-editor for that. Just try different mpq's until you find your creature somewhere in Sounds/creatures/. In target-creature's folder you will see sound files named just as values of speech-sound-name field from step 2. Listen to this files and put in correspondence texts with speech-sound-id's.

Now if you want to make speech random appearing in game, or prepare it for manual invoking from C++ code, you should firstly add speech-data in `creature_text` table. In `entry` you should put creature-entry, in `id` - relative index of speech phrase (for later use from C++ code), in `groupid` - indexes that describe phrase's group (if are the same for two rows within same creature, then both phrases appear at one time), in `sound` - speech-sound-id, in `text` - associated text, in `probability` - probability of appearing randomly in game (0 for manual-only usage).

Example:

DELETE FROM `creature_text` WHERE `entry` = 45213;
INSERT INTO `creature_text`
    (`entry`,`id`,`sound`,`text`)
VALUES
    (45213, 0, 20199 -- aggro
    , 'We were fools to entrust an imbecile like Cho''gall with such a sacred duty. I will deal with you intruders myself!'),
    (45213, 1, 20200 -- death
    , 'Deathwing... I have fallen... the brood... is lost...'),
    ...

UPDATE `creature_text` c
  SET `probability` = 0,
      `groupid`     = c.`id`,
      `type`        = 1
WHERE `entry` = 45213;

To invoke speech from C++ you could use CreatureAI::Talk method (pass `creature_text`.`id` into it).