9
3

tiny_movement_loop.lua 2.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071
  1. --[[
  2. Script Name : SpawnScripts/Generic/tiny_movement_loop.lua
  3. Script Purpose : a tiny movement loop
  4. Script Author : theFoof
  5. Script Date : 2013.5.22
  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 ChooseMovement(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 + 3 , y, z - 4 , 1, math.random(2, 5))
  34. MovementLoopAddLocation(NPC, x - 1 , y, z - 6, 1, math.random(2, 5))
  35. --MovementLoopAddLocation(NPC, x - 6, y, z + 5 , 1, math.random(2, 5))
  36. --MovementLoopAddLocation(NPC, x + 1 , y, z + 4 , 1, math.random(2, 5))
  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 - 4 , 1, math.random(2, 5))
  43. MovementLoopAddLocation(NPC, x - 7 , y, z - 1 , 1, math.random(2, 5))
  44. --MovementLoopAddLocation(NPC, x , y, z + 2 , 1, math.random(2, 5))
  45. --MovementLoopAddLocation(NPC, x + 5 , y, z + 1 , 1, math.random(2, 5))
  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 - 3 , y, z + 4 , 1, math.random(2, 5))
  52. MovementLoopAddLocation(NPC, x + 1 , y, z + 6, 1, math.random(2, 5))
  53. --MovementLoopAddLocation(NPC, x + 4, y, z - 5 , 1, math.random(2, 5))
  54. --MovementLoopAddLocation(NPC, x - 1 , y, z - 4 , 1, math.random(2, 5))
  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 + 4 , 1, math.random(2, 5))
  61. MovementLoopAddLocation(NPC, x + 3 , y, z + 1 , 1, math.random(2, 5))
  62. --MovementLoopAddLocation(NPC, x , y, z - 2 , 1, math.random(2, 5))
  63. --MovementLoopAddLocation(NPC, x - 5 , y, z - 1 , 1, math.random(2, 5))
  64. end