Conversation
|
Though I like this for many reasons, and so far, it's a great implementation to start with, AIGroup is more than a script type registered as a CreatureAI factory. It's an entity, with its own object type, its own ObjectGuid and its own mirror class, like any other spawnable entity (Unit, GameObject, AreaTrigger...). Units carry their own spawnGroupID, tied to spawn events and trigger action sets. To stay close to retail this should be a standalone class that is spawnable and can control several entities at once. |
|
I know. Not sure if I have enough experience to implement it this way. As I said, it's something in between AIGroup and SAI. Also I want to keep this PR relatively small to make it reviewable. Also right now I have no idea how to implement some basic things and how to script some already existing scripts with this system. If I will not resolve these problems, quite possible it will be abandoned and if so, I prefer to abandon it without investing months on it |
|
Random action sets are now implemented. The problem is I don't know how exactly they should be started. Currently they are started using same method and same container as regular action sets, meaning in order to make random action set run inside a big action set, priority of random action set should be greater than priority of main action set. Otherwise action set will be started only when main action set is finished. I think random action sets are used for every boss with random on death and on kill emotes. Otherwise I can't imagine how that is scripted, I don't see the other way. For each random text with sound we need to add sound and text actions to one set, then add that set to random set. After 3.3.0 it is way much easier - we just need broadcast texts, add them to single npc_text, then call random say\yell with that npc_text as action param. There are actions Perform actionset and Push Actionset. I believe Perform actionset is the oldest method, it allows to run action set inside action set that was also called by action triggers, using same method. But there is also Push Actionset action, what it does is unknown. --
UPDATE `creature_template` SET `AIName` = 'AIGroup', `TriggersId` = 12900 WHERE `entry` = 129;
DELETE FROM `action_triggers_name` WHERE `Id` IN (12900);
INSERT INTO `action_triggers_name` (`Id`,`Name`) VALUES
(12900,"Angry Programmer Tweedle Dum - Test");
DELETE FROM `action_triggers` WHERE `Id` IN (12900);
INSERT INTO `action_triggers` (`Id`,`Index`,`Chance`,`Flags`,`CombatCondition`,`TriggerId`,`TriggerParam1`,`TriggerParam2`,`ActionSetId`,`RepeatMin`,`RepeatMax`,`Comment`) VALUES
(12900,0,100,0,-1,10,0,0,105,0,0,"Angry Programmer Tweedle Dum - OnSpawn");
DELETE FROM `action_set_name` WHERE `Id` IN (100,101,102,103,104,105);
INSERT INTO `action_set_name` (`Id`,`Flags`,`Priority`,`Name`) VALUES
(100,2,1,"Angry Programmer Tweedle Dum - Id 1 - Low Priority"),
(101,2,1,"Angry Programmer Tweedle Dum - Id 2 - Low Priority"),
(102,2,1,"Angry Programmer Tweedle Dum - Id 3 - Low Priority"),
(103,2,1,"Angry Programmer Tweedle Dum - Id 4 - Low Priority"),
(104,2,1,"Angry Programmer Tweedle Dum - Id 5 - Low Priority"),
(105,2,5,"Angry Programmer Tweedle Dum - Id 6 - Medium Priority");
DELETE FROM `action_set` WHERE `Id` IN (100,101,102,103,104,105);
INSERT INTO `action_set` (`Id`,`Index`,`Type`,`Unit`,`Point`,`Path`,`TimeA`,`MoveSpeed`,`StringId`,`TimeB`,`LinearPath`,`CircularPath`,`FlightPath`,`Extra0`,`Extra1`,`Extra2`,`Extra3`,`Extra4`,`TargetType`,`TargetParam1`,`TargetParam2`,`TargetParam3`,`TargetParam4`,`Comment`) VALUES
(100,0,16,1,0,0,0,0,'',0,0,0,0,0,0,34703,0,0,0,0,0,0,0,"Unit(s) cast a spell"),
(101,0,16,1,0,0,0,0,'',0,0,0,0,0,0,34704,0,0,0,0,0,0,0,"Unit(s) cast a spell"),
(102,0,16,1,0,0,0,0,'',0,0,0,0,0,0,34705,0,0,0,0,0,0,0,"Unit(s) cast a spell"),
(103,0,16,1,0,0,0,0,'',0,0,0,0,0,0,34707,0,0,0,0,0,0,0,"Unit(s) cast a spell"),
(104,0,16,1,0,0,0,0,'',0,0,0,0,0,0,34710,0,0,0,0,0,0,0,"Unit(s) cast a spell"),
(105,0,1,0,0,0,5000,0,'',0,0,0,0,0,0,0,0,0,0,0,0,0,0,"Idle"),
(105,1,124,0,0,0,0,0,'',0,0,0,0,0,0,1,0,0,0,0,0,0,0,"Perform a random set of actions"),
(105,2,1,0,0,0,5000,0,'',0,0,0,0,0,0,0,0,0,0,0,0,0,0,"Idle");
DELETE FROM `random_action_set` WHERE `Id` IN (1);
INSERT INTO `random_action_set` (`Id`,`Index`,`Probability`,`ActionSetId`) VALUES
(1,0,1,100),
(1,1,1,101),
(1,2,1,102),
(1,3,1,103),
(1,4,1,104); |
Changes proposed:
This is initial support for AIGroup. Credit for providing a lot of info goes to xvwyh, he is also the author of PerformEmote function.
Why not SAI? SAI and any other existing DB or C++ scripting system is not how this game was created, AIGroup is. It was used since Alpha to current days. I'm in doubts that SAI can be updated step-by-step to behave like AIGroup. Scripts cannot be converted from SAI to AIGroup using a tool, like it was with EAI to SAI conversion.
However my AIGroup is partially based on SAI because of my poor C++ knowledge. This is not and this will be not a 100% copy of Blizz's AIGroup since our scripting engine is different, it simply doesn't allow to use it the way Blizz uses it, we also simply don't have systems to support AIGroup the way it is handled in retail. It is named AIGroup for a reason. Blizz scripts groups of creatures. And currently we don't have correct spawn groups implementation.
When I said it will be not a 100% copy, I meant that we simply don't want to use it the way Blizz does. AIGroup is quite tricky. It has its own limitations. For example actions without StringId autotargets invoker of action set and that cannot be changed. I plan to use it the same way but keep the possibility to use old target types as fallback option. We simply don't have enough data to use it the way Blizz uses it, for example we don't have all serverside spells and in majority of cases we don't know how existing ones are used. So, let's say it's something between SAI and AIGroup. Also I'm aware that in master spells can start action sets, also AIGroup is defined as object and in sniffs we can see packets with AIGroup. Not sure if current implementation can use any of it, probably not or not in all cases.
Comparing to SAI, there are a lot of fundamental changes:
I have to aware you that I used a lot of AI since I'm not good at C++. Well, implementation of some things can be changed.
Right now I don't know where this will lead us, will it be used or not. This system is incomplete and a lot of things are missing before it can be used. Right now it can contain everything, crashes, memory leaks, some things may be too expensive, many things are missing and also there are bugs I'm aware of and there are bugs I will need to discover. Some things may be sloppy. Some things are temporary. Also I constantly change implementation of some things because I don't have some kind of roadmap in my head, only understandings how this thing should be handled in general and how some parts of it should be handled.
Some basic testing examples I used.
I managed to script this escort. As you can see, we no longer use creature_text. Prior to 3.3.0 emotes and sounds linked to texts were handled manually using scripts. In 3.3.0 and later patches emotes and sounds are handled in broadcast_text. We can argue what is better but for my experience creature_text is pain in many cases. For example when you need to script creature with tens texts and each has its own sound and emote. However the way it is done on retail prior to 3.3.0 is not great too in specific cases. Any way, I think this particular case looks much better without creature_text.
This script is two times bigger than SAI script because we handle emotes inside script and because of Idle action. But now we have just one action set instead of multiple. Also we have now one base script with one event.
Unfortunately sometimes creature doesn't play Talk emote, I tried with SAI and it looks almost the same. Maybe better.
Issues addressed:
none
Tests performed:
in progress