SQL 6xx Control point & SmartAI

dokuro

Veteran Member
Verified Member
31
2020
8
Location
Paris
Imgur: The magic of the Internet


Checkpoint

In order to fix (to my sauce) the quest The fortifications of the Hellfire I came up with the idea of a simple & generic script that could be used everywhere. It could for example be used to control a crossing point, a resource or why not a city.
In short what to bring a bit of strategy and push pvp, basically it is the battlefield "the valley of Alterac" wherever you want ^^

The principle is simple: a flag for the alliance and one for the horde. Each with an opening time of 5s and a recharge time of 30s

When a side takes the flag its effect will be to spawn the guards of its side at the trigger location (15000161) and to despawn the opposing guards within a certain radius (@rayon), hence the strategic importance of this flag in the control of a place. These guards will remain active until their death or the revival of the server, once dead they do not respawn unless a player reactivates a flag.

So that two opposing players do not spend their time clicking on these flags during a duel, they have a cooldown (@GOBRECHARGE).
When launching the server when no one has yet activated one of these flags, neutral guards will be spawn in place of the Alliance or Horde guards (@GARDENEUTRE).
A credit can be returned to the player who activates the flag by the parameter @ CREDITA2 / @ CREDITH2 next are camp.


The script :


#--- Non-spawn mobs only used for quest credit
REPLACE INTO `creature_template` (`entry`, `difficulty_entry_1`, `difficulty_entry_2`, `difficulty_entry_3`, `KillCredit1`, `KillCredit2`, `modelid1`, `modelid2`, `modelid3`, `modelid4`, `name`, `femaleName`, `subname`, `IconName`, `gossip_menu_id`, `minlevel`, `maxlevel`, `exp`, `exp_unk`, `faction`, `npcflag`, `speed_walk`, `speed_run`, `scale`, `rank`, `dmgschool`, `BaseAttackTime`, `RangeAttackTime`, `BaseVariance`, `RangeVariance`, `unit_class`, `unit_flags`, `unit_flags2`, `dynamicflags`, `family`, `trainer_type`, `trainer_class`, `trainer_race`, `type`, `type_flags`, `type_flags2`, `lootid`, `pickpocketloot`, `skinloot`, `resistance1`, `resistance2`, `resistance3`, `resistance4`, `resistance5`, `resistance6`, `spell1`, `spell2`, `spell3`, `spell4`, `spell5`, `spell6`, `spell7`, `spell8`, `VehicleId`, `mingold`, `maxgold`, `AIName`, `MovementType`, `InhabitType`, `HoverHeight`, `HealthModifier`, `HealthModifierExtra`, `ManaModifier`, `ManaModifierExtra`, `ArmorModifier`, `DamageModifier`, `ExperienceModifier`, `RacialLeader`, `movementId`, `RegenHealth`, `mechanic_immune_mask`, `flags_extra`, `ScriptName`, `VerifiedBuild`) VALUES
(15000249, 0, 0, 0, 0, 0, 29352, 0, 0, 0, "Desert des ossements : Credit tour A2", "", "Les esprits d'Auchindoun 11505 a2 - 11506 h2", '', 0, 1, 1, 0, 0, 35, 0, 1, 1.1428600549698, 1, 0, 0, 2000, 2000, 1, 1, 1, 6, 2048, 0, 0, 0, 0, 0, 10, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 'SmartAI', 0, 4, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 1, 0, 128, '', 20173);
REPLACE INTO `creature_template` (`entry`, `difficulty_entry_1`, `difficulty_entry_2`, `difficulty_entry_3`, `KillCredit1`, `KillCredit2`, `modelid1`, `modelid2`, `modelid3`, `modelid4`, `name`, `femaleName`, `subname`, `IconName`, `gossip_menu_id`, `minlevel`, `maxlevel`, `exp`, `exp_unk`, `faction`, `npcflag`, `speed_walk`, `speed_run`, `scale`, `rank`, `dmgschool`, `BaseAttackTime`, `RangeAttackTime`, `BaseVariance`, `RangeVariance`, `unit_class`, `unit_flags`, `unit_flags2`, `dynamicflags`, `family`, `trainer_type`, `trainer_class`, `trainer_race`, `type`, `type_flags`, `type_flags2`, `lootid`, `pickpocketloot`, `skinloot`, `resistance1`, `resistance2`, `resistance3`, `resistance4`, `resistance5`, `resistance6`, `spell1`, `spell2`, `spell3`, `spell4`, `spell5`, `spell6`, `spell7`, `spell8`, `VehicleId`, `mingold`, `maxgold`, `AIName`, `MovementType`, `InhabitType`, `HoverHeight`, `HealthModifier`, `HealthModifierExtra`, `ManaModifier`, `ManaModifierExtra`, `ArmorModifier`, `DamageModifier`, `ExperienceModifier`, `RacialLeader`, `movementId`, `RegenHealth`, `mechanic_immune_mask`, `flags_extra`, `ScriptName`, `VerifiedBuild`) VALUES
(15000250, 0, 0, 0, 0, 0, 29352, 0, 0, 0, "Desert des ossements : Credit tour H2", "", "Les esprits d'Auchindoun 11505 a2 - 11506 h2", '', 0, 1, 1, 0, 0, 35, 0, 1, 1.1428600549698, 1, 0, 0, 2000, 2000, 1, 1, 1, 6, 2048, 0, 0, 0, 0, 0, 10, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 'SmartAI', 0, 4, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 1, 0, 128, '', 20173);

