New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Tips and tricks for gossip migration to SAI #2
Comments
Just as an example of what I tried starting on, but could not actually find how to change it in the .cpp: SELECT `entry`,`name`,`Subname`,`ScriptName`,`AIName` FROM `creature_template`
WHERE `ScriptName` = 'npc_death_knight_initiate';
SELECT * FROM `gossip_menu` WHERE `entry` = 9765;
SELECT * FROM `npc_text` WHERE `id` = 13433;
And then the text line from SELECT * FROM `gossip_menu_option` WHERE `option_text` = "I challenge you, death knight!";
The tool I am lacking at the moment, is to find out how to change #define GOSSIP_ACCEPT_DUEL "I challenge you, death knight!" into a DB reference in the script, but I start to worry that the actual solution could involve going all the way to transform the entire script |
Yeah, I figured I'd start with the taxi NPC's. It's a nice intro for me to learn conditions in any case. I'm not clear on the interaction between the C++ script and SAI (as a general case - are they exclusive?), but would probably need to do something along the lines of condition - INSERT INTO `conditions` (`SourceTypeOrReferenceId`,`SourceGroup`,`SourceEntry`,`SourceId`,`ElseGroup`,`ConditionTypeOrReference`,`ConditionTarget`,`ConditionValue1`,`ConditionValue2`,`ConditionValue3`,`NegativeCondition`,`ErrorTextId`,`ScriptName`,`Comment`) VALUES
+(15,9765,0,0,0,9,0,quest_id,0,0,0,0,'','Death Knight Initiate - Show gossip option 0 if player has taken quest ID quest_id'); but then not sure whether it's possible to make changes modularly or whether you'd have to then do everything via SAI. |
First run through and the sniffer didn't pick up the gossip menu for the Initiates. Gonna try again. I miss-understood originally and thought you were looking for multiple sniffs from the DK starting area. When you need specific sniffs for something else let me know. So I fought around 25 initiates and this is what the sniffer picked up. It did not pick up their gossip menu, so I don't know if that means they do it through C++ as well, or what. Hope this helps. INSERT INTO `creature_text` (`entry`, `groupid`, `id`, `text`, `type`, `language`, `probability`, `emote`, `duration`, `sound`, `BroadcastTextID`, `comment`) VALUES
(28406, x, x, 'The Crusade has been marked for death!', 12, 0, 100, 1, 0, 0, 0, 'Death Knight Initiate'),
(28406, x, x, 'You have challenged death itself!', 12, 0, 100, 397, 0, 0, 0, 'Death Knight Initiate to Player'),
(28406, x, x, 'The duel will begin in...', 42, 0, 100, 0, 0, 0, 0, 'Death Knight Initiate to Player'),
(28406, x, x, '3...', 42, 0, 100, 0, 0, 0, 0, 'Death Knight Initiate to Player'),
(28406, x, x, '2...', 42, 0, 100, 66, 0, 0, 0, 'Death Knight Initiate to Player'),
(28406, x, x, '1...', 42, 0, 100, 66, 0, 0, 0, 'Death Knight Initiate to Player'),
(28406, x, x, 'You''re going down!', 12, 0, 100, 397, 0, 0, 0, 'Death Knight Initiate to Player'),
(28406, x, x, '2...', 42, 0, 100, 0, 0, 0, 0, 'Death Knight Initiate to Player'),
(28406, x, x, '1...', 42, 0, 100, 0, 0, 0, 0, 'Death Knight Initiate to Player'),
(28406, x, x, 'Here come the tears...', 12, 0, 100, 397, 0, 0, 0, 'Death Knight Initiate to Player'),
(28406, x, x, '3...', 42, 0, 100, 1, 0, 0, 0, 'Death Knight Initiate to Player'),
(28406, x, x, '2...', 42, 0, 100, 397, 0, 0, 0, 'Death Knight Initiate to Player'),
(28406, x, x, 'Remember this day, $n, for it is the day that you will be thoroughly owned.', 12, 0, 100, 397, 0, 0, 0, 'Death Knight Initiate to Player'),
(28406, x, x, 'The duel will begin in...', 42, 0, 100, 20, 0, 0, 0, 'Death Knight Initiate to Player'),
(28406, x, x, '2...', 42, 0, 100, 6, 0, 0, 0, 'Death Knight Initiate to Player'),
(28406, x, x, 'The duel will begin in...', 42, 0, 100, 1, 0, 0, 0, 'Death Knight Initiate to Player'),
(28406, x, x, '3...', 42, 0, 100, 397, 0, 0, 0, 'Death Knight Initiate to Player'),
(28406, x, x, 'I''m going to tear your heart out, cupcake!', 12, 0, 100, 397, 0, 0, 0, 'Death Knight Initiate to Player'),
(28406, x, x, 'Here come the tears...', 12, 0, 100, 5, 0, 0, 0, 'Death Knight Initiate to Player'),
(28406, x, x, 'The duel will begin in...', 42, 0, 100, 66, 0, 0, 0, 'Death Knight Initiate to Player'),
(28406, x, x, '3...', 42, 0, 100, 66, 0, 0, 0, 'Death Knight Initiate to Player'),
(28406, x, x, '1...', 42, 0, 100, 397, 0, 0, 0, 'Death Knight Initiate to Player'),
(28406, x, x, '2...', 42, 0, 100, 20, 0, 0, 0, 'Death Knight Initiate to Player'),
(28406, x, x, '3...', 42, 0, 100, 274, 0, 0, 0, 'Death Knight Initiate to Player'),
(28406, x, x, '2...', 42, 0, 100, 274, 0, 0, 0, 'Death Knight Initiate to Player'),
(28406, x, x, 'At your beck and call, horseman!', 12, 0, 100, 274, 0, 0, 0, 'Death Knight Initiate'),
(28406, x, x, 'You have challenged death itself!', 12, 0, 100, 6, 0, 0, 0, 'Death Knight Initiate to Player'),
(28406, x, x, '3...', 42, 0, 100, 6, 0, 0, 0, 'Death Knight Initiate to Player'),
(28406, x, x, 'You''re going down!', 12, 0, 100, 20, 0, 0, 0, 'Death Knight Initiate to Player'),
(28406, x, x, '1...', 42, 0, 100, 274, 0, 0, 0, 'Death Knight Initiate to Player'),
(28406, x, x, 'Here come the tears...', 12, 0, 100, 1, 0, 0, 0, 'Death Knight Initiate to Player'),
(28406, x, x, '3...', 42, 0, 100, 20, 0, 0, 0, 'Death Knight Initiate to Player'),
(28406, x, x, '2...', 42, 0, 100, 1, 0, 0, 0, 'Death Knight Initiate to Player'),
(28406, x, x, '1...', 42, 0, 100, 1, 0, 0, 0, 'Death Knight Initiate to Player'),
(28406, x, x, 'Don''t make me laugh.', 12, 0, 100, 1, 0, 0, 0, 'Death Knight Initiate to Player'),
(28406, x, x, '1...', 42, 0, 100, 5, 0, 0, 0, 'Death Knight Initiate to Player'),
(28406, x, x, 'You''re going down!', 12, 0, 100, 1, 0, 0, 0, 'Death Knight Initiate to Player'),
(28406, x, x, 'Suffering to the weak!', 12, 0, 100, 66, 0, 0, 0, 'Death Knight Initiate'),
(28406, x, x, 'I''m going to tear your heart out, cupcake!', 12, 0, 100, 397, 0, 0, 0, 'Death Knight Initiate to Player'),
(28406, x, x, 'The duel will begin in...', 42, 0, 100, 1, 0, 0, 0, 'Death Knight Initiate to Player'),
(28406, x, x, '3...', 42, 0, 100, 0, 0, 0, 0, 'Death Knight Initiate to Player'),
(28406, x, x, '2...', 42, 0, 100, 0, 0, 0, 0, 'Death Knight Initiate to Player'),
(28406, x, x, '1...', 42, 0, 100, 0, 0, 0, 0, 'Death Knight Initiate to Player'),
(28406, x, x, 'Remember this day, $n, for it is the day that you will be thoroughly owned.', 12, 0, 100, 1, 0, 0, 0, 'Death Knight Initiate to Player'),
(28406, x, x, '3...', 42, 0, 100, 66, 0, 0, 0, 'Death Knight Initiate to Player'),
(28406, x, x, 'A dozen will fall before I am slain!', 12, 0, 100, 66, 0, 0, 0, 'Death Knight Initiate'),
(28406, x, x, '2...', 42, 0, 100, 66, 0, 0, 0, 'Death Knight Initiate to Player'),
(28406, x, x, '1...', 42, 0, 100, 1, 0, 0, 0, 'Death Knight Initiate to Player'),
(28406, x, x, 'The duel will begin in...', 42, 0, 100, 66, 0, 0, 0, 'Death Knight Initiate to Player'),
(28406, x, x, '2...', 42, 0, 100, 6, 0, 0, 0, 'Death Knight Initiate to Player'),
(28406, x, x, '1...', 42, 0, 100, 6, 0, 0, 0, 'Death Knight Initiate to Player'),
(28406, x, x, 'The duel will begin in...', 42, 0, 100, 273, 0, 0, 0, 'Death Knight Initiate to Player'),
(28406, x, x, '3...', 42, 0, 100, 1, 0, 0, 0, 'Death Knight Initiate to Player'),
(28406, x, x, 'You have challenged death itself!', 12, 0, 100, 397, 0, 0, 0, 'Death Knight Initiate to Player'),
(28406, x, x, 'The duel will begin in...', 42, 0, 100, 5, 0, 0, 0, 'Death Knight Initiate to Player'),
(28406, x, x, '2...', 42, 0, 100, 273, 0, 0, 0, 'Death Knight Initiate to Player'); |
OK, thanks for the response, @Saben65. I just wondered if those Death Knight Initiates can be spoken to when not on the quest, I haven't been there online since 2011. If you look at the images I posted in issue TrinityCore#14700 [3.3.5] Core/Scripts: Death's Challenge & The Endless Hunger, you will see that there has been several issues in the TC source related to gossip or NPC text in the DK starting area. My PR, which is not perfect, solved a little bit of it: @Saben65 : Thanks again for sniff info, it confirms what I counted on in PR 15680 and issue 14700. :)
(this is just an update on what I found randomly, nothing wrong with your sniff, I suppose) |
My suggestion for a fix to replace the hardcoded text in diff --git a/src/server/scripts/EasternKingdoms/ScarletEnclave/chapter1.cpp b/src/server/scripts/EasternKingdoms/ScarletEnclave/chapter1.cpp
index c65ee54..04d8f44 100644
--- a/src/server/scripts/EasternKingdoms/ScarletEnclave/chapter1.cpp
+++ b/src/server/scripts/EasternKingdoms/ScarletEnclave/chapter1.cpp
@@ -449,8 +449,6 @@ class npc_eye_of_acherus : public CreatureScript
## npc_death_knight_initiate
######*/
-#define GOSSIP_ACCEPT_DUEL "I challenge you, death knight!"
-
enum Spells_DKI
{
SPELL_DUEL = 52996,
@@ -468,7 +466,8 @@ enum Says_VBM
enum Misc_VBN
{
QUEST_DEATH_CHALLENGE = 12733,
- FACTION_HOSTILE = 2068
+ FACTION_HOSTILE = 2068,
+ GOSSIP_ACCEPT_DUEL = 9765
};
class npc_death_knight_initiate : public CreatureScript
@@ -511,7 +510,7 @@ public:
if (player->IsInCombat() || creature->IsInCombat())
return true;
- player->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_ACCEPT_DUEL, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF);
+ player->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, player->GetOptionTextWithEntry(GOSSIP_ACCEPT_DUEL), GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF);
player->SEND_GOSSIP_MENU(player->GetGossipTextId(creature), creature->GetGUID());
}
return true; Although there is something missing to define
|
I did grab this from the sniff, just no SQL data relating to the gossip menu (which is what I thought you wanted originally, sorry). Uploaded to pastebin to save space. http://pastebin.com/nEMqNPBY |
Thanks. No need to be sorry, it's OK. Blizzard may be using C++, that is likely why TC scripted it in C++. Update on the Gossip issue: vincent-michael suggested that I call the text from |
@velinath
Every creature has a C++ AI (an element of type So yeah, SmartAI is also a C++ AI and you thus cannot have both SAI and custom AI (well, you can - inheritance - but it'd get messy) at the same time on a single creature. Of course, custom AI of another creature (or the zone script, or spell scripts, or one of about 50 other things) can still control the SAI creature. The creature's AI is not the only thing that can make the creature do things, it's just the most natural place to do so (because of virtual callbacks on various events). |
Makes sense. I figured it should pretty much be all or nothing with these migrations anyway, so works for me :P Thanks for the clarification! e: phone posting leads to terrible typos |
I just checked the SELECT `entry`,`name`,`subname`,`gossip_menu_id`,`faction`,`npcflag`,`unit_flags`,`AIName`,`ScriptName`
FROM `creature_template` WHERE `ScriptName` != '' AND `AIName` != '';
Most of these NPCs are Stable Master and I suppose they are an exception to the rule of either using SmartAI or ScriptName. For all I know, it could be some kind of scripting that is not supported by SAI yet, like retrieving lost companions (non-combat) pets or something other. |
ScriptName takes precedence, AIName is irrelevant if ScriptName is set. |
OK, nice to know. I was pondering whether it would be possible to add gossip via SAI and let the C++ scripts to the rest, but I suppose that won't work at all during runtime (in-game), then. |
Well like I said you can technically implement a C++ script that inherits SmartAI and builds on top of it, but what's the point. As for implementing DB gossip text in C++, if SmartAI does it, then you can do it - check the SAI implementation (is that the right event?) for how it works there. |
Well, player->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_NPC, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF); ( What is actually wrong, is that the script author hardcoded the text instead of linking it from DB via the use of enumerating, but I understand that it is only possible to use for the |
@tkrokli c++ where needed is fine, hardcoded text is bad. Use creature_text / broadcast_text wherever possible appropriate. |
Yes, I have got the intention of removing hardcoded text as priority 1. SAI comes second, if it is possible to just replace the hardcoded text with a call to the DB for the text. |
Addendum to line 2 in the list, EasternKingdoms/ShadowfangKeep/shadowfang_keep.cpp: (EDIT)
OK, confirmed in 6+ years old, level 80 player videos: Please unlock the courtyard door.
Interestingly enough, in https://youtu.be/XkaH_64IiV0?t=47s I noticed that Landen Stilwell is supposed to have gossip text, but it is missing in TC source / DB (unlinked, I guess). OK, so now that gossip for Landen Stilwell is posted. Just wish there was a way of disabling the Some times I need to read things twice to set my head straight. OK:
Sure thing, will get on it and check that ASAP so I can get some progress here. |
I agree that it probably could be done in SAI and might be easier some times. I am just not comfortable with scripting the escort part (with waypoints, pauses and such) of the 2 NPCs from the cells up to the door yet. Maybe I'm too slow. :-p Just thought I would show you 2 pieces I dug up after re-reading r00ty's comments in #trinity: -- Copy broadcast_text ID 2802 into creature_text for use in the script 'npc_shadowfang_prisoner'
DELETE FROM `creature_text` WHERE `entry`= 3849 AND `groupid`= 5;
DELETE FROM `creature_text` WHERE `entry`= 3850 AND `groupid`= 4;
INSERT INTO `creature_text` (`entry`,`groupid`,`id`,`text`,`type`,`language`,`probability`,`emote`,`duration`,`sound`,`BroadcastTextId`,`TextRange`,`comment`) VALUES
(3849,5,0,'Please unlock the courtyard door.',12,1,100,0,0,0,2802,0,'prisoner adamant GOSSIP_MENU_OPTION'),
(3850,4,0,'Please unlock the courtyard door.',12,7,100,1,0,0,2802,0,'prisoner ashcrombe GOSSIP_MENU_OPTION');
-- Insert missing gossip_menu_option 21213 for Sorcerer Ashcrombe and 21214 for Deathstalker Adamant:
DELETE FROM `gossip_menu_option` WHERE `menu_id` IN (21213,21214) AND `OptionBroadcastTextID`= 2802;
INSERT INTO `gossip_menu_option` (`menu_id`,`id`,`option_icon`,`option_text`,`OptionBroadcastTextID`,`option_id`,`npc_option_npcflag`,`action_menu_id`,`action_poi_id`,`box_coded`,`box_money`,`box_text`,`BoxBroadcastTextID`) VALUES
(21213,0,0,'Please unlock the courtyard door.',2802,1,1,0,0,0,0,'',0),
(21214,0,0,'Please unlock the courtyard door.',2802,1,1,0,0,0,0,'',0); Just to line up the existing texts in SELECT * FROM `creature_text` WHERE `entry` IN (3849,3850) ORDER BY `entry`,`groupid`;
So instead of picking the #define text to insert into the gossip_menu_option, it would be possible to use a different aspect of CreatureTextMgr to pick (and maybe even enum) the "gossip_menu_option". (I hope I'm making some sense here, felt a bit confused after making sure that my new issue was correct.) Another interesting line I found during my search for a way to get rid of hardcoded text easier: player->ADD_GOSSIP_ITEM_DB(Player::GetDefaultGossipMenuForSource(creature), 0, GOSSIP_SENDER_MAIN, GOSSIP_OPTION_VENDOR); I am hoping at great lenghts that it will be useful in replacing those foul lines like player->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_SUSURRUS, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF); because the lines of this last kind is the root of our evil in this battle against hardcoded text. Addendum: tip I got from @ForesterDev in my first PR today:
|
New update from Aokromes: the list http://pastebin.com/x7wZLpxH just got updated with emotes... 👿 He also recommends grouping to make the sections smaller and with better overview (I think). I was thinking whether to add a column with |
Per title
The text was updated successfully, but these errors were encountered: