MovementCircleSmall.lua 2.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960
  1. --[[
  2. Script Name : SpawnScripts/Generic/MovementCircleSmall.lua
  3. Script Purpose : Randomly chooses a small circle for the spawn to take
  4. Script Author : Scatman
  5. Script Date : 2009.10.27
  6. Script Notes :
  7. --]]
  8. function SpawnChooseRandomMovement(NPC)
  9. local choice = math.random(1, 4)
  10. if choice == 1 then
  11. clockwise1(NPC)
  12. elseif choice == 2 then
  13. clockwise2(NPC)
  14. elseif choice == 3 then
  15. counter_clockwise1(NPC)
  16. elseif choice == 4 then
  17. counter_clockwise2(NPC)
  18. end
  19. end
  20. function clockwise1(NPC)
  21. local x = GetX(NPC)
  22. local y = GetY(NPC)
  23. local z = GetZ(NPC)
  24. MovementLoopAddLocation(NPC, x + 7 , y, z - 8 , 2, math.random(5, 15))
  25. MovementLoopAddLocation(NPC, x - 5 , y, z - 10, 2, math.random(5, 15))
  26. MovementLoopAddLocation(NPC, x - 10, y, z + 9 , 2, math.random(5, 15))
  27. MovementLoopAddLocation(NPC, x + 5 , y, z + 8 , 2, math.random(5, 15))
  28. end
  29. function clockwise2(NPC)
  30. local x = GetX(NPC)
  31. local y = GetY(NPC)
  32. local z = GetZ(NPC)
  33. MovementLoopAddLocation(NPC, x + 2 , y, z - 8 , 2, math.random(5, 15))
  34. MovementLoopAddLocation(NPC, x - 7 , y, z - 5 , 2, math.random(5, 15))
  35. MovementLoopAddLocation(NPC, x , y, z + 6 , 2, math.random(5, 15))
  36. MovementLoopAddLocation(NPC, x + 9 , y, z + 1 , 2, math.random(5, 15))
  37. end
  38. function counter_clockwise1(NPC)
  39. local x = GetX(NPC)
  40. local y = GetY(NPC)
  41. local z = GetZ(NPC)
  42. MovementLoopAddLocation(NPC, x - 7 , y, z + 8 , 2, math.random(5, 15))
  43. MovementLoopAddLocation(NPC, x + 5 , y, z + 10, 2, math.random(5, 15))
  44. MovementLoopAddLocation(NPC, x + 10, y, z - 9 , 2, math.random(5, 15))
  45. MovementLoopAddLocation(NPC, x - 5 , y, z - 8 , 2, math.random(5, 15))
  46. end
  47. function counter_clockwise2(NPC)
  48. local x = GetX(NPC)
  49. local y = GetY(NPC)
  50. local z = GetZ(NPC)
  51. MovementLoopAddLocation(NPC, x - 2 , y, z + 8 , 2, math.random(5, 15))
  52. MovementLoopAddLocation(NPC, x + 7 , y, z + 5 , 2, math.random(5, 15))
  53. MovementLoopAddLocation(NPC, x , y, z - 6 , 2, math.random(5, 15))
  54. MovementLoopAddLocation(NPC, x - 9 , y, z - 1 , 2, math.random(5, 15))
  55. end