RotweedInvisCurbe.lua 3.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485
  1. --[[
  2. Script Name : SpawnScripts/Oakmyst_Classic/RotweedInvisCurbe.lua (Lol, typo)
  3. Script Author : Dorbin
  4. Script Date : 2022.10.21 12:10:53
  5. Script Purpose : Facilitates Rotweed Encounter for 'Destroy the Corruption' in Oakmyst Forest. SpawnLocationID(133779141), SpawnID (8300054)
  6. Note: Renamed: a lingering corruption
  7. :
  8. --]]
  9. function spawn(NPC)
  10. SetPlayerProximityFunction(NPC, 5, "InRange", "LeaveRange")
  11. end
  12. function respawn(NPC)
  13. spawn(NPC)
  14. end
  15. function InRange(NPC,Spawn)
  16. local zone = GetZone(NPC)
  17. local Thistle1 = GetSpawnByLocationID(zone, 133779137)
  18. local Thistle2 = GetSpawnByLocationID(zone, 133779138)
  19. local Thistle3 = GetSpawnByLocationID(zone, 133779139)
  20. local Rotweed = GetSpawnByLocationID(zone, 133779140)
  21. if HasQuest(Spawn, 230) and GetQuestStep(Spawn,230)==1 and Rotweed ==nil and Thistle1 ~=nil and Thistle2 ~=nil and Thistle3 ~=nil then
  22. SpawnSet(Thistle1, "model_type", "274")
  23. SpawnSet(Thistle1, "show_name", "1")
  24. SpawnSet(Thistle1, "targetable", "1")
  25. SpawnSet(Thistle1, "attackable", "1")
  26. SpawnSet(Thistle1, "show_level", "1")
  27. SpawnSet(Thistle1, "faction", "1")
  28. SpawnSet(Thistle1, "name", "Rotweed Thistle")
  29. SpawnSet(Thistle2, "model_type", "274")
  30. SpawnSet(Thistle2, "show_name", "1")
  31. SpawnSet(Thistle2, "targetable", "1")
  32. SpawnSet(Thistle2, "attackable", "1")
  33. SpawnSet(Thistle2, "show_level", "1")
  34. SpawnSet(Thistle2, "faction", "1")
  35. SpawnSet(Thistle2, "name", "Rotweed Thistle")
  36. SpawnSet(Thistle3, "model_type", "274")
  37. SpawnSet(Thistle3, "show_name", "1")
  38. SpawnSet(Thistle3, "targetable", "1")
  39. SpawnSet(Thistle3, "attackable", "1")
  40. SpawnSet(Thistle3, "show_level", "1")
  41. SpawnSet(Thistle3, "faction", "1")
  42. SpawnSet(Thistle3, "name", "Rotweed Thistle")
  43. AddTimer(NPC,1000,"AttackPlayer",1,Spawn)
  44. AddTimer(NPC,6000,"RotweedCheck",1,Spawn)
  45. end
  46. end
  47. function AttackPlayer(NPC,Spawn) --THISTLES ATTACK
  48. local zone = GetZone(NPC)
  49. local Thistle1 = GetSpawnByLocationID(zone, 133779137)
  50. local Thistle2 = GetSpawnByLocationID(zone, 133779138)
  51. local Thistle3 = GetSpawnByLocationID(zone, 133779139)
  52. Attack(Thistle1,Spawn)
  53. Attack(Thistle2,Spawn)
  54. Attack(Thistle3,Spawn)
  55. end
  56. function RotweedCheck(NPC,Spawn)
  57. local zone = GetZone(NPC)
  58. local Thistle1 = GetSpawnByLocationID(zone, 133779137)
  59. local Thistle2 = GetSpawnByLocationID(zone, 133779138)
  60. local Thistle3 = GetSpawnByLocationID(zone, 133779139)
  61. local Rotweed = GetSpawnByLocationID(zone, 133779140)
  62. if GetSpawnByLocationID(zone, 133779141) ~=nil then --CHECKS FOR INVIS CUBE
  63. if not IsAlive(Thistle1) and not IsInCombat(Thistle1) and not IsAlive(Thistle2) and not IsInCombat(Thistle2) and not IsAlive(Thistle3) and not IsInCombat(Thistle3) and Rotweed == nil then
  64. SpawnByLocationID(zone, 133779140) --SPAWNS ROTWEED
  65. AddTimer(NPC,1500,"AttackPlayer2",1,Spawn)
  66. else
  67. AddTimer(NPC,6000,"RotweedCheck",1,Spawn) --RESETS CHECK UNTIL THISTLES ARE GONE
  68. end
  69. end
  70. end
  71. function AttackPlayer2(NPC,Spawn) --ROTWEED ATTACKS
  72. local zone = GetZone(NPC)
  73. local Rotweed = GetSpawnByLocationID(zone, 133779140)
  74. Attack(Rotweed,Spawn)
  75. end