movement_circle_medium.lua 2.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768
  1. --[[
  2. Script Name : SpawnScripts/Generic/movement_circle_medium.lua
  3. Script Purpose : Randomly chooses a medium circle for the spawn to take
  4. Script Author : theFoof
  5. Script Date : 2013.5.22
  6. Script Notes : larger version of movement_cirlce_small.lua (written by Scatman)
  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 , 2, math.random(5, 15))
  31. MovementLoopAddLocation(NPC, x - 10 , y, z - 15, 2, math.random(5, 15))
  32. MovementLoopAddLocation(NPC, x - 15, y, z + 14 , 2, math.random(5, 15))
  33. MovementLoopAddLocation(NPC, x + 10 , y, z + 13 , 2, 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 , 2, math.random(5, 15))
  40. MovementLoopAddLocation(NPC, x - 12 , y, z - 10 , 2, math.random(5, 15))
  41. MovementLoopAddLocation(NPC, x , y, z + 11 , 2, math.random(5, 15))
  42. MovementLoopAddLocation(NPC, x + 14 , y, z + 6 , 2, 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 , 2, math.random(5, 15))
  49. MovementLoopAddLocation(NPC, x + 10 , y, z + 15, 2, math.random(5, 15))
  50. MovementLoopAddLocation(NPC, x + 15, y, z - 14 , 2, math.random(5, 15))
  51. MovementLoopAddLocation(NPC, x - 10 , y, z - 13 , 2, 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 , 2, math.random(5, 15))
  58. MovementLoopAddLocation(NPC, x + 12 , y, z + 10 , 2, math.random(5, 15))
  59. MovementLoopAddLocation(NPC, x , y, z - 11 , 2, math.random(5, 15))
  60. MovementLoopAddLocation(NPC, x - 14 , y, z - 6 , 2, math.random(5, 15))
  61. end