Skip to content

Commit

Permalink
Eversong: Implement hatchling movement
Browse files Browse the repository at this point in the history
  • Loading branch information
killerwife committed Oct 26, 2024
1 parent 35d14b7 commit 946016a
Show file tree
Hide file tree
Showing 2 changed files with 32 additions and 0 deletions.
1 change: 1 addition & 0 deletions sql/scriptdev2/scriptdev2.sql
Original file line number Diff line number Diff line change
Expand Up @@ -735,6 +735,7 @@ UPDATE creature_template SET ScriptName='npc_kelerun_bloodmourn' WHERE entry=178
UPDATE gameobject_template SET ScriptName='go_harbinger_second_trial' WHERE entry=182052;
UPDATE creature_template SET ScriptName='npc_apprentice_mirveda' WHERE entry=15402;
UPDATE creature_template SET ScriptName='npc_infused_crystal' WHERE entry=16364;
UPDATE creature_template SET ScriptName='npc_hatchling_movement' WHERE entry IN(21055,21063,21064);

/* FELWOOD */
UPDATE creature_template SET ScriptName='npc_kitten' WHERE entry=9937;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -481,6 +481,32 @@ UnitAI* GetAI_npc_infused_crystalAI(Creature* pCreature)
return new npc_infused_crystalAI(pCreature);
}

struct HatchlingMovementAI : public ScriptedAI
{
HatchlingMovementAI(Creature* creature) : ScriptedAI(creature)
{
AddCustomAction(1, 1200u, [&]()
{
PickNewPoint();
}, TIMER_COMBAT_OOC);
}

void MovementInform(uint32 movementType, uint32 data) override
{
if (movementType == POINT_MOTION_TYPE && data == 1)
ResetTimer(1, 1200u); // exact delay after each movement
}

void PickNewPoint()
{
Position pos = m_creature->GetRespawnPosition();
float angle = rand_norm_f() * 2 * M_PI_F;
float range = rand_norm_f() * 2.f;
m_creature->MovePositionToFirstCollision(pos, range, angle);
m_creature->GetMotionMaster()->MovePoint(1, pos);
}
};

void AddSC_eversong_woods()
{
Script* pNewScript = new Script;
Expand All @@ -504,4 +530,9 @@ void AddSC_eversong_woods()
pNewScript->Name = "npc_infused_crystal";
pNewScript->GetAI = &GetAI_npc_infused_crystalAI;
pNewScript->RegisterSelf();

pNewScript = new Script;
pNewScript->Name = "npc_hatchling_movement";
pNewScript->GetAI = &GetNewAIInstance<HatchlingMovementAI>;
pNewScript->RegisterSelf();
}

2 comments on commit 946016a

@al3xc1985
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

do u have a vid with hatching movement? I don't lknow how this work and where can be applied

@killerwife
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I dont, go to retail. Its used by 3 mobs in eversong

Please sign in to comment.