Jump to content

[DatabaseScript] HowTo set KillCredit for quest progression


Corsol

Recommended Posts

Hi! Today i will explain my solution for quests that needs a special "Kill Credit" progression.

This kill credit basically is a creature named "Spell Practice Credit" (creature_template.entry = 44175) that is required from quests (tipically set in column "ReqCreatureOrGOId1").

To explain how i've solved that problem (and other similar, i think) let's do an example.

The Problem:

Quest "Charge" require that you learn the "Charge" spell and use it onto 2 target.

The Solution

After a short search inside the Database you can see that the column "ReqCreatureOrGOId1" contains the 44175 value. To achieve the "Kill Credit" for quest you need to identify the creature indicated into quest's details (Bloodfang Worgen in that case) and create a script for that creature. To ensure the identity (creature_template.entry value) of correct creature you can play game and get information with command ".npc info" on right creature.

For our quest the creature entry is 35118.

Now we have to create a new row inside the Database into "creature_ai_scripts" table like this:

INSERT INTO mangos.creature_ai_scripts 
(id, creature_id, event_type, event_inverse_phase_mask, event_chance, event_flags, event_param1, event_param2, event_param3, event_param4, action1_type, action1_param1, action1_param2, action1_param3, action2_type, action2_param1, action2_param2, action2_param3, action3_type, action3_param1, action3_param2, action3_param3, comment) VALUES 
(3511801, 35118, 8, 0, 100, 0, 100, -1, 0, 0, 33, 44175, 6, 0, 0, 0, 0, 0, 0, 0, 0, 0, 'Bloodfang Worgen - Cast quest credit on Charge SpellHit (Quest: 14266)');

Let's look on fields values and meaning (info got also from MangosZero-docs.pdf):

  • id: The unique identifier for the AI script entry. To ease development, it has been defined that the identifier always equals creature_template.entry*100. In our case 3511801 .
  • creature_id: The creature entry value. In our case 35118
  • event_type*: The event type that estabilish the action to do. Value 8 mean "Spell Hit". So when creature is hit from "Charge" spell will give the Kill Credit.
  • event_param1: As required from the event_type = 8 this column must contain the spell id. In our case 100 is the id of "Charge" spell.
  • action1_type: This column contain the action that the event specified before had to do. In our case 33 mean "ACTION_T_KILLED_MONSTER", the action that can do the Kill Credit.
  • action1_param1: This column contain the creature entry to be killed. In our case the 44175 value for "Spell Practice Credit".
  • action1_param2*: This column contain the target of Kill Credit. In our case the 6 value mean "TARGET_T_ACTION_INVOKER", the unit who caused this event to occur, in other word the player.

* Note: i've founded more complete information about Evente_type and action_type on EventAI.txt file iside \server\doc folder into "server" repository.

And modify the creature_template table to set the event script for Bloodfag Worgen:

UPDATE `creature_template` SET `AIName`='EventAI' WHERE `entry`='35118';

Now our quest is working and the kill credit works.

NOTE: take care that the creature entry into creature_template table has always only one column between AIName and ScriptName valorized! If both are setted can do an unexpected behaviour (in many case ScriptName win against AIName).

The basic logic for that kind of quest progression is that the creature target of quest must have the event to give the kill credit to player because the creature target isn't the required creature into the quest_template table.

Hope this can help, and if ther's something not well explained tell me!!!! :)

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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