Skip to content
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

[ScriptAI] Many boss can't fly when use ScirptAI temporary access to sky #18551

Open
kissingers opened this issue Mar 13, 2024 · 7 comments
Open

Comments

@kissingers
Copy link
Contributor

kissingers commented Mar 13, 2024

Current Behaviour

Any combination of the following contains with me->SetDisableGravity(true); can not fly or stay on the sky after any action.
So many bosses lose the ability to fly, or fly into the air and fall down quickly.
It feels like the disable gravity temporary marker is not working.

me->SetCanFly(true);
me->HandleEmoteCommand(EMOTE_ONESHOT_LIFTOFF);
me->SendMovementFlagUpdate();

Expected Blizzlike Behaviour

They can fly at some event until finished the event.

Source

No response

Steps to reproduce the problem

look at boss felmyst,illidan , nightbane,when the sky phase , after they cast spell, they all fall to grand.

Extra Notes

#15855

AC rev. hash/commit

AzerothCore rev. 9616433+ 2024-03-10 16:52:03 -0300 (master branch) (Unix, RelWithDebInfo, Static)

Operating system

debian12 x64

Custom changes or Modules

No response

@kissingers kissingers changed the title [ScriptAI] Many boss can't fly use when use ScirptAI [ScriptAI] Many boss can't fly when use ScirptAI temporary access to sky Mar 13, 2024
@kissingers
Copy link
Contributor Author

#18488
#15855

@kissingers
Copy link
Contributor Author

It seem when use me->HandleEmoteCommand(EMOTE_ONESHOT_LIFTOFF) after cast any spell or move , it will fall to grand.

@Grimdhex
Copy link
Contributor

Grimdhex commented Aug 17, 2024

Can you provide an example ? Firstly, SetCanFly uage is completely wrong. This method is often badly used, but it is mainly for players. You should use "SetDisableGravity" for creatures. Then you need to use the right MotionMaster movement.

For example, with Kael'thas issue, it's MotionMaster::MoveTakeoff and not MovePoint (and when flying, cast others spells doesn't break GravityFlag). But I according that the behaviour of MotionMaster seems weird.

@kissingers
Copy link
Contributor Author

kissingers commented Aug 17, 2024

Can you provide an example ? Firstly, SetCanFly uage is completely wrong. This method is often badly used, but it is mainly for players. You should use "SetDisableGravity" for creatures. Then you need to use the right MotionMaster movement.

For example, with Kael'thas issue, it's MotionMaster::MoveTakeoff and not MovePoint (and when flying, cast others spells doesn't break GravityFlag). But I according that the behaviour of MotionMaster seems weird.

Yes, I find the way to fix the problem for some boss, such as Felmyst like this way:
46ba1ba

and nightbane seems alread ok till now fix.
but illidan still will first fly to sky and then drop to ground and run at ground not fly at sky, it seems there is PR to be testing for illidan, might need fix the problem at the PR or later.

@kissingers
Copy link
Contributor Author

kissingers commented Aug 17, 2024

And I find when felmyst at sky fly, if cast spell, will need add flow code again, otherwise will drop to ground and run at ground, it seems cast spell auto stop SetDisableGravity(true) , I think only need update the status once till SetDisableGravity(false) , cast the spell will not stop the status. so it might a problem.
me->SetDisableGravity(true);
me->SendMovementFlagUpdate();

@Grimdhex
Copy link
Contributor

I've debug Kael'Thas and you have effectly right. m_movementInfo loose the movement flag after reaching the first DoCastSelf following but the spline flag keep in memory the movement mode. This is why we have such variable situations.

I will try to look depper why this flag is lost when the creature cast (or maybe do) something.

@sogladev
Copy link
Contributor

After setting SetDisableGravity(true) and engaging a movement spline, the very next Creature::Update() will remove that flag if the creature_template_movement.Flight is set to 0

if (GetMovementTemplate().IsFlightAllowed() && isInAir && !IsFalling())

call stack picture

creature_update_movement_disable_gravity

For Felmyst: creature_template_movement.Flight is 0. Maybe this can be set to 2 (Flight) similar to Nightbane

For Kael: creature_template_movement.Flight = 0. Maybe 1 (Disable Gravity) and enabling gravity on init/reset but I found it is not needed

What worked for me is sending the disable gravity flag once the first spline finishes (MovementInform) and before sending the next spline like

me->SetDisableGravity(false);
me->SendMovementFlagUpdate();
me->GetMotionMaster()->MoveTakeoff(...)

MoveTakeoff seems to be better than MovePoint for flight. MovePoint can prevent flight as it checks for conditions like casting and causes movement to be like - - - - instead of smooth ------
, but can mess with animations due to init.SetAnimation(Movement::ToFly) It prevents the drowning emote from being applied correctly

Illidan can be done the same way I think as the flight is only a small part of his overall movement

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants