arabidpackrat.lua 2.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990
  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. local Level = GetLevel(NPC)
  13. local level1 = 6
  14. local level2 = 7
  15. local difficulty1 = 1
  16. local hp1 = 50
  17. local power1 = 25
  18. local difficulty2 = 1
  19. local hp2 = 55
  20. local power2 = 30
  21. if Level == level1 then
  22. SpawnSet(NPC, "difficulty", difficulty1)
  23. SpawnSet(NPC, "hp", hp1)
  24. SpawnSet(NPC, "power", power1)
  25. elseif Level == level2
  26. then
  27. SpawnSet(NPC, "difficulty", difficulty2)
  28. SpawnSet(NPC, "hp", hp2)
  29. SpawnSet(NPC, "power", power2)
  30. end
  31. ChooseMovement(NPC)
  32. end
  33. function ChooseMovement(NPC)
  34. local choice = math.random(1, 4)
  35. if choice == 1 then
  36. clockwise1(NPC)
  37. elseif choice == 2 then
  38. clockwise2(NPC)
  39. elseif choice == 3 then
  40. counter_clockwise1(NPC)
  41. elseif choice == 4 then
  42. counter_clockwise2(NPC)
  43. end
  44. end
  45. function respawn(NPC)
  46. spawn(NPC)
  47. end
  48. function clockwise1(NPC)
  49. local x = GetX(NPC)
  50. local y = GetY(NPC)
  51. local z = GetZ(NPC)
  52. MovementLoopAddLocation(NPC, x + 3 , y, z - 4 , 1, math.random(2, 5))
  53. MovementLoopAddLocation(NPC, x - 1 , y, z - 6, 1, math.random(2, 5))
  54. --MovementLoopAddLocation(NPC, x - 6, y, z + 5 , 1, math.random(2, 5))
  55. --MovementLoopAddLocation(NPC, x + 1 , y, z + 4 , 1, math.random(2, 5))
  56. end
  57. function clockwise2(NPC)
  58. local x = GetX(NPC)
  59. local y = GetY(NPC)
  60. local z = GetZ(NPC)
  61. MovementLoopAddLocation(NPC, x + 2 , y, z - 4 , 1, math.random(2, 5))
  62. MovementLoopAddLocation(NPC, x - 7 , y, z - 1 , 1, math.random(2, 5))
  63. --MovementLoopAddLocation(NPC, x , y, z + 2 , 1, math.random(2, 5))
  64. --MovementLoopAddLocation(NPC, x + 5 , y, z + 1 , 1, math.random(2, 5))
  65. end
  66. function counter_clockwise1(NPC)
  67. local x = GetX(NPC)
  68. local y = GetY(NPC)
  69. local z = GetZ(NPC)
  70. MovementLoopAddLocation(NPC, x - 3 , y, z + 4 , 1, math.random(2, 5))
  71. MovementLoopAddLocation(NPC, x + 1 , y, z + 6, 1, math.random(2, 5))
  72. --MovementLoopAddLocation(NPC, x + 4, y, z - 5 , 1, math.random(2, 5))
  73. --MovementLoopAddLocation(NPC, x - 1 , y, z - 4 , 1, math.random(2, 5))
  74. end
  75. function counter_clockwise2(NPC)
  76. local x = GetX(NPC)
  77. local y = GetY(NPC)
  78. local z = GetZ(NPC)
  79. MovementLoopAddLocation(NPC, x - 2 , y, z + 4 , 1, math.random(2, 5))
  80. MovementLoopAddLocation(NPC, x + 3 , y, z + 1 , 1, math.random(2, 5))
  81. --MovementLoopAddLocation(NPC, x , y, z - 2 , 1, math.random(2, 5))
  82. --MovementLoopAddLocation(NPC, x - 5 , y, z - 1 , 1, math.random(2, 5))
  83. end