SQL 6xx Example of custom & SmartAI vehicle

dokuro

Veteran Member
Verified Member
31
2020
8
Location
Paris
A vehicle like a Joug tank is nothing else basic than a MOB, not to be confused with a mount invoked.
Generally in passive it is possible to assign it just like for a classic MOB an AI thanks to SmartAI. For example :

Follow a waitpoint_data and thus make it a means of transport like griffins.
Despawn the vehicle when leaving it (this so as not to find the vehicles anywhere).


The example below is fairly self-explanatory and can therefore be copied and pasted. In order to make this script compatible with any version, I based it on UPDATE rather than REPLACE. The mob must therefore exist, at worst made a copy of an already existing one.

SET @ENTRY := 40791 ;
SET @Name := "Dirigeable";
SET @IconName := "vehichleCursor"; # Directions , Gunner , vehichleCursor , Driver , Attack , Buy , Speak , Pickup , Interact , Trainer , Taxi , Repair , LootAll , Quest , PVP
SET @modelid1 := 31757 ;
SET @subname :="" ;
SET @level := 45;
SET @speed := 2.5;
SET @faction := 35; # neutre 35 - Alliance 11 - Horde 85
SET @Vehicleid := 292 ; # Determine ou apparait le joueur : default/debout 224 | cheval 156 | invisible 292 | canon 972 | armoire 212

# pas dinterface 0 - Dirigeable/debout 219 | Assis 615 - avance/recule en ligne droite 292 - 164 inertie char - en dessous 527
# player invisible 292 - voler ?! 508 - mamouth 312/72 - cheval 62 - ours 53 - griffon 44 - ours53 - avion 44



SET @movementId := 0 ;
SET @AIName := "SmartAI";
SET @InhabitType := 4; # 1 terre - 2 mer - 4 air
SET @HoverHeight :=1 ; # 1 voler temporairement - Peut provoquer des tremblement avec des waypoint_data
SET @taille := 0.75 ;
SET @classe := 2; # WARRIOR (1) - PALADIN (2) - ROGUE (4) - MAGE(8)
SET @unit_flags := 16908290;
SET @unit_flags2 :=2112; # Defaut 2048 - mouvement forcé = 2112
SET @npcflag := 50331648;
SET @type_flags := 0;
SET @type_flags2 := 0;
SET @dynamicflags :=0;
SET @type := 1 ; # Bete (1) - Mecanique (9) - Totem (11) - Humanoid (7) - Dragon (2) - Not specified (10) - elementaire (4)
SET @spell1 := 0;
SET @spell2 := 0 ; # Belier 62376 - Roquete 43769
SET @spell3 := 0 ;
SET @spell4 := 0 ;
SET @spell5 := 0 ;
SET @spell6 := 0 ;
SET @`flagsextra` = 0 ;
SET @RegenHealth := 1;
SET @HealthModifier :=1;
SET @ManaModifier :=1;
SET @ArmorModifier :=1;
SET @DamageModifier :=1;
SET @mechanic_immune_mask := 344407931;

UPDATE `world`.`creature_template` SET `modelid1`=@modelid1,`modelid2`=0,`modelid3`=0,`modelid4`=0,`flags_extra` = @`flagsextra` WHERE `creature_template`.`entry` = @ENTRY ;
UPDATE `world`.`creature_template` SET `unit_flags2`=@unit_flags2,`exp`=0,`mechanic_immune_mask`=@mechanic_immune_mask, `IconName`=@IconName,`name` = @Name ,`subname`=@subname,`minlevel`=@level,`maxlevel`=@level,`speed_run`=@speed,`speed_walk`=@speed,`scale`=@taille,`unit_class`=@classe,`unit_flags`=@unit_flags,`npcflag`=@npcflag,`type_flags`=@type_flags,`type_flags2`=@type_flags2,`dynamicflags`=@dynamicflags,`type`=@type,`spell1`=@spell1 ,`spell2`=@spell2,`spell3`=@spell3,`spell4`=@spell4,`spell5`=@spell5,`spell6`=@spell6,`HoverHeight`=@HoverHeight,`InhabitType`=@InhabitType,`AIName`=@AIName,`movementId`=@movementId,`faction`=@faction,`Vehicleid`=@Vehicleid,`RegenHealth`=@RegenHealth,`HealthModifier`=@HealthModifier,`ManaModifier`=@ManaModifier,`ArmorModifier`=@ArmorModifier,`DamageModifier`=@DamageModifier WHERE `creature_template`.`entry` = @ENTRY ;
DELETE FROM `world`.`npc_spellclick_spells` WHERE `npc_spellclick_spells`.`npc_entry` = @ENTRY;
INSERT INTO `npc_spellclick_spells` (`npc_entry`, `spell_id`, `cast_flags`, `user_type`) VALUES (@ENTRY, 65030, 1, 1); # Pour pouvoir le conduire

REPLACE INTO `creature_template_addon` (`entry`, `path_id`, `mount`, `bytes1`, `bytes2`, `emote`, `auras`) VALUES (@ENTRY, 0, 0, 33554432, 1, 0, 43775); # Pour Voler , sinon rien

UPDATE `creature_template` SET `AIName`="SmartAI" WHERE `entry`=@ENTRY;
DELETE FROM `smart_scripts` WHERE `entryorguid`=@ENTRY 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,20,0,28,0,100,0,0,0,0,0,41,100,0,0,0,0,0,1,0,0,0,0,0,0,0,"despawn si plus de passager");



In the particular case where this vehicle should be used to fight, know that you will not gain XP with him since it is he who kills and that it is not your fart: p
Here this vehicle must be used in a quest to count a number of kill, you will need to transfer this information from the vehicle to the player with an additional SmartAI line

Credit to : Stitch from Aquayoup
 
Last edited by a moderator:
Top