Trinitycore: Boss Svala

Created on 18 Jul 2019  路  27Comments  路  Source: TrinityCore/TrinityCore

Description:
Svala Sorrowgrave does not make it to the final part of the encounter.

CHANGEME Description of the problem or issue here.

Current behaviour:
After entry to the chamber where Svala is the Lich King appears as intended and turns her into Svala Sorrowgrave. Afterwards nothing happens but the 3 spawns show up that you have to kill during the encounter but she does not she says nothing back to the Lich King it ends there ans she remains unattackable.

CHANGEME Tell us what happens.
If this is a crash, post the crashlog (upload to https://gist.github.com/).

Expected behaviour:
Svala once transformed into Sorrowgrave should talk to the King and and then he asks her to destroy our uninvited guests and she in return says she will be happy to slaughter them. Then a second or so later she becomes attackable and the fight starts

CHANGEME Tell us what should happen instead.

Steps to reproduce the problem:
Enter Utgarde Pennicle clearing all the trash mobs making your way to the chamber where Svala stands. Once in far enough the initial encounter begins.

  1. CHANGEME Step 1 include entries of affected creatures / items / quests with a link to the relevant wowhead page.
  2. Step 2
  3. Step 3

Branch(es):
3.3.5

CHANGEME 3.3.5, master or both

TC rev. hash/commit:
374597c8e96c+

CHANGEME Copy the result of server debug command (if you need to run it from client get prat addon)

Operating system: CHANGEME OS
Windows 10 Pro

Branch-3.3.5a Comp-C++Script Sub-Instances

Most helpful comment

@Riztazz could you open the PR you mentioned some months ago ?

All 27 comments

I have confirmed this worked in 335.19061. I will use the cpp from 19061 and place them into the 19071 source and compile and report if it works or not. I will first compare the files to see if anything is different. Any tips on where to look for the cause is always appreciated. It would be nice if it was a simple lower case not a capital issue but it compiles without warnings or errors so :(

My lack of C++ knowledge must have me stumped. I have compiled 4 times now replacing boss_svala.cpp with the one from 19061 which when compared side by side the human eye saw no difference but they were different in size by .6. I tried replacing the Utgarde Folder. Just stopping by to explain what I have done to figure the cause.

I now do not think the issue has anything to do with the boss_svala.cpp or the others in that folder. Out of curiosity I compiled again but this time I used the Utgarde Folders from 19071 and put them in the 19061 source, configured, generated, cleaned and built. It worked and Svala did exactly what she was supposed to. I am guessing a change was made but my skills prevent me from pinpointing that. Sorry I tried and apologize.

nothing change on slava c++ side since months ago
https://github.com/TrinityCore/TrinityCore/tree/3.3.5/src/server/scripts/Northrend/UtgardeKeep/UtgardePinnacle
https://github.com/TrinityCore/TrinityCore/commits/3.3.5/src/server/scripts/Northrend/UtgardeKeep/UtgardePinnacle/boss_svala.cpp

Thanks for the response. I do not understand it either I confirm your statement to be true but its broken non the less.
Did This: http://www.mediafire.com/file/2bi862ffgckrzf6/svala_19061.mp4/file
Now this: http://www.mediafire.com/file/2deuvm0i155ci3y/svala_19071.mp4/file
All I can do is clone the source and compile and the above are the results of that. I dislike the prefix PRE ALOT but it appears the three npc's prematurely show up and maybe cause Svala to stop her progression to the next phase of the encounter. Hope this helps the brains, and the brains is not me I'm afraid, figure it out .

very likely something on other files changed, try to compile tc from 2 weeks ago, if works try tc from 1 week ago, if it doesn't something between is the reason of the fail.

Diff:
``` diff
diff --git a/src/server/scripts/Northrend/UtgardeKeep/UtgardePinnacle/boss_svala.cpp b/src/server/scripts/Northrend/UtgardeKeep/UtgardePinnacle/boss_svala.cpp
index f00ba0655f..6718fca463 100644
--- a/src/server/scripts/Northrend/UtgardeKeep/UtgardePinnacle/boss_svala.cpp
+++ b/src/server/scripts/Northrend/UtgardeKeep/UtgardePinnacle/boss_svala.cpp
@@ -117,7 +117,8 @@ enum Events
//SACRIFICING
EVENT_SPAWN_RITUAL_CHANNELERS,
EVENT_RITUAL_STRIKE,
- EVENT_RITUAL_DISARM
+ EVENT_RITUAL_DISARM,
+ EVENT_FINISH_RITUAL,
};

enum Misc
@@ -344,6 +345,9 @@ class boss_svala : public CreatureScript
_arthasGUID.Clear();
events.SetPhase(NORMAL);
_introCompleted = true;

  • me->SetReactState(REACT_AGGRESSIVE);
  • DoZoneInCombat();
  • AttackStart(me->SelectNearestPlayer(100.0f));
    events.ScheduleEvent(EVENT_SINISTER_STRIKE, 7 * IN_MILLISECONDS, 0, NORMAL);
    events.ScheduleEvent(EVENT_CALL_FLAMES, urand(10 * IN_MILLISECONDS, 20 * IN_MILLISECONDS), 0, NORMAL);
    break;
    @@ -357,32 +361,44 @@ class boss_svala : public CreatureScript
    events.ScheduleEvent(EVENT_CALL_FLAMES, urand(10 * IN_MILLISECONDS, 20 * IN_MILLISECONDS), 0, NORMAL);
    break;
    case EVENT_RITUAL_PREPARATION:
  • if (Unit* sacrificeTarget = SelectTarget(SELECT_TARGET_RANDOM, 0, 80.0f, true))
  • me->GetMotionMaster()->MoveIdle();
  • me->StopMoving();
  • me->SetDisableGravity(true);
  • me->SetCanFly(true);
  • me->SetByteFlag(UNIT_FIELD_BYTES_1, UNIT_BYTES_1_OFFSET_ANIM_TIER, UNIT_BYTE1_FLAG_ALWAYS_STAND | UNIT_BYTE1_FLAG_HOVER);
  • me->SetControlled(true, UNIT_STATE_ROOT);
  • me->SetReactState(REACT_PASSIVE);
  • Talk(SAY_SACRIFICE_PLAYER);
  • if (Unit*sacrificeTarget = me->SelectNearestPlayer(100.0f))
    {
    instance->SetGuidData(DATA_SACRIFICED_PLAYER, sacrificeTarget->GetGUID());
  • Talk(SAY_SACRIFICE_PLAYER);
    DoCast(sacrificeTarget, SPELL_RITUAL_PREPARATION);
  • SetCombatMovement(false);
  • DoCast(me, SPELL_RITUAL_OF_THE_SWORD);
    }
  • events.ScheduleEvent(EVENT_SPAWN_RITUAL_CHANNELERS, 1 * IN_MILLISECONDS, 0, SACRIFICING);
  • break;
  • case EVENT_SPAWN_RITUAL_CHANNELERS:
  • DoCast(me, SPELL_RITUAL_OF_THE_SWORD);
  • events.ScheduleEvent(EVENT_RITUAL_STRIKE, 500 , 0, SACRIFICING);
  • events.ScheduleEvent(EVENT_FINISH_RITUAL, 25 * IN_MILLISECONDS);
  • break;
  • case EVENT_RITUAL_STRIKE:
    DoCast(me, SPELL_RITUAL_CHANNELER_1, true);
    DoCast(me, SPELL_RITUAL_CHANNELER_2, true);
    DoCast(me, SPELL_RITUAL_CHANNELER_3, true);
  • events.ScheduleEvent(EVENT_RITUAL_STRIKE, 2 * IN_MILLISECONDS, 0, SACRIFICING);
  • break;
  • case EVENT_RITUAL_STRIKE:
  • me->StopMoving();
  • me->GetMotionMaster()->MoveIdle();
  • me->InterruptNonMeleeSpells(true);
    DoCast(me, SPELL_RITUAL_STRIKE_TRIGGER, true);
    events.ScheduleEvent(EVENT_RITUAL_DISARM, 200, 0, SACRIFICING);
    break;
    case EVENT_RITUAL_DISARM:
    DoCast(me, SPELL_RITUAL_DISARM);
    break;
  • case EVENT_FINISH_RITUAL:
  • events.SetPhase(NORMAL);
  • me->SetControlled(false, UNIT_STATE_ROOT);
  • me->SetDisableGravity(false);
  • me->SetCanFly(false);
  • summons.DespawnAll();
  • me->GetMotionMaster()->MoveFall();
  • DoZoneInCombat();
  • me->SetReactState(REACT_AGGRESSIVE);
  • AttackStart(me->SelectNearestPlayer(50.0f));
  • break;
    default:
    break;
    }

could you open a PR ?

I believe that something between Jun 20 and Jul 14 broke this.
Working in rev. https://github.com/TrinityCore/TrinityCore/commit/f9a366628a17263852634a1095edcdb79a8b383e
Not working using rev. https://github.com/TrinityCore/TrinityCore/commit/6826b8cb2cafd3f64c40357c53e10b8ceaea6b8a with some cherry-picked commits after that rev.

https://github.com/TrinityCore/TrinityCore/blob/3.3.5/src/server/scripts/Northrend/UtgardeKeep/UtgardePinnacle/boss_svala.cpp#L247-L251

This hacky code gets triggered when Svala updates her entry, it triggers due to health change (new entry, new health pool and once updated, for a brief second she is below 50% health). There is a few solutions for this:
1) Move the below health check to DamageTaken hook
2) Check for currentPhase in current implementation (ie. if (!sacrified && healthBelowPct(50) && phase == whateverPhaseSheCanUseThatSpellIn)
3) Set health to new maximum possible health when updating entry
4) Use solution 1 for this specific script but 4) should be implemented/fixed as well

edit: And creature_template_movement for both creatures ought to be updated
edit2: If someone could open PR for it, it would be great :)

Killyana's diff makes Slava behave better however, the encounter is still bugged. it summons you , sacrifices you and then nothing. I tweeked the code a bit, however her immune state and not attackable state never gets removed even with me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE);

if you read the comment from Riztazz above, it explains pretty much what is wrong and what needs to be worked on to correct the issue.

If you read the comment i said i tweaked the code. Obviously due to Riztazz comment. Still no luck

Fair enough, not a problem. I was simply trying to be a little proactive regarding future postings where newcomers don't care about reading up in the issue comments.

https://github.com/TrinityCore/TrinityCore/blob/3.3.5/src/server/scripts/Northrend/UtgardeKeep/UtgardePinnacle/boss_svala.cpp#L247-L251

This hacky code gets triggered when Svala updates her entry, it triggers due to health change (new entry, new health pool and once updated, for a brief second she is below 50% health). There is a few solutions for this:

  1. Move the below health check to DamageTaken hook
  2. Check for currentPhase in current implementation (ie. if (!sacrified && healthBelowPct(50) && phase == whateverPhaseSheCanUseThatSpellIn)
  3. Set health to new maximum possible health when updating entry
  4. Use solution 1 for this specific script but 4) should be implemented/fixed as well

edit: And creature_template_movement for both creatures ought to be updated
edit2: If someone could open PR for it, it would be great :)

Is this solution added to updates? I just put an update and it is still frozen after launching the script.

The current state of the boss is: Can't be targeted.
Is this some kind of intentional?

@Riztazz could you open the PR you mentioned some months ago ?

ok, it seems even if you delete me-> RemoveFlag (UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); it鈥檚 still not impossible to attack.

then we can remove the immunity to the attack after its transformation

case EVENT_INTRO_RELOCATE_SVALA: 
me->RemoveUnitFlag(UNIT_FLAG_NON_ATTACKABLE);

If you change: if (!_sacrificed && HealthBelowPct(50))
on ln 247 to: if (!_sacrificed && HealthBelowPct(50) && events.IsInPhase(NORMAL))

it should fix the fight. She should finish her introduction and the fight should work as intended. She still will not, however, hover at her spawn location after transforming or on fight reset.

Aww man, I independently figured out how to fix this, and then came here to show off my amazing (aka nonexistent) C++ skills just to determine someone else figured this out already. The following fix implements Rizztazz's solutions 2 and 3:

diff --git a/src/server/scripts/Northrend/UtgardeKeep/UtgardePinnacle/boss_svala.cpp b/src/server/scripts/Northrend/UtgardeKeep/UtgardePinnacle/boss_svala.cpp
index 0018069e18..aaaaa255c5 100644
--- a/src/server/scripts/Northrend/UtgardeKeep/UtgardePinnacle/boss_svala.cpp
+++ b/src/server/scripts/Northrend/UtgardeKeep/UtgardePinnacle/boss_svala.cpp
@@ -244,7 +244,7 @@ class boss_svala : public CreatureScript

                 events.Update(diff);

-                if (!_sacrificed && HealthBelowPct(50))
+                if (events.IsInPhase(NORMAL) && !_sacrificed && HealthBelowPct(50))
                 {
                     _sacrificed = true;
                     events.SetPhase(SACRIFICING);
@@ -303,6 +303,7 @@ class boss_svala : public CreatureScript
                             }
                             me->RemoveAllAuras();
                             me->UpdateEntry(NPC_SVALA_SORROWGRAVE);
+                            me->SetFullHealth();
                             me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE);
                             events.ScheduleEvent(EVENT_INTRO_SVALA_TALK_1, 6 * IN_MILLISECONDS, 0, INTRO);
                             break;

Confirmed on f1e4ee21f8da, this works to make the boss targetable and all her skills work as coded.

Now I'm working on the sacrifice ritual, specifically Ritual Strike. It seems the event is scripted as the following:

https://github.com/TrinityCore/TrinityCore/blob/f1e4ee21f8da41c71f4cbafaa85e89c6275c1db2/src/server/scripts/Northrend/UtgardeKeep/UtgardePinnacle/boss_svala.cpp#L359-L385

  1. she will cast SPELL_RITUAL_OF_THE_SWORD (48276) which causes her to teleport to above the player and channel (line 366)
  2. 1 second later, she casts to create the ritual channelers (SPELL_RITUAL_CHANNELER_1-3) (line 371-373)
  3. 2 seconds after that, she casts SPELL_RITUAL_STRIKE_TRIGGER (48331) (line 380) which will cause her sword to travel from her current position to the ritual platform, and when it strikes it will cause the ritual damage (usually death in heroic).

The problem is, the ritual is supposed to last 25 seconds (that's how long she channels for in step 1), but in between step 1 and step 3, she falls down (doesn't fly/hover) and then casts her sword, which causes the entire event to last about 8 seconds instead.

I think we need to set some flag after line 366 to keep her up in the air, but I don't know what flag to set. I already tried me->SetDisableGravity(true); me->SetHover(true); me->SetCanFly(true); and none of them seemed to prevent her from falling. Any ideas?

OK, cherrypicking code from Killyana's diff, I came up with this, which is confirmed working

diff --git a/src/server/scripts/Northrend/UtgardeKeep/UtgardePinnacle/boss_svala.cpp b/src/server/scripts/Northrend/UtgardeKeep/UtgardePinnacle/boss_svala.cpp
index 0018069e18..6ce185358f 100644
--- a/src/server/scripts/Northrend/UtgardeKeep/UtgardePinnacle/boss_svala.cpp
+++ b/src/server/scripts/Northrend/UtgardeKeep/UtgardePinnacle/boss_svala.cpp
@@ -117,7 +117,8 @@ enum Events
     //SACRIFICING
     EVENT_SPAWN_RITUAL_CHANNELERS,
     EVENT_RITUAL_STRIKE,
-    EVENT_RITUAL_DISARM
+    EVENT_RITUAL_DISARM,
+    EVENT_FINISH_RITUAL
 };

 enum Misc
@@ -244,7 +245,7 @@ class boss_svala : public CreatureScript

                 events.Update(diff);

-                if (!_sacrificed && HealthBelowPct(50))
+                if (events.IsInPhase(NORMAL) && !_sacrificed && HealthBelowPct(50))
                 {
                     _sacrificed = true;
                     events.SetPhase(SACRIFICING);
@@ -303,6 +304,7 @@ class boss_svala : public CreatureScript
                             }
                             me->RemoveAllAuras();
                             me->UpdateEntry(NPC_SVALA_SORROWGRAVE);
+                            me->SetFullHealth();
                             me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE);
                             events.ScheduleEvent(EVENT_INTRO_SVALA_TALK_1, 6 * IN_MILLISECONDS, 0, INTRO);
                             break;
@@ -344,6 +346,7 @@ class boss_svala : public CreatureScript
                             _arthasGUID.Clear();
                             events.SetPhase(NORMAL);
                             _introCompleted = true;
+                            AttackStart(me->SelectNearestPlayer(100.0f));
                             events.ScheduleEvent(EVENT_SINISTER_STRIKE, 7 * IN_MILLISECONDS, 0, NORMAL);
                             events.ScheduleEvent(EVENT_CALL_FLAMES, urand(10 * IN_MILLISECONDS, 20 * IN_MILLISECONDS), 0, NORMAL);
                             break;
@@ -364,6 +367,11 @@ class boss_svala : public CreatureScript
                                 DoCast(sacrificeTarget, SPELL_RITUAL_PREPARATION);
                                 SetCombatMovement(false);
                                 DoCast(me, SPELL_RITUAL_OF_THE_SWORD);
+                                me->SetControlled(true,UNIT_STATE_ROOT);
+                                me->SetDisableGravity(true);
+                                me->SetCanFly(true);
+                                me->SetHover(true);
+                                me->SetByteFlag(UNIT_FIELD_BYTES_1, UNIT_BYTES_1_OFFSET_ANIM_TIER, UNIT_BYTE1_FLAG_ALWAYS_STAND | UNIT_BYTE1_FLAG_HOVER);
                             }
                             events.ScheduleEvent(EVENT_SPAWN_RITUAL_CHANNELERS, 1 * IN_MILLISECONDS, 0, SACRIFICING);
                             break;
@@ -372,6 +380,7 @@ class boss_svala : public CreatureScript
                             DoCast(me, SPELL_RITUAL_CHANNELER_2, true);
                             DoCast(me, SPELL_RITUAL_CHANNELER_3, true);
                             events.ScheduleEvent(EVENT_RITUAL_STRIKE, 2 * IN_MILLISECONDS, 0, SACRIFICING);
+                            events.ScheduleEvent(EVENT_FINISH_RITUAL, 25 * IN_MILLISECONDS, 0, SACRIFICING);
                             break;
                         case EVENT_RITUAL_STRIKE:
                             me->StopMoving();
@@ -383,6 +392,18 @@ class boss_svala : public CreatureScript
                         case EVENT_RITUAL_DISARM:
                             DoCast(me, SPELL_RITUAL_DISARM);
                             break;
+                        case EVENT_FINISH_RITUAL:
+                            events.SetPhase(NORMAL);
+                            me->SetControlled(false, UNIT_STATE_ROOT);
+                            me->SetDisableGravity(false);
+                            me->SetCanFly(false);
+                            summons.DespawnAll();
+                            me->RemoveByteFlag(UNIT_FIELD_BYTES_1, UNIT_BYTES_1_OFFSET_ANIM_TIER, UNIT_BYTE1_FLAG_ALWAYS_STAND | UNIT_BYTE1_FLAG_HOVER);
+                            me->GetMotionMaster()->MoveFall();
+                            DoZoneInCombat();
+                            me->SetReactState(REACT_AGGRESSIVE);
+                            AttackStart(me->SelectNearestPlayer(100.0f));
+                            break;
                         default:
                             break;
                     }

This is confirmed working on my server, f1e4ee21f8da.

馃憤 Looks good, happy to see that you were able to test it and find it to be working. Would you like to open a PR to have this code reviewed for merging into the TC script code?

@wotlk-enthusiast can you open PR?

Sure, I'll do that. I'll look around for a guide first before I just go blindly throwing code around and waste more precious dev time. :cold_sweat:

Is this fixed now after PR above?

Yes, it is fixed, the only problem I have seen is when the ritual begins (boss health below 50%) and is positioned over the player on the altar, Svala falls towards the player instead of floating up until the sword hits the player

make a new ticket for that.

Was this page helpful?
0 / 5 - 0 ratings