widgetquestcrab0.lua 2.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687
  1. --[[
  2. Script Name : SpawnScripts/SunkenCity_Classic/widgetquestcrab0.lua
  3. Script Author : Dorbin
  4. Script Date : 2023.11.03 05:11:04
  5. Script Purpose :
  6. :
  7. --]]
  8. function spawn(NPC)
  9. SetTempVariable(NPC,"Crabs","false")
  10. end
  11. function casted_on(NPC, Spawn, SpellName)
  12. if SpellName == 'Examine' then
  13. if GetTempVariable(NPC,"Crabs")== "false" then
  14. SetTempVariable(NPC,"Crabs","true")
  15. SetAccessToEntityCommand(Spawn,NPC,"Examine", 0)
  16. SpawnSet(NPC, "show_command_icon", 0)
  17. SpawnSet(NPC, "display_hand_icon", 0)
  18. PlaySound(NPC,"sounds/critters/crab/crab_scream01.wav",GetX(NPC),GetY(NPC),GetZ(NPC))
  19. SendMessage(Spawn,"The table errupts as brine sifters scuttle out from underneath. They appear quite agitated!")
  20. AddTimer(NPC,1550,"CrabSpawn",1,Spawn)
  21. AddTimer(NPC,3050,"CrabAttack",1,Spawn)
  22. end
  23. AddTimer(NPC,MakeRandomInt(840000,960000),"TableReset")
  24. end
  25. end
  26. function CrabSpawn(NPC,Spawn)
  27. local zone = GetZone(NPC)
  28. local Crab1 = GetSpawnByLocationID(zone, 133787438)
  29. local Crab2 = GetSpawnByLocationID(zone, 133787439)
  30. local Crab3 = GetSpawnByLocationID(zone, 133787440)
  31. local Crab4 = GetSpawnByLocationID(zone, 133787441)
  32. if Crab1 == nil then
  33. SpawnByLocationID(zone,133787438)
  34. ApplySpellVisual(Crab2,61)
  35. end
  36. if Crab2 == nil then
  37. SpawnByLocationID(zone,133787439)
  38. ApplySpellVisual(Crab2,61)
  39. end
  40. if Crab3 == nil then
  41. SpawnByLocationID(zone,133787440)
  42. ApplySpellVisual(Crab3,61)
  43. end
  44. if Crab4 == nil then
  45. SpawnByLocationID(zone,133787441)
  46. ApplySpellVisual(Crab4,61)
  47. end
  48. end
  49. function TableReset(NPC)
  50. SetTempVariable(NPC,"Crabs","false")
  51. SetAccessToEntityCommand(Spawn,NPC,"Examine", 1)
  52. SpawnSet(NPC, "show_command_icon", 1)
  53. SpawnSet(NPC, "display_hand_icon", 1)
  54. end
  55. function respawn(NPC)
  56. spawn(NPC)
  57. end
  58. function CrabAttack(NPC,Spawn)
  59. local zone = GetZone(NPC)
  60. local Crab1 = GetSpawnByLocationID(zone, 133787438)
  61. local Crab2 = GetSpawnByLocationID(zone, 133787439)
  62. local Crab3 = GetSpawnByLocationID(zone, 133787440)
  63. local Crab4 = GetSpawnByLocationID(zone, 133787441)
  64. if Crab1 ~= nil and not IsInCombat(NPC) then
  65. ApplySpellVisual(Crab1,61)
  66. Attack(Crab1,Spawn)
  67. end
  68. if Crab2 ~= nil and not IsInCombat(NPC) then
  69. ApplySpellVisual(Crab2,61)
  70. Attack(Crab2,Spawn)
  71. end
  72. if Crab3 ~= nil and not IsInCombat(NPC) then
  73. ApplySpellVisual(Crab3,61)
  74. Attack(Crab3,Spawn)
  75. end
  76. if Crab4 ~= nil and not IsInCombat(NPC) then
  77. ApplySpellVisual(Crab4,61)
  78. Attack(Crab4,Spawn)
  79. end
  80. end