### ------------------------------------------------------------------Control point flag
SET @DRAPEAUA2 := 15000111; # Gob drapeau Alliance
SET @DRAPEAUH2 := 15000112; # Gob drapeau horde
SET @DISPLAYA2 := 8623; # Apparence bannière A2 - 8623
SET @DISPLAYH2 := 8621; # Apparence bannière H2 - 8621
SET @GARDEA2 := 18999; # ID garde si controlé par l'alliance
SET @GARDEH2 := 18973; # ID garde si controlé par la horde
SET @GARDENEUTRE := 21661; # ID monstre a l'init (lancement serveur)
SET @GOBRECHARGE := 30000; # 5mn = 300000
SET @RAYON := 50; # Rayon de spawn/despawn garde sur trigger 15000079
SET @CREDITA2 := 15000249; # Credit pour quete
SET @CREDITH2 := 15000250; # Credit pour quete
SET @TRIGGERSPAWN := 15000161; # point de spawn des gardes

#--- Alliance
REPLACE INTO `gameobject_template` (`entry`, `type`, `displayId`, `name`, `IconName`, `castBarCaption`, `unk1`, `faction`, `flags`, `size`, `Data0`, `Data1`, `Data2`, `Data3`, `Data4`, `Data5`, `Data6`, `Data7`, `Data8`, `Data9`, `Data10`, `Data11`, `Data12`, `Data13`, `Data14`, `Data15`, `Data16`, `Data17`, `Data18`, `Data19`, `Data20`, `Data21`, `Data22`, `Data23`, `Data24`, `Data25`, `Data26`, `Data27`, `Data28`, `Data29`, `Data30`, `Data31`, `Data32`, `unkInt32`, `AIName`, `ScriptName`, `VerifiedBuild`) VALUES
(@DRAPEAUA2, 10, @DISPLAYA2, 'Banniere Alliance', 'Attack', '', '', 11, 0, 1.5, 1949, 0, 0 , @GOBRECHARGE, 1, 0, 10000, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 'SmartGameObjectAI', '', -18019);
-- Banniere Alliance SAI
UPDATE `gameobject_template` SET `AIName`="SmartGameObjectAI" WHERE `entry`=@DRAPEAUA2;
DELETE FROM `smart_scripts` WHERE `entryorguid`=@DRAPEAUA2 AND `source_type`=1;
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
(@DRAPEAUA2,1,10,11,70,0,100,0,2,0,0,0,33,@CREDITA2,0,0,0,0,0,7,0,0,0,0,0,0,0," credit A2"),
(@DRAPEAUA2,1,11,0,61,0,100,0,0,0,0,0,72,0,0,0,0,0,0,7,0,0,0,0,0,0,0,"fermer gossip"),
(@DRAPEAUA2,1,15,20,70,0,100,0,2,0,0,0,41,500,0,0,0,0,0,9,@GARDEA2,0,@RAYON,0,0,0,0," despawn A2 Doublon"),
(@DRAPEAUA2,1,20,25,61,0,100,0,0,0,0,0,12,@GARDEA2 ,8,0,0,0,0,9,@TRIGGERSPAWN,0,@RAYON,0,0,0,0," spawn A2"),
(@DRAPEAUA2,1,25,26,61,0,100,0,0,0,0,0,41,500,0,0,0,0,0,9,@GARDEH2,0,@RAYON,0,0,0,0," despawn H2"),
(@DRAPEAUA2,1,26,27,61,0,100,0,0,0,0,0,41,500,0,0,0,0,0,9,@GARDENEUTRE,0,@RAYON,0,0,0,0," despawn Neutre"),
(@DRAPEAUA2,1,27,0,61,0,100,0,0,0,0,0,72,0,0,0,0,0,0,7,0,0,0,0,0,0,0,"fermer gossip"),
(@DRAPEAUA2,1,30,0,60,0,100,1,0,0,2000,2000,12,@GARDENEUTRE,7,0,0,0,0,9,@TRIGGERSPAWN,0,@RAYON,0,0,0,0," INIT spawn NEUTRE"),# only on 1 flat
(@DRAPEAUA2,1,50,0,60,0,100,0,0,0,3000,3000,19,15,0,0,0,0,0,9,@GARDEA2,0,@RAYON,0,0,0,0,"Anti bug unit_flag_15 A2"),
(@DRAPEAUA2,1,55,0,60,0,100,0,0,0,3000,3000,19,15,0,0,0,0,0,9,@GARDEH2,0,@RAYON,0,0,0,0,"Anti bug unit_flag_15 H2"),
(@DRAPEAUA2,1,60,0,60,0,100,0,0,0,3000,3000,19,15,0,0,0,0,0,9,@GARDENEUTRE,0,@RAYON,0,0,0,0,"Anti bug unit_flag_15 Neutre");

