9
3

aRabidBadger.lua 2.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485
  1. --[[
  2. Script Name : SpawnScripts/Classic_forest/aRabidBadger.lua
  3. Script Author : LordPazuzu
  4. Script Date : 2022.10.11 12:10:52
  5. Script Purpose :
  6. :
  7. --]]
  8. function spawn(NPC)
  9. dmgMod = GetStr(NPC)/10
  10. SetInfoStructUInt(NPC, "override_primary_weapon", 1)
  11. SetInfoStructUInt(NPC, "primary_weapon_damage_low", math.floor(10 + dmgMod))
  12. SetInfoStructUInt(NPC, "primary_weapon_damage_high", math.floor(22 + dmgMod))
  13. ChooseMovement(NPC)
  14. end
  15. function ChooseMovement(NPC)
  16. local route = math.random(1,4)
  17. if route == 1 then
  18. RouteOne(NPC, Spawn)
  19. elseif route == 2 then
  20. RouteTwo(NPC, Spawn)
  21. elseif route == 3 then
  22. RouteThree(NPC, Spawn)
  23. elseif route == 4 then
  24. RouteFour(NPC, Spawn)
  25. end
  26. end
  27. function RouteOne(NPC, Spawn)
  28. local X = GetX(NPC)
  29. local Y = GetY(NPC)
  30. local Z = GetZ(NPC)
  31. MovementLoopAddLocation(NPC, X, Y, Z, 2, math.random(5,10))
  32. MovementLoopAddLocation(NPC, X + 5, Y, Z, 2,math.random(5,10))
  33. MovementLoopAddLocation(NPC, X + 5, Y, Z + 4, 2, math.random(5,10))
  34. MovementLoopAddLocation(NPC, X + 6, Y, Z, 2, math.random(5,10))
  35. MovementLoopAddLocation(NPC, X + 5, Y, Z + 4, 2, math.random(5,10))
  36. MovementLoopAddLocation(NPC, X, Y, Z, 2, math.random(5,10))
  37. end
  38. function RouteTwo(NPC, Spawn)
  39. local X = GetX(NPC)
  40. local Y = GetY(NPC)
  41. local Z = GetZ(NPC)
  42. MovementLoopAddLocation(NPC, X, Y, Z, 2, math.random(5,10))
  43. MovementLoopAddLocation(NPC, X - 5, Y, Z, 2, math.random(5,10))
  44. MovementLoopAddLocation(NPC, X - 5, Y, Z - 4, 2, math.random(5,10))
  45. MovementLoopAddLocation(NPC, X - 6, Y, Z, 2, math.random(5,10))
  46. MovementLoopAddLocation(NPC, X - 5, Y, Z - 4, 2, math.random(5,10))
  47. MovementLoopAddLocation(NPC, X, Y, Z, 1, math.random(5,10))
  48. end
  49. function RouteThree(NPC, Spawn)
  50. local X = GetX(NPC)
  51. local Y = GetY(NPC)
  52. local Z = GetZ(NPC)
  53. MovementLoopAddLocation(NPC, X, Y, Z, 2, math.random(5,10))
  54. MovementLoopAddLocation(NPC, X + 5, Y, Z, 2, math.random(5,10))
  55. MovementLoopAddLocation(NPC, X + 5, Y, Z - 4, 2, math.random(5,10))
  56. MovementLoopAddLocation(NPC, X + 6, Y, Z, 2, math.random(5,10))
  57. MovementLoopAddLocation(NPC, X + 5, Y, Z - 4, 2, math.random(5,10))
  58. MovementLoopAddLocation(NPC, X, Y, Z, 2, math.random(5,10))
  59. end
  60. function RouteFour(NPC, Spawn)
  61. local X = GetX(NPC)
  62. local Y = GetY(NPC)
  63. local Z = GetZ(NPC)
  64. MovementLoopAddLocation(NPC, X, Y, Z, 2, math.random(5,10))
  65. MovementLoopAddLocation(NPC, X - 5, Y, Z, 2, math.random(5,10))
  66. MovementLoopAddLocation(NPC, X - 5, Y, Z + 4, 2, math.random(5,10))
  67. MovementLoopAddLocation(NPC, X - 6, Y, Z, 2, math.random(5,10))
  68. MovementLoopAddLocation(NPC, X - 5, Y, Z + 4, 2, math.random(5,10))
  69. MovementLoopAddLocation(NPC, X, Y, Z, 2, math.random(5,10))
  70. end
  71. function respawn(NPC, Spawn)
  72. spawn(NPC)
  73. end
  74. function hailed(NPC, Spawn)
  75. FaceTarget(NPC, Spawn)
  76. end