Jump to content
  • 0
Sign in to follow this  
stefan100

mangos one How to add yell function to a NPC using DB or Script

Question

Hello guys :), as you see from my thread title,  I am here due I need your help.May anyone show me how to add yell function to any Boss or Mob and to spam it between 30 seconds, please.Example:
- King Magni Brozenheard yells: Test
30 seconds later

- King Magni Brozenheard yells: Test

Edited by stefan100

Share this post


Link to post
Share on other sites

3 answers to this question

Recommended Posts

  • 0

You have to find the script engine handling the mob at present, to do not break its special behaviour if any. There are 2 unconditionally built-in DB-based engines (DB scripts, EventAI) and two optional ones (SD3 and Eluna). Of the later, SD3 is highly recommended and is built by default also. We will check here all engine support but Eluna.

For this you need the mob entry (called sometimes creature id). You German localization complicates the task a bit. Here and below, SQL commands are the requests to the world DB.

SELECT * FROM creature_template WHERE `name` LIKE '%Magni%';

Apparently your mob has entry 2784. In this line check the `AIName` field. It is empty, so no EventAI supports the mob for now. Check for SD3 support:

SELECT * FROM script_binding WHERE `type`=0 AND `bind`=2784;
# here type 0 means a mob, then bind keeps its entry

No result means no SD3 script. Finally, check simple DB scripts:

SELECT * FROM db_scripts WHERE id=2784;

No result means no support again. Well, now you're free to create a new script.

But, on which engine? Of these 3 ones, EventAI looks the most suitable for your task. Open the docs page and find the corresponding activate condition under "event_type" and reaction under "action1_type". For your task, the activate condition is EVENT_T_TIMER_OOC (value 1) or EVENT_T_TIMER (value 0), or both (2 lines in the creature_ai_scripts), depending on what you wish to achieve. The reaction will be ACTION_T_SAY (value 1). It needs the text placed into creature_ai_texts table, so we begin here by finding the available id in that table:

SELECT MIN(entry) FROM creature_ai_texts;
# MIN because the entry field in this table takes negative values only!

Since getting -2001 as the result, we will use -2002 for id of the text to be added.

INSERT INTO creature_ai_texts SET `entry`=-2002,`content_default`='Text',`type`=1,`comment`='what is this about';
# type 1 is for yell; optionally fill also content_loc3 field for your deDE locale

Now setup the command itself. It is recommended to check for a free id:

SELECT * FROM creature_ai_scripts WHERE id IN (2784,27840,278400);
# a TC convention to use 100*mob_entry here, why not; this is optional step anyway

No responce means you're free to choose any of the ids above. Since you need a single EventAI command, 2784 will do, otherwise I'd choose 278400. Also, you could omit the `id` field from the request below to get a value from SQL server. This value will be needed mostly if you will be deleting the command later. However if you plan to share your fix, you must provide this id value directly.

INSERT INTO creature_ai_scripts SET
id=2784,creature_id=2784,
event_type=1,event_flags=1,event_param1=30000,event_param2=30000,event_param3=30000,event_param4=30000,
action1_type=1, action1_param1=-2002,`comment`='WHY am I doing this?';
# event_flags must be set to 1 allowing the event to repeat; event_chance will be set to 100% by default

Finally, explaint to the server that you've added an EventAI script to the mob:

UPDATE creature_template SET AIName='EventAI' WHERE entry=2784;

Now restart mangosd. TBH, I did not check this working, but there must be no issue.

P.S. Having issues with other EventAI commands? Well, welcome to the Mangos Docs world :) The most trusted information source is the source code itself. Here, in the enums at the beginning of the file, you can find the latest information on the events and reactions for EventAI engine.

P.P.S. If you find this EventAI too complicated and want solve the task with few lines of a LUA pseudocode instead, ask for Eluna engine.

Share this post


Link to post
Share on other sites
  • 0

I have one question, what about 

P.P.S. If you find this EventAI too complicated and want solve the task with few lines of a LUA pseudocode instead, ask for Eluna engine.

How is it possible?

Share this post


Link to post
Share on other sites
Sign in to follow this  

Contact Us

To contact us click here
You can also email us at [email protected]

Privacy Policy | Terms & Conditions

Repositories

The Link to the master list
of MaNGOS repositories:
Copyright © getMaNGOS. All rights Reserved.

This website is in no way associated with or endorsed by Blizzard Entertainment®
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue. Privacy Policy Terms of Use