Issue #216: Flying npcs

    This site uses cookies. By continuing to browse this site, you are agreeing to our Cookie Policy.

    • Issue #216: Flying npcs

      This is fixed. The MoveTeleport works and the flying npc falls to the ground now.

      Video:


      Creature::Die

      C Source Code

      1. void Creature::Die(Unit* pAttacker, uint32 damage, uint32 spellid)
      2. {
      3. if (GetVehicleComponent() != NULL)
      4. {
      5. GetVehicleComponent()->RemoveAccessories();
      6. GetVehicleComponent()->EjectAllPassengers();
      7. }
      8. if (GetAIInterface()->Flying())
      9. {
      10. GetAIInterface()->m_canMove = true; // if we're flying we should be allowed to move so we can fall to the ground.
      11. GetAIInterface()->MoveFalling(GetPositionX(), GetPositionY(), GetMapMgr()->GetADTLandHeight(GetPositionX(), GetPositionY()), 0);
      12. }
      13. // Creature falls off vehicle on death
      14. if ((currentvehicle != NULL))
      15. currentvehicle->EjectPassenger(this);
      16. //general hook for die
      17. if (!sHookInterface.OnPreUnitDie(pAttacker, this))
      18. return;
      19. // on die and an target die proc
      20. {
      21. SpellEntry* killerspell;
      22. if (spellid)
      23. killerspell = dbcSpell.LookupEntry(spellid);
      24. else killerspell = NULL;
      25. HandleProc(PROC_ON_DIE, this, killerspell);
      26. m_procCounter = 0;
      27. pAttacker->HandleProc(PROC_ON_TARGET_DIE, this, killerspell);
      28. pAttacker->m_procCounter = 0;
      29. }
      30. setDeathState(JUST_DIED);
      31. GetAIInterface()->HandleEvent(EVENT_LEAVECOMBAT, this, 0);
      32. if (GetChannelSpellTargetGUID() != 0)
      33. {
      34. Spell* spl = GetCurrentSpell();
      35. if (spl != NULL)
      36. {
      37. for (int i = 0; i < 3; i++)
      38. {
      39. if (spl->GetProto()->Effect[i] == SPELL_EFFECT_PERSISTENT_AREA_AURA)
      40. {
      41. uint64 guid = GetChannelSpellTargetGUID();
      42. DynamicObject* dObj = GetMapMgr()->GetDynamicObject(Arcemu::Util::GUID_LOPART(guid));
      43. if (!dObj)
      44. return;
      45. dObj->Remove();
      46. }
      47. }
      48. if (spl->GetProto()->ChannelInterruptFlags == 48140) spl->cancel();
      49. }
      50. }
      51. /* Stop players from casting */
      52. for (std::set< Object* >::iterator itr = GetInRangePlayerSetBegin(); itr != GetInRangePlayerSetEnd(); itr++)
      53. {
      54. Unit* attacker = TO< Unit* >(*itr);
      55. if (attacker->GetCurrentSpell() != NULL)
      56. {
      57. if (attacker->GetCurrentSpell()->m_targets.m_unitTarget == GetGUID())
      58. attacker->GetCurrentSpell()->cancel();
      59. }
      60. }
      61. smsg_AttackStop(this);
      62. SetHealth(0);
      63. // Wipe our attacker set on death
      64. CombatStatus.Vanished();
      65. RemoveAllNonPersistentAuras();
      66. CALL_SCRIPT_EVENT(pAttacker, OnTargetDied)(this);
      67. pAttacker->smsg_AttackStop(this);
      68. /* Tell Unit that it's target has Died */
      69. pAttacker->addStateFlag(UF_TARGET_DIED);
      70. GetAIInterface()->OnDeath(pAttacker);
      71. SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_DEAD);
      72. if ((GetCreatedByGUID() == 0) && (GetTaggerGUID() != 0))
      73. {
      74. Unit* owner = m_mapMgr->GetUnit(GetTaggerGUID());
      75. if (owner != NULL)
      76. generateLoot();
      77. }
      78. if (GetCharmedByGUID())
      79. {
      80. //remove owner warlock soul link from caster
      81. Unit* owner = GetMapMgr()->GetUnit(GetCharmedByGUID());
      82. if (owner != NULL && owner->IsPlayer())
      83. TO_PLAYER(owner)->EventDismissPet();
      84. }
      85. if (GetCharmedByGUID() != 0)
      86. {
      87. Unit* charmer = m_mapMgr->GetUnit(GetCharmedByGUID());
      88. if (charmer != NULL)
      89. charmer->UnPossess();
      90. }
      91. if (m_mapMgr->m_battleground != NULL)
      92. m_mapMgr->m_battleground->HookOnUnitDied(this);
      93. }
      Display All

      Add into AIInterface.cpp before MoveTeleport

      C Source Code

      1. void AIInterface::MoveFalling(float x, float y, float z, float o /*= 0*/)
      2. {
      3. m_currentMoveSpline.clear();
      4. m_currentMoveSplineIndex = 1;
      5. m_currentSplineUpdateCounter = 0;
      6. m_currentSplineTotalMoveTime = 0;
      7. m_currentSplineFinalOrientation = o;
      8. AddSplineFlag(SPLINEFLAG_FALLING);
      9. AddSpline(m_Unit->GetPositionX(), m_Unit->GetPositionY(), m_Unit->GetPositionZ());
      10. AddSpline(x, y, z);
      11. m_currentMoveSpline.clear();
      12. m_Unit->SetPosition(x, y, z, o);
      13. }
      Display All
      Add into AIInterface.h before MoveTeleport

      C Source Code

      1. void MoveFalling(float x, float y, float z, float o = 0);

      The post was edited 2 times, last by Cronic ().

    • Let me try it on a fresh ascemu, yes i tested it on an old rev of ascemu tho. Give me about 10-15 mins.

      Edit: Works using the code above did you try & add a the new movefalling when i tried it with that it stopped working.

      Edit2: did some updating added MoveFalling it works just as same with video using the SplineFlag_Falling.

      The post was edited 1 time, last by Cronic ().

    • Yeah I need to update my core it was outdated. try it without vmaps and let me know what happens, if it works without vmaps I need to find something. Just tested on newest core hash and it works without vmaps enabled go to .worldport 571 6902.620117 1703.670044 527.148010 and look up and .kill the carrions. Maybe its a vmaps issue?

      The post was edited 2 times, last by Cronic ().

    • Zyres wrote:

      Cronicman wrote:

      Great to hear ;). Zyres what should I start on next? Should i work on the issues on the issue tracker or start on dungeons/raids/spells?
      If you want to start with dungeons/raids, do it. Issues and especially spells are currently on hold until I have moved some systems...
      If you want to start on Wrath Raids in the new heroic system i can continue with the dungeons and bypass the raids.