acrudeweapon.lua 1.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364
  1. --[[
  2. Script Name : SpawnScripts/TempleSt/acrudeweapon.lua
  3. Script Author : Dorbin
  4. Script Date : 2023.10.31 12:10:38
  5. Script Purpose :
  6. :
  7. --]]
  8. local VlepoPlan = 5917
  9. function spawn(NPC)
  10. SetRequiredQuest(NPC, VlepoPlan, 1, 1)
  11. SetTempVariable(NPC,"Callout","false")
  12. end
  13. --
  14. function casted_on(NPC, Spawn, SpellName)
  15. if SpellName == 'Attempt to steal' then
  16. local zone = GetZone(NPC)
  17. local Shinska = GetSpawnByLocationID(zone, 420479)
  18. local Guard = GetSpawnByLocationID(zone, 133787206)
  19. local GuardDistance = GetDistance(Spawn,Guard)
  20. if GetTempVariable(NPC,"Callout") ~= "true" then
  21. SetTempVariable(NPC,"Callout","true")
  22. PlayFlavor(Shinska,"","You! What yous think yous doing?! Speak to me if you want to buy weapons.","shakefist",0,0,Spawn)
  23. FaceTarget(Shinska,Spawn)
  24. AddTimer(NPC,7000,"ResetCallout",1,Spawn)
  25. if GuardDistance <=4 then
  26. GuardAttack(NPC,Spawn)
  27. AddTimer(NPC,3500,"Kick",1,Spawn)
  28. end
  29. else
  30. AddTimer(NPC,10000,"Kick",1,Spawn)
  31. PlayFlavor(Shinska,"","THIEF! Guards! Guards!!","point",0,0,Spawn)
  32. FaceTarget(Shinska,Spawn)
  33. GuardAttack(NPC,Spawn)
  34. end
  35. end
  36. end
  37. function GuardAttack(NPC,Spawn)
  38. local zone = GetZone(NPC)
  39. local Guard = GetSpawnByLocationID(zone, 133787206)
  40. Attack(Guard,Spawn)
  41. PlayFlavor(Guard,"","Stop thief!!","",0,0,Spawn)
  42. SendPopUpMessage(Spawn,"A guard has spotted you!",250,0,0)
  43. SendMessage(Spawn,"A guard has spotted you!","red")
  44. PlaySound(Spawn,"sounds/ui/ui_warning.wav", GetX(NPC), GetY(NPC), GetZ(NPC))
  45. end
  46. function Kick(NPC,Spawn)
  47. ZoneRef = GetZone("TempleSt")
  48. Zone(ZoneRef,Spawn)
  49. end
  50. function ResetCallout(NPC,Spawn)
  51. SetTempVariable(NPC,"Callout","false")
  52. end
  53. function respawn(NPC)
  54. spawn(NPC)
  55. end