Advertisement
WIXXZI

Fly Mount on Death Eluna

Mar 12th, 2023
102
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.22 KB | None | 0 0
  1. local MOVE_WALK = 0
  2. local MOVE_RUN = 1
  3. local MOVE_RUN_BACK = 2
  4. local MOVE_SWIM = 3
  5. local MOVE_SWIM_BACK = 4
  6. local MOVE_TURN_RATE = 5
  7. local MOVE_FLIGHT = 6
  8. local MOVE_FLIGHT_BACK = 7
  9. local MOVE_PITCH_RATE = 8
  10. local UNIT_FIELD_MOUNTDISPLAYID = 69
  11. local FlyMountModel = 25511
  12.  
  13. local function UponDeathTimedEvent(eventId, delay, calls, player)
  14. player:SetUInt32Value(UNIT_FIELD_MOUNTDISPLAYID, FlyMountModel)
  15. player:AddAura( 34873, player ) -- add fly aura
  16. player:SetSpeed( MOVE_FLIGHT, 4.1, false )
  17. player:SetSpeed( MOVE_RUN, 2.0, false )
  18. end
  19.  
  20. local function OnRepop(event, player)
  21. inBattleGround = player:InBattleground()
  22. if not inBattleGround then
  23. player:RegisterEvent(UponDeathTimedEvent, 1000, 1)
  24. end
  25. end
  26.  
  27. local function OnResurrect(event, player)
  28. inBattleGround = player:InBattleground()
  29. if not inBattleGround then
  30. player:SetUInt32Value(UNIT_FIELD_MOUNTDISPLAYID, 0)
  31. player:RemoveAura( 34873 ) -- remove fly aura
  32. player:SetSpeed( MOVE_FLIGHT, 4.1, false )
  33. player:SetSpeed( MOVE_RUN, 1.0, false )
  34. end
  35. end
  36.  
  37. RegisterPlayerEvent(35, OnRepop)
  38. RegisterPlayerEvent(36, OnResurrect)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement