The tutorial of the day will cover an escort quest, example: the quest "Get me out of there! 25332".
Simple quest where Kristoff Manheim, prisoner of the slum ogres, asks us to help him escape from this cave.
The principle is simple, a `waypoint` to define the path it will follow and a small script in SmartAI to manage all this. , smartai does not manage waypoint_data but only waypoint.
waypoint: Originally it is impossible to create a waypoint in the game because it has no command, however you can create a waypoint_data with the command .wp add ID. Of course the ID must not exist in these 2 tables, it is then enough to convert the waypoint_data lines into waypoint.
The SmartAi script: in 3 lines
EVENT_ACCEPTED_QUEST (19) -> ACTION_WP_START (53): If we take the quest 25332 then the NPC (TARGET_SELF) starts to follow the waypoint
EVENT_WAYPOINT_REACHED (40) -> ACTION_CALL_KILLEDMONSTER (33): if the player reaches a certain stage of the waypoint, then the player (TARGET_ACTION_INVOKER) receives the quest credit, credit which can be found thanks to Keira2.
EVENT_DEATH (6) -> ACTION_FAIL_QUEST (6): if the PNJ dies then the quest has failed, you will then have to abandon it, wait for the PNJ respawn and take it back.
To note for the 1st line which launches the waypoint, it is possible to define the despawn of the pnj at the end of the course, to make it run and also its passive, defensive or aggressive attitude.
It would also have been possible to add actions such as changing the running mode, making it pause or speak, etc., for that it would have been enough to add lines detecting that a stage x was reached thanks to EVENT_WAYPOINT_REACHED (40)
-- Kristoff Manheim SAI
SET @ENTRY := 39640;
UPDATE `creature_template` SET `AIName`="SmartAI" WHERE `entry`[email protected];
DELETE FROM `smart_scripts` WHERE `entryorguid`[email protected] AND `source_type`=0;
INSERT INTO `smart_scripts` (`entryorguid`,`source_type`,`id`,`link`,`event_type`,`event_phase_mask`,`event_chance`,`event_flags`,`event_param1`,`event_param2`,`event_param3`,`event_param4`,`action_type`,`action_param1`,`action_param2`,`action_param3`,`action_param4`,`action_param5`,`action_param6`,`target_type`,`target_param1`,`target_param2`,`target_param3`,`target_x`,`target_y`,`target_z`,`target_o`,`comment`) VALUES
(@ENTRY,0,0,0,19,0,100,0,25332,0,0,0,53,0,11043846,0,0,5000,1,1,0,0,0,0,0,0,0,"Quete 25332 - start WP"),
(@ENTRY,0,10,0,40,0,100,0,20,11043846,0,0,33,39808,0,0,0,0,0,7,0,0,0,0,0,0,0,"Quete 25332 - Credit"),
(@ENTRY,0,15,0,6,0,100,0,0,0,0,0,6,25332,0,0,0,0,0,7,0,0,0,0,0,0,0,"Quete 25332 - echec quete ");
Here, a tutorial that I wanted very simple, hence the minimum of lines and actions. Good game to you