acatch.lua 2.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283
  1. --[[
  2. Script Name : SpawnScripts/CoveofDecay/acatch.lua
  3. Script Author : Neveruary
  4. Script Date : 2022.03.02 02:03:42
  5. Script Purpose :
  6. :
  7. --]]
  8. crabIDs = {347223, 347225, 347228, 347231}
  9. function spawn(NPC)
  10. end
  11. function death(NPC, Spawn)
  12. AddTimer(NPC, 250, "fishCheck1", 1, Spawn) -- Send Spawn to next function
  13. end
  14. function fishCheck1(NPC, Spawn) -- this sucks. someone please help me fix it.
  15. local zone = GetZone(NPC)
  16. local fish1 = GetSpawnByLocationID(zone, 347235)
  17. local fish2 = GetSpawnByLocationID(zone, 347237)
  18. local fish3 = GetSpawnByLocationID(zone, 347238)
  19. if IsAlive(fish1) == true then
  20. elseif IsAlive(fish2) == true then
  21. elseif IsAlive(fish3) == true then
  22. else
  23. SetTempVariable(NPC, "fishcheck1", "1")
  24. AddTimer(NPC, 250, "fishCheck2", 1, Spawn)
  25. end
  26. end
  27. function fishCheck2(NPC, Spawn)
  28. local zone = GetZone(NPC)
  29. local fish1 = GetSpawnByLocationID(zone, 347242)
  30. local fish2 = GetSpawnByLocationID(zone, 347243)
  31. local fish3 = GetSpawnByLocationID(zone, 347239)
  32. local fish4 = GetSpawnByLocationID(zone, 347240)
  33. if IsAlive(fish1) == true then
  34. elseif IsAlive(fish2) == true then
  35. elseif IsAlive(fish3) == true then
  36. elseif IsAlive(fish4) == true then
  37. else
  38. SetTempVariable(NPC, "fishcheck2", "1")
  39. AddTimer(NPC, 250, "fishCheck3", 1, Spawn)
  40. end
  41. end
  42. function fishCheck3(NPC, Spawn)
  43. local zone = GetZone(NPC)
  44. local fish1 = GetSpawnByLocationID(zone, 347245)
  45. local fish2 = GetSpawnByLocationID(zone, 347246)
  46. if IsAlive(fish1) == true then
  47. elseif IsAlive(fish2) == true then
  48. else
  49. SetTempVariable(NPC, "fishcheck3", "1")
  50. AddTimer(NPC, 250, "rognogCheck", 1, Spawn)
  51. end
  52. end
  53. function rognogCheck(NPC, Spawn)
  54. if GetTempVariable(NPC, "fishcheck1") == nil then
  55. elseif GetTempVariable(NPC, "fishcheck2") == nil then
  56. elseif GetTempVariable(NPC, "fishcheck3") == nil then
  57. else
  58. AddTimer(NPC, 250, "rognogStart", 1, Spawn)
  59. end
  60. end
  61. function rognogStart(NPC, Spawn)
  62. local zone = GetZone(NPC)
  63. local rognogx2 = GetSpawn(NPC, 3110002)
  64. SpawnSet(rognogx2, "attackable", "1")
  65. Attack(rognogx2, Spawn)
  66. for k,v in pairs(crabIDs) do
  67. local crab = GetSpawnByLocationID(zone, v)
  68. SpawnSet(crab, "attackable", "1")
  69. Attack(crab, Spawn)
  70. end
  71. end
  72. function respawn(NPC)
  73. spawn(NPC)
  74. end