eviltotem.lua 1.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566
  1. --[[
  2. Script Name : SpawnScripts/SourceEvil/eviltotem.lua
  3. Script Purpose : Handles most of the ring event in the instance
  4. Script Author : Jabantiz
  5. Script Date : 9/10/2016
  6. Script Notes :
  7. --]]
  8. local VithID = 2540005
  9. local PoisonID = 2540026
  10. local Totem1 = 475343
  11. local Totem2 = 475345
  12. local Totem3 = 1584964
  13. local Totem4 = 1584965
  14. function spawn(NPC)
  15. end
  16. function respawn(NPC)
  17. spawn(NPC)
  18. end
  19. function casted_on(NPC, Spawn, Message)
  20. if Message == "destroy totem" then
  21. SpawnSet(NPC, "show_command_icon", "0")
  22. SpawnSet(NPC, "display_hand_icon", "0")
  23. AddTimer(NPC, 1000, "Vanish")
  24. local Vith = GetSpawn(NPC, VithID)
  25. if Vith ~= nil then
  26. local choice = math.random(1, 2)
  27. if choice == 1 then
  28. PlayFlavor(Vith, "", "Don't touch those!", "", 1689589577, 4560189)
  29. else
  30. PlayFlavor(Vith, "", "No, not the totems! How did you know?", "", 1689589577, 4560189)
  31. end
  32. local locationID = GetSpawnLocationID(NPC)
  33. if locationID == Totem1 then
  34. SetTempVariable(Vith, "Totem1Destroyed", "true")
  35. elseif locationID == Totem2 then
  36. SetTempVariable(Vith, "Totem2Destroyed", "true")
  37. elseif locationID == Totem3 then
  38. SetTempVariable(Vith, "Totem3Destroyed", "true")
  39. elseif locationID == Totem4 then
  40. SetTempVariable(Vith, "Totem4Destroyed", "true")
  41. end
  42. if GetTempVariable(Vith, "Totem1Destroyed") == "true" and GetTempVariable(Vith, "Totem2Destroyed") == "true" and GetTempVariable(Vith, "Totem3Destroyed") == "true" and GetTempVariable(Vith, "Totem4Destroyed") == "true" then
  43. PlayFlavor(Vith, "", "Quite a nuisance you are. My patience is gone, prepare for my wrath!", "", 1689589577, 4560189, Spawn)
  44. AddTimer(Vith, 10000, "BeginAttack", 1, Spawn)
  45. local Poison = GetSpawn(NPC, PoisonID)
  46. if Poison ~= nil then
  47. SpawnSet(Poison, "visual_state", "0")
  48. end
  49. end
  50. end
  51. end
  52. end
  53. function Vanish(NPC)
  54. Despawn(NPC)
  55. end