9
3

ExpelNonCitizen.lua 3.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596
  1. --[[
  2. Script Name : SpawnScripts/Generic/ExpelNonCitizen.lua
  3. Script Author : Dorbin
  4. Script Date : 2022.11.03 01:11:17
  5. Script Purpose :
  6. :
  7. --]]
  8. function NonCitizen(NPC,Spawn)
  9. Qfaction = GetFactionAmount(Spawn,11)
  10. FPfaction = GetFactionAmount(Spawn,12)
  11. local zone = GetZone(NPC)
  12. if GetZoneID(zone) >= 220 and GetZoneID(zone) <= 238 then -- clarifies which zone is designated EVIL or GOOD
  13. GOOD = true
  14. elseif GetZoneID(zone) == 207 then
  15. GOOD = true
  16. elseif GetZoneID(zone) >= 195 and GetZoneID(zone) <= 198 then
  17. GOOD = true
  18. elseif GetZoneID(zone) == 589 or GetZoneID(zone) == 660 then
  19. GOOD = true
  20. elseif GetZoneID(zone) == 470 then
  21. GOOD = true
  22. elseif GetZoneID(zone) == 45 then
  23. NEUTRAL = true
  24. elseif GetZoneID(zone) >= 124 and GetZoneID(zone) <= 128 then
  25. EVIL = true
  26. elseif GetZoneID(zone) >= 134 and GetZoneID(zone)<= 168 then
  27. EVIL = true
  28. end
  29. if GOOD and GetFactionAmount(Spawn,11) >0 then
  30. if not HasCompletedQuest(Spawn,5718) and not HasCompletedQuest(Spawn,5719) and not HasCompletedQuest(Spawn,5720) and not HasCompletedQuest(Spawn,5721) and not HasCompletedQuest(Spawn,5722) and not HasCompletedQuest(Spawn,5723) then
  31. Attack(NPC,Spawn)
  32. AddTimer(NPC,500,"Expel",1,Spawn)
  33. SendMessage(Spawn,"A guard has spotted you!","red")
  34. PlaySound(Spawn,"sounds/ui/ui_warning.wav", GetX(NPC), GetY(NPC), GetZ(NPC))
  35. end
  36. end
  37. end
  38. function Expel(NPC,Spawn)
  39. if IsInCombat(NPC) then
  40. AddTimer(NPC,500,"Expel",1,Spawn)
  41. if GetDistance(Spawn,NPC) <=6 then
  42. CastSpell(NPC,1225)
  43. PlayAnimation(Spawn,11764)
  44. ExpeltoHood(NPC,Spawn)
  45. SetInvulnerable(Spawn)
  46. SendPopUpMessage(Spawn,"Refugee! You are not allowed inside the walls of Qeynos!",250,0,0)
  47. SendMessage(Spawn,"Refugee! You are not allowed inside the walls of Qeynos!","red")
  48. PlaySound(Spawn,"sounds/ui/ui_duel_defeat.wav", GetX(NPC), GetY(NPC), GetZ(NPC))
  49. SetHP(Spawn,SetMaxHP(Spawn))
  50. end
  51. end
  52. end
  53. function ExpeltoHood(NPC,Spawn)
  54. local Race = GetRace(Spawn)
  55. -- Kerra
  56. if Race == 11 or Race == 9 then
  57. ZoneRef = GetZone("Nettleville")
  58. Zone(ZoneRef,Spawn)
  59. -- Erudite
  60. elseif Race == 3 or Race == 20 then
  61. ZoneRef = GetZone("Starcrest")
  62. Zone(ZoneRef,Spawn)
  63. -- Barbarian / Dwarf
  64. elseif Race == 0 or Race == 2 then
  65. ZoneRef = GetZone("Graystone")
  66. Zone(ZoneRef,Spawn)
  67. -- Froglok / High Elf
  68. elseif Race == 4 or Race == 8 then
  69. ZoneRef = GetZone("Castleview")
  70. Zone(ZoneRef,Spawn)
  71. -- Half Elf / Wood Elf
  72. elseif Race == 6 or Race == 15 then
  73. ZoneRef = GetZone("Willowwood")
  74. Zone(ZoneRef,Spawn)
  75. -- Gnome / Halfling
  76. elseif Race == 5 or Race == 7 then
  77. ZoneRef = GetZone("Baubbleshire")
  78. Zone(ZoneRef,Spawn)
  79. else
  80. ZoneRef = GetZone("Nettleville")
  81. Zone(ZoneRef,Spawn)
  82. end
  83. end