Jump to content
Sign in to follow this  
DPCoder

Make An Npc Chat On Aggro Or Health Percent

Recommended Posts

How to make an npc chat on aggro or health percentage

In this tutorial I will show you how to make an npc chat when attacked. First of all you will need to create an npc. If you need help with this then you can follow the following guide. https://www.lordcraft.net/index.php/topic/3599-creating-a-npc-in-heidisql/

Once you have created the npc then you will need to go to creature_text table of your world database. Go to data view and then you will need to add a new entry by clicking on the AddData_zpsa7412600.jpg

Now let us take a look at the fields that are required to create and allow your npc to say something when aggro’d.

Stucture_zps2xhx2hv3.jpg

Entry:- This is the id of the npc that you created.

GroupId:- For the first entry set this to 0 should you want to set the creature to have more than one text to say then the next one would be set to 1

ID:- Set this to 0

Text:- This is the text message that you want the creature to say.

Type:- Set this to one of the following

type_zpsezplxflv.jpg

Language:- Set this to 0 so all can understand

Probability:- Set this to 100

Emote:- Set this to 0

Duration:- Set this to 0

Sound: Set this to 0

Comment:- Set this to something like “Npc Nmae – Chat”

Save the new entry that you have made. You have now set up the chat section for the npc to talk.

Part 2 – Setting up the smart_script

Now we are going to run through the smart_script, so let us have a look at the structure.

SmartScripts%20Table_zpsxx1dmhcy.jpg

Entyorguid:- This is the id for the creature that you created

Source_type:- Set this to 0

Id:- Set this to 0

Link:- Set this to 0

Event_type:- Set this to 4

Event_phase_mask:- Set this to 0

Event_chance:- Set this to 100

Event _flag:- Set this to 0

Event_param1:- Set this to 0

Event_param2:- Set this to 0

Event_param3:- Set this to 0

Event_param4:- Set this to 0

Action_type:- Set this to 1

Action_param1:- Set this to 0

Action_param2:- Set this to 0

Action_param3:- Set this to 0

Action _param4:- Set this to 0

Action_param5:- Set this to 0

Action_param6:- Set this to 0

Target_type:- Set this to 1

Target_param1:- Set this to 0

Target_param2:- Set this to 0

Target_param3:- Set this to 0

Target_x:- Set this to 0

Target_y:- Set this to 0

Target_z:- Set this to 0

Target_o:- Set this to 0

Comment:- Add a comment so you can find the script.

Save the new entry. You have now setup the script to make the creature talk when aggro’d.

Remember that you will have to restart your server for the creature, creature_text and the smart_script to take effect.

Should you want to set the chat at Health %
Should you wish to have the npc say the text at a health percentage then you would go about things in the same manner, however you would change the data in the following fields.

Event_type:- Set this to 2

Event_flag:- Set this to 1

Then you would have to set up the event parameters

Event_param1:- This is the Health Minimum. For the case of this tutorial I will set this to 45

Event_param2:- This is the Health Maximum. For the case of this tutorial I will set this to 55.

Event_param3:- Now you have to repeat the health minimum in this field.

Event_param4:- Now you have to repeat the health maximum in this field.

With these parameters set the npc will now say your text when its health is between 45 and 55 %.

Share this post


Link to post
Share on other sites

Wonderful tutorial! ^.^ Thanks for sharing. <3

Thank you @Valtorei, Hopefully will have the next tutorial finished and put up tomorrow. Next one should be on how to make a npc spawn a go object (like a chest) on death of the npc

Share this post


Link to post
Share on other sites

Thank you.

 

Could you make a tutorial for adding more then one script in Trinity Core 3.3.5? DPCoder

Every time when I try to add 2 scripts it's giving me lots of errors.

It's fine when I add 1 script.

Thank you @Unrecognized, sure I will try and put something together. How ever I prefer to add 1 script at a time. It might take longer but it saves on to many errors coming back.

Also if you add 1 script at a time then you can link the error to that script, adding multiply scripts you may receive an error(s) and then have to go through both scripts.

Patch .diffs can be really annoying and I find the best way to add these is manually.

Share this post


Link to post
Share on other sites

Thank you @Unrecognized, sure I will try and put something together. How ever I prefer to add 1 script at a time. It might take longer but it saves on to many errors coming back.

Also if you add 1 script at a time then you can link the error to that script, adding multiply scripts you may receive an error(s) and then have to go through both scripts.

Patch .diffs can be really annoying and I find the best way to add these is manually.

 

I will try it whenever I'll start with Trinity Core again :) Thanks.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this  

  • Recently Browsing   0 members

    No registered users viewing this page.

×