anironbellyrabbit.lua 2.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869
  1. --[[
  2. Script Name : SpawnScripts/Antonica/anironbellyrabbit.lua
  3. Script Author : Premierio015, Scatman
  4. Script Date : 2021.08.13 08:08:48
  5. Script Purpose : an ironbelly rabbit movement script, based on Scatman's medium circle movement script.
  6. Script Notes : Current script might be better overwritten with better movement loop in future.
  7. --]]
  8. function hailed(NPC, Spawn)
  9. FaceTarget(NPC, Spawn)
  10. end
  11. function spawn(NPC)
  12. SpawnChooseRandomMovement(NPC)
  13. end
  14. function SpawnChooseRandomMovement(NPC)
  15. local choice = math.random(1, 4)
  16. if choice == 1 then
  17. clockwise1(NPC)
  18. elseif choice == 2 then
  19. clockwise2(NPC)
  20. elseif choice == 3 then
  21. counter_clockwise1(NPC)
  22. elseif choice == 4 then
  23. counter_clockwise2(NPC)
  24. end
  25. end
  26. function clockwise1(NPC)
  27. local x = GetX(NPC)
  28. local y = GetY(NPC)
  29. local z = GetZ(NPC)
  30. MovementLoopAddLocation(NPC, x + 12 , y, z - 13 , 10, math.random(5, 15))
  31. MovementLoopAddLocation(NPC, x - 10 , y, z - 15, 10, math.random(5, 15))
  32. MovementLoopAddLocation(NPC, x - 15, y, z + 14 , 10, math.random(5, 15))
  33. MovementLoopAddLocation(NPC, x + 10 , y, z + 13 , 10, math.random(5, 15))
  34. end
  35. function clockwise2(NPC)
  36. local x = GetX(NPC)
  37. local y = GetY(NPC)
  38. local z = GetZ(NPC)
  39. MovementLoopAddLocation(NPC, x + 7 , y, z - 13 , 10, math.random(5, 15))
  40. MovementLoopAddLocation(NPC, x - 12 , y, z - 10 , 10, math.random(5, 15))
  41. MovementLoopAddLocation(NPC, x , y, z + 11 , 10, math.random(5, 15))
  42. MovementLoopAddLocation(NPC, x + 14 , y, z + 6 , 10, math.random(5, 15))
  43. end
  44. function counter_clockwise1(NPC)
  45. local x = GetX(NPC)
  46. local y = GetY(NPC)
  47. local z = GetZ(NPC)
  48. MovementLoopAddLocation(NPC, x - 12 , y, z + 13 , 10, math.random(5, 15))
  49. MovementLoopAddLocation(NPC, x + 10 , y, z + 15, 10, math.random(5, 15))
  50. MovementLoopAddLocation(NPC, x + 15, y, z - 14 , 10, math.random(5, 15))
  51. MovementLoopAddLocation(NPC, x - 10 , y, z - 13 , 10, math.random(5, 15))
  52. end
  53. function counter_clockwise2(NPC)
  54. local x = GetX(NPC)
  55. local y = GetY(NPC)
  56. local z = GetZ(NPC)
  57. MovementLoopAddLocation(NPC, x - 7 , y, z + 13 , 10, math.random(5, 15))
  58. MovementLoopAddLocation(NPC, x + 12 , y, z + 10 , 10, math.random(5, 15))
  59. MovementLoopAddLocation(NPC, x , y, z - 11 , 10, math.random(5, 15))
  60. MovementLoopAddLocation(NPC, x - 14 , y, z - 6 , 10, math.random(5, 15))
  61. end