#--- Horde
REPLACE INTO `gameobject_template` (`entry`, `type`, `displayId`, `name`, `IconName`, `castBarCaption`, `unk1`, `faction`, `flags`, `size`, `Data0`, `Data1`, `Data2`, `Data3`, `Data4`, `Data5`, `Data6`, `Data7`, `Data8`, `Data9`, `Data10`, `Data11`, `Data12`, `Data13`, `Data14`, `Data15`, `Data16`, `Data17`, `Data18`, `Data19`, `Data20`, `Data21`, `Data22`, `Data23`, `Data24`, `Data25`, `Data26`, `Data27`, `Data28`, `Data29`, `Data30`, `Data31`, `Data32`, `unkInt32`, `AIName`, `ScriptName`, `VerifiedBuild`) VALUES
(@DRAPEAUH2, 10, @DISPLAYH2, 'Banniere Horde', 'Attack', '', '', 85, 0, 1.7999999523163, 1949, 0, 0 , @GOBRECHARGE, 1, 0, 10000, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 'SmartGameObjectAI', '', -18019);
-- Banniere Horde SAI
UPDATE `gameobject_template` SET `AIName`="SmartGameObjectAI" WHERE `entry`=@DRAPEAUH2;
DELETE FROM `smart_scripts` WHERE `entryorguid`=@DRAPEAUH2 AND `source_type`=1;
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
(@DRAPEAUH2,1,10,11,70,0,100,0,2,0,0,0,33,@CREDITH2,0,0,0,0,0,7,0,0,0,0,0,0,0," credit H2"),
(@DRAPEAUH2,1,11,0,61,0,100,0,0,0,0,0,72,0,0,0,0,0,0,7,0,0,0,0,0,0,0,"fermer gossip"),
(@DRAPEAUH2,1,15,20,70,0,100,0,2,0,0,0,41,500,0,0,0,0,0,9,@GARDEH2,0,@RAYON,0,0,0,0," despawn H2 Doublon"),
(@DRAPEAUH2,1,20,25,61,0,100,0,0,0,0,0,12,@GARDEH2 ,8,0,0,0,0,9,@TRIGGERSPAWN,0,@RAYON,0,0,0,0," spawn H2"),
(@DRAPEAUH2,1,25,26,61,0,100,0,0,0,0,0,41,500,0,0,0,0,0,9,@GARDEA2,0,@RAYON,0,0,0,0," despawn A2"),
(@DRAPEAUH2,1,26,27,61,0,100,0,0,0,0,0,41,500,0,0,0,0,0,9,@GARDENEUTRE,0,@RAYON,0,0,0,0," despawn Neutre"),
(@DRAPEAUH2,1,27,0,61,0,100,0,0,0,0,0,72,0,0,0,0,0,0,7,0,0,0,0,0,0,0,"fermer gossip");

After placing these flags, you will only have to place triggers (15000161) all around which will serve as a spawn point for the guards.

Voila, the script is very simple but by adapting it it can bring another dimension to the game =)

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