9
3

apaleadder.lua 2.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374
  1. --[[
  2. Script Name : SpawnScripts/classic_caves/apaleadder.lua
  3. Script Author : LordPazuzu
  4. Script Date : 2022.09.02 04:09:35
  5. Script Purpose :
  6. :
  7. --]]
  8. function spawn(NPC)
  9. AddTimer(NPC,math.random(2500,6000), "ChooseMovement")
  10. end
  11. function ChooseMovement(NPC)
  12. if GetSpawnLocationID(NPC)== 133776947 or GetSpawnLocationID(NPC)== 133776948 or GetSpawnLocationID(NPC)== 133776949 then
  13. local route = math.random(1,4)
  14. if route == 1 then
  15. RouteOne(NPC, Spawn)
  16. elseif route == 2 then
  17. RouteTwo(NPC, Spawn)
  18. elseif route == 3 then
  19. RouteThree(NPC, Spawn)
  20. elseif route == 4 then
  21. RouteFour(NPC, Spawn)
  22. end
  23. end
  24. end
  25. function RouteOne(NPC, Spawn)
  26. local X = GetX(NPC)
  27. local Y = GetY(NPC)
  28. local Z = GetZ(NPC)
  29. MovementLoopAddLocation(NPC, X, Y, Z, 2, math.random(2,10))
  30. MovementLoopAddLocation(NPC, X + 4, Y, Z, 2, math.random(20,45))
  31. MovementLoopAddLocation(NPC, X + 4, Y, Z + 4, 2, math.random(20,45))
  32. MovementLoopAddLocation(NPC, X + 7, Y, Z, 2, math.random(20,45))
  33. MovementLoopAddLocation(NPC, X + 4, Y, Z + 4, 2, math.random(20,45))
  34. MovementLoopAddLocation(NPC, X, Y, Z, 2, math.random(20,45))
  35. end
  36. function RouteTwo(NPC, Spawn)
  37. local X = GetX(NPC)
  38. local Y = GetY(NPC)
  39. local Z = GetZ(NPC)
  40. MovementLoopAddLocation(NPC, X, Y, Z, 2, math.random(2,10))
  41. MovementLoopAddLocation(NPC, X - 4, Y, Z, 2, math.random(20,45))
  42. MovementLoopAddLocation(NPC, X - 4, Y, Z - 4, 2, math.random(20,45))
  43. MovementLoopAddLocation(NPC, X - 7, Y, Z, 2, math.random(20,45))
  44. MovementLoopAddLocation(NPC, X - 4, Y, Z - 4, 2, math.random(20,45))
  45. MovementLoopAddLocation(NPC, X, Y, Z, 1, math.random(20,45))
  46. end
  47. function RouteThree(NPC, Spawn)
  48. local X = GetX(NPC)
  49. local Y = GetY(NPC)
  50. local Z = GetZ(NPC)
  51. MovementLoopAddLocation(NPC, X, Y, Z, 2, math.random(2,10))
  52. MovementLoopAddLocation(NPC, X + 4, Y, Z, 2, math.random(20,45))
  53. MovementLoopAddLocation(NPC, X + 4, Y, Z - 4, 2, math.random(20,45))
  54. MovementLoopAddLocation(NPC, X + 7, Y, Z, 2, math.random(20,45))
  55. MovementLoopAddLocation(NPC, X + 4, Y, Z - 4, 2, math.random(20,45))
  56. MovementLoopAddLocation(NPC, X, Y, Z, 2, math.random(20,45))
  57. end
  58. function RouteFour(NPC, Spawn)
  59. local X = GetX(NPC)
  60. local Y = GetY(NPC)
  61. local Z = GetZ(NPC)
  62. MovementLoopAddLocation(NPC, X, Y, Z, 2, math.random(2,10))
  63. MovementLoopAddLocation(NPC, X - 4, Y, Z, 2, math.random(20,45))
  64. MovementLoopAddLocation(NPC, X - 4, Y, Z + 4, 2, math.random(20,45))
  65. MovementLoopAddLocation(NPC, X - 7, Y, Z, 2, math.random(20,45))
  66. MovementLoopAddLocation(NPC, X - 4, Y, Z + 4, 2, math.random(20,45))
  67. MovementLoopAddLocation(NPC, X, Y, Z, 2, math.random(20,45))
  68. end