Since a lot of people have been asking for support for trinity and many are asking on how to make NPCs for trinity etc.
and often the answer is "Do it yourself in the database" or similar, I am making this guide.
Creating NPCs for Trinity requires other tables to be used to define various stats for the NPC.
This makes it hard to make a creator, where you simply input the stats to the columns and output the SQL. There needs to be something extra to look at other tables and calculate the health and so on.
This could have been done in other ways too, and in a single query, but I am doing it in 2 parts, so you do not need to edit the query here and there, since it just makes it difficult for you guys.
There are only few simple steps here:
Create the NPC on wow-v
Modify the downloaded SQL a bit and execute it to DB
Run the stat setter SQL (dont forget to change the entry and stat values to it)
Restart and enjoy.
I am using some .. a bit more complex SQL than just a simple insert here :3
So, lets start.
Creating the base NPC:
Create your NPC in the mangos NPC/mob creator on wow-v.
Use health / mana / armor values like 99999 or something that you can easily find from the SQL batch. (I am using 123123 for health, mana and armor (min and max))
Dont worry, you will set the stats later.
Modifying the SQL:
Open up the SQL batch in a notepad or any text editor.
Replace the first line with this:
insert into `creature_template` (`entry`, `modelid1`, `modelid2`, `modelid3`, `modelid4`, `name`, `subname`, `minlevel`, `maxlevel`, `faction_A`, `faction_H`, `npcflag`, `speed_walk`, `speed_run`, `scale`, `rank`, `mindmg`, `maxdmg`, `baseattacktime`, `family`, `type`, `resistance1`, `resistance2`, `resistance3`, `resistance4`, `resistance5`, `resistance6`, `mingold`, `maxgold`, `unit_class`)
Then delete a part like this from the second line:
, '123123', '123123', '123123', '123123', '123123'These are the health etc values, so if you used different number(s) than I did, it looks different.
Now add this to the end of the value list (list of numbers):
,2The ending of the code should look like this now:
, '0',2);This is the NPC class.
I am using Paladin, since paladins have mana, incase you want mana.
If I would use 1 (warrior), you would not be able to set mana later.
Note I can not be 100% sure this value does not affect anything else but the stats (hp, mana, armor)
Now you can execute the SQL, so just run it. (paste to query and run or save the file and import)
Now you have the NPC in and it has everything set, except the health, mana and armor values.
To set them you are going to use this little SQL I created some time ago, but it was not really used that much. I hope it will get to be used more now :3
Dont be afrightened by the code, just set the NPC entry and the stats you want it to have at the top of the SQL.
(change the 190010 to your NPC entry and the other values to the stats you want)
You can use 0 if you do not want any mana for example.
So just copy it, modify it and execute it to your database
-- Instructions: -- Set the NPC Entry and stats you want it to have below. SET @NPC_ENTRY := 190020, -- This is your NPC's Entry @NPC_HEALTH := 1, -- This is the health value you want your NPC to have. @NPC_MANA := 0, -- This is the mana value you want your NPC to have. @NPC_ARMOR := 0; -- This is the armor value you want your NPC to have. -- DO NOT CHANGE ANYTHING BELOW, UNLESS YOU KNOW WHAT YOU ARE DOING. -- Getting NPC datas: SET @NPC_CLASS := (SELECT `unit_class` FROM creature_template WHERE Entry = @NPC_ENTRY), @NPC_LEVEL := ROUND(((SELECT `minlevel` FROM creature_template WHERE Entry = @NPC_ENTRY)+(SELECT `maxlevel` FROM creature_template WHERE Entry = @NPC_ENTRY))/2, 0), @EXP := (SELECT `exp` FROM creature_template WHERE Entry = @NPC_ENTRY); -- Getting base HP from a HP column defined by exp. SET @GET_HP_COL := (SELECT CASE @EXP WHEN 0 THEN (SELECT basehp0 FROM creature_classlevelstats WHERE `level` = @NPC_LEVEL and `class` = @NPC_CLASS) WHEN 1 THEN (SELECT basehp1 FROM creature_classlevelstats WHERE `level` = @NPC_LEVEL and `class` = @NPC_CLASS) WHEN 2 THEN (SELECT basehp2 FROM creature_classlevelstats WHERE `level` = @NPC_LEVEL and `class` = @NPC_CLASS) END), -- Getting base mana @GET_MA_COL := (SELECT basemana FROM creature_classlevelstats WHERE `level` = @NPC_LEVEL and `class` = @NPC_CLASS), -- Getting base armor @GET_AR_COL := (SELECT basearmor FROM creature_classlevelstats WHERE `level` = @NPC_LEVEL and `class` = @NPC_CLASS); -- Running the update with all the data collected: UPDATE creature_template SET Health_mod = (@NPC_HEALTH/@GET_HP_COL), Mana_mod = (@NPC_MANA/@GET_MA_COL), Armor_mod = (@NPC_ARMOR/@GET_AR_COL) WHERE Entry = @NPC_ENTRY;
Now restart and enjoy :3
Need more help?