9
3

asuspiciousbarrel.lua 2.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788
  1. --[[
  2. Script Name : SpawnScripts/WayfarersRest/asuspiciousbarrel.lua
  3. Script Author : Dorbin
  4. Script Date : 2023.09.23 02:09:10
  5. Script Purpose :
  6. :
  7. --]]
  8. function spawn(NPC)
  9. SetPlayerProximityFunction(NPC, 4, "InRange", "LeaveRange")
  10. SetTempVariable(NPC,"Proxy",nil)
  11. end
  12. function InRange(NPC, Spawn)
  13. if GetTempVariable(NPC,"Proxy") == nil then
  14. Shimmer(NPC,Spawn)
  15. end
  16. end
  17. function Shimmer(NPC,Spawn)
  18. SendMessage(Spawn,"The stacked barrels and crate blur as you approach.","white")
  19. SendPopUpMessage(Spawn,"The stacked barrels and crate blur as you approach.",100,100,175)
  20. SetTempVariable(NPC,"Proxy",1)
  21. local zone = GetZone(NPC)
  22. local Crate = (GetSpawnByLocationID(zone,133786871))
  23. local Barrel = (GetSpawnByLocationID(zone,133786873))
  24. PlayFlavor(NPC,"","","result_distort_hit",0,0)
  25. PlayFlavor(Crate,"","","result_distort_hit",0,0)
  26. PlayFlavor(Barrel,"","","result_distort_hit",0,0)
  27. SpawnSet(NPC,"show_command_icon",1)
  28. SpawnSet(NPC,"display_hand_icon",1)
  29. SpawnSet(Crate,"show_command_icon",1)
  30. SpawnSet(Crate,"display_hand_icon",1)
  31. SpawnSet(Barrel,"show_command_icon",1)
  32. SpawnSet(Barrel,"display_hand_icon",1)
  33. AddPrimaryEntityCommand(Spawn,NPC,"Inspect",10000,"Inspect")
  34. AddPrimaryEntityCommand(Spawn,Crate,"Inspect",10000,"Inspect")
  35. AddPrimaryEntityCommand(Spawn,Barrel,"Inspect",10000,"Inspect")
  36. SendUpdateDefaultCommand(NPC,10000,"Inspect")
  37. SendUpdateDefaultCommand(Crate,10000,"Inspect")
  38. SendUpdateDefaultCommand(Barrel,10000,"Inspect")
  39. end
  40. function casted_on(NPC, Spawn, Message)
  41. local zone = GetZone(NPC)
  42. local Crate = (GetSpawnByLocationID(zone,133786871))
  43. local Barrel = (GetSpawnByLocationID(zone,133786873))
  44. if Message == "Inspect" then
  45. if Crate ~= nil then
  46. PlayFlavor(Crate,"","","result_dispell1_out",0,0)
  47. AddTimer(Crate,1500,"Despawning")
  48. end
  49. if Barrel ~= nil then
  50. PlayFlavor(Barrel,"","","result_dispell1_out",0,0)
  51. AddTimer(Barrel,1500,"Despawning")
  52. end
  53. if NPC ~= nil then
  54. PlayFlavor(NPC,"","","result_dispell1_out",0,0)
  55. AddTimer(NPC,1500,"Despawning")
  56. end
  57. end
  58. end
  59. function Despawning(NPC,Spawn)
  60. local zone = GetZone(NPC)
  61. local Crate = (GetSpawnByLocationID(zone,133786871))
  62. local Barrel = (GetSpawnByLocationID(zone,133786873))
  63. local Wall = (GetSpawnByLocationID(zone,133786875))
  64. if Crate ~= nil then
  65. Despawn(Crate)
  66. end
  67. if Barrel ~= nil then
  68. Despawn(Barrel)
  69. end
  70. if NPC ~= nil then
  71. Despawn(NPC)
  72. if Wall ~= nil then
  73. Despawn(Wall)
  74. end
  75. end
  76. end
  77. function respawn(NPC)
  78. spawn(NPC)
  79. end