9
3

generic_fish_movement.lua 2.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475
  1. --[[
  2. Script Name : SpawnScripts/Generic/generic_fish_movement.lua
  3. Script Purpose : Randomly chooses a path for the spawn to take
  4. Script Author : theFoof
  5. Script Date : 2013.5.16
  6. Script Notes :
  7. --]]
  8. function hailed(NPC, Spawn)
  9. FaceTarget(NPC, Spawn)
  10. end
  11. function spawn(NPC)
  12. ChooseMovement(NPC)
  13. end
  14. function respawn(NPC)
  15. end
  16. function ChooseMovement(NPC)
  17. local route = math.random(1,4)
  18. if route == 1 then
  19. Route1(NPC)
  20. elseif route == 2 then
  21. Route2(NPC)
  22. elseif route == 3 then
  23. Route3(NPC)
  24. elseif route == 4 then
  25. Route4(NPC)
  26. end
  27. end
  28. function Route1(NPC)
  29. local X = GetX(NPC)
  30. local Y = GetY(NPC)
  31. local Z = GetZ(NPC)
  32. MovementLoopAddLocation(NPC, X, Y, Z, 2, math.random(5,20))
  33. MovementLoopAddLocation(NPC, X + 6, Y + 2, Z - 3, 2, math.random(20,60))
  34. MovementLoopAddLocation(NPC, X - 4, Y + 3, Z - 8, 2, math.random(20,60))
  35. MovementLoopAddLocation(NPC, X - 7, Y - 9, Z + 2, 2, math.random(20,60))
  36. MovementLoopAddLocation(NPC, X + 9, Y - 8, Z + 10, 2, math.random(20,60))
  37. end
  38. function Route2(NPC)
  39. local X = GetX(NPC)
  40. local Y = GetY(NPC)
  41. local Z = GetZ(NPC)
  42. MovementLoopAddLocation(NPC, X, Y, Z, 2, math.random(5,20))
  43. MovementLoopAddLocation(NPC, X - 6, Y - 2, Z + 3, 2, math.random(20,60))
  44. MovementLoopAddLocation(NPC, X + 4, Y - 5, Z + 8, 2, math.random(20,60))
  45. MovementLoopAddLocation(NPC, X + 7, Y + 3, Z - 2, 2, math.random(20,60))
  46. MovementLoopAddLocation(NPC, X - 9, Y + 3, Z - 10, 2, math.random(20,60))
  47. end
  48. function Route3(NPC)
  49. local X = GetX(NPC)
  50. local Y = GetY(NPC)
  51. local Z = GetZ(NPC)
  52. MovementLoopAddLocation(NPC, X, Y, Z, 2, math.random(5,20))
  53. MovementLoopAddLocation(NPC, X - 3, Y - 2, Z + 6, 2, math.random(20,60))
  54. MovementLoopAddLocation(NPC, X + 8, Y - 5, Z + 4, 2, math.random(20,60))
  55. MovementLoopAddLocation(NPC, X - 2, Y + 3, Z + 7, 2, math.random(20,60))
  56. MovementLoopAddLocation(NPC, X - 10, Y + 3, Z - 9, 2, math.random(20,60))
  57. end
  58. function Route4(NPC)
  59. local X = GetX(NPC)
  60. local Y = GetY(NPC)
  61. local Z = GetZ(NPC)
  62. MovementLoopAddLocation(NPC, X, Y, Z, 2, math.random(5,20))
  63. MovementLoopAddLocation(NPC, X + 6, Y - 2, Z - 3, 2, math.random(20,60))
  64. MovementLoopAddLocation(NPC, X - 4, Y - 5, Z - 8, 2, math.random(20,60))
  65. MovementLoopAddLocation(NPC, X - 7, Y + 3, Z + 2, 2, math.random(20,60))
  66. MovementLoopAddLocation(NPC, X + 9, Y + 3, Z + 10, 2, math.random(20,60))
  67. end