movement_circle_small.lua 2.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172
  1. --[[
  2. Script Name : SpawnScripts/Generic/movement_circle_small.lua
  3. Script Purpose : Generic Movement Script (small circles)
  4. Script Author : Scatman
  5. Script Date : 2009.03.01
  6. Script Notes :
  7. --]]
  8. function hailed(NPC, Spawn)
  9. FaceTarget(NPC, Spawn)
  10. end
  11. function spawn(NPC)
  12. MovementChoice(NPC)
  13. end
  14. function MovementChoice(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 respawn(NPC)
  27. spawn(NPC)
  28. end
  29. function clockwise1(NPC)
  30. local x = GetX(NPC)
  31. local y = GetY(NPC)
  32. local z = GetZ(NPC)
  33. MovementLoopAddLocation(NPC, x + 7 , y, z - 8 , 2, math.random(5, 15))
  34. MovementLoopAddLocation(NPC, x - 5 , y, z - 10, 2, math.random(5, 15))
  35. MovementLoopAddLocation(NPC, x - 10, y, z + 9 , 2, math.random(5, 15))
  36. MovementLoopAddLocation(NPC, x + 5 , y, z + 8 , 2, math.random(5, 15))
  37. end
  38. function clockwise2(NPC)
  39. local x = GetX(NPC)
  40. local y = GetY(NPC)
  41. local z = GetZ(NPC)
  42. MovementLoopAddLocation(NPC, x + 2 , y, z - 8 , 2, math.random(5, 15))
  43. MovementLoopAddLocation(NPC, x - 7 , y, z - 5 , 2, math.random(5, 15))
  44. MovementLoopAddLocation(NPC, x , y, z + 6 , 2, math.random(5, 15))
  45. MovementLoopAddLocation(NPC, x + 9 , y, z + 1 , 2, math.random(5, 15))
  46. end
  47. function counter_clockwise1(NPC)
  48. local x = GetX(NPC)
  49. local y = GetY(NPC)
  50. local z = GetZ(NPC)
  51. MovementLoopAddLocation(NPC, x - 7 , y, z + 8 , 2, math.random(5, 15))
  52. MovementLoopAddLocation(NPC, x + 5 , y, z + 10, 2, math.random(5, 15))
  53. MovementLoopAddLocation(NPC, x + 10, y, z - 9 , 2, math.random(5, 15))
  54. MovementLoopAddLocation(NPC, x - 5 , y, z - 8 , 2, math.random(5, 15))
  55. end
  56. function counter_clockwise2(NPC)
  57. local x = GetX(NPC)
  58. local y = GetY(NPC)
  59. local z = GetZ(NPC)
  60. MovementLoopAddLocation(NPC, x - 2 , y, z + 8 , 2, math.random(5, 15))
  61. MovementLoopAddLocation(NPC, x + 7 , y, z + 5 , 2, math.random(5, 15))
  62. MovementLoopAddLocation(NPC, x , y, z - 6 , 2, math.random(5, 15))
  63. MovementLoopAddLocation(NPC, x - 9 , y, z - 1 , 2, math.random(5, 15))
  64. end