Before typing out the rest of this post, I’d like to thank Tatsu of AC Web for posting, and resolving, his issue which taught me about this method of making creatures randomly wander. If you know of any additional information, notice an error, etc.. just comment and I’ll do my best to keep this post updated. In this post I will assume that you know enough to be able to execute SQL queries on your database.
Just in case anyone wants to know what I’m running:
- Windows 8, x64 — Home
- Debian 7, x64 — Server
- TrinityCore — Latest version as of 20/June/2015
- WoTLK 3.3.5a
There are four fields in the creature table of the world database that we will be dealing with. The fields are as follows.
- spawndist – The distance, in yards, in which a creature can wander from it’s spawn point.
- MovementType – The type of movement of the creature. This should always be set to 1 to specify that the creature should wander randomly.
- id – The ID of the creature from the creature_template table.
- guid – The unique ID of a single creature. This can be found by selecting a creature in-game and using the .npc info command.
There are two, slightly, different queries which you can use, depending on what you wish to do. The first query will set all creatures, of the specified ID, to wander randomly in the specified spawndist radius. The second query will set a single creature, of the specified GUID, to wander randomly in the specified spawndist radius.
To use the queries, just replace 40 and 90201 with whichever values you require.
UPDATE creature SET spawndist = 40, MovementType = 1 WHERE id = 90201;