9
3

agnollishchest.lua 1.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566
  1. --[[
  2. Script Name : SpawnScripts/Caves/agnollishchest.lua
  3. Script Author : Dorbin
  4. Script Date : 2022.10.10 06:10:17
  5. Script Purpose :
  6. :
  7. --]]
  8. function spawn(NPC)
  9. end
  10. function casted_on(NPC, Spawn, Message)
  11. if Message == "smash" then
  12. SetAccessToEntityCommand(Spawn,NPC,"smash", 0)
  13. SpawnSet(NPC, "show_command_icon", 0)
  14. SpawnSet(NPC, "display_hand_icon", 0)
  15. if IsStealthed(Spawn) then
  16. -- RemoveStealth(NPC,Spawn)
  17. end
  18. if IsInvis(Spawn) then
  19. -- RemoveInvis(NPC,Spawn)
  20. end
  21. PlayFlavor(Spawn,"","","kick",0,0)
  22. SpawnSet(NPC,"visual_state",4164)
  23. local choice = MakeRandomInt(1,100)
  24. if choice <= 40 then
  25. SendMessage(Spawn,"You've found something inside the chest!")
  26. local LootChoice = MakeRandomInt(1,5)
  27. if LootChoice == 1 then
  28. SummonItem(Spawn,1667,1) --Finely crafted mask
  29. elseif LootChoice == 2 then
  30. SummonItem(Spawn,164540,1) --miner's ring
  31. elseif LootChoice == 3 then
  32. SummonItem(Spawn,179206,1) -- silt wrought sandals
  33. elseif LootChoice == 4 then
  34. SummonItem(Spawn,4963,1) -- Gnoll language threat totem
  35. elseif LootChoice == 5 then
  36. SummonItem(Spawn,138927,1) --circlet of hardened sand
  37. end
  38. else
  39. SendMessage(Spawn,"The chest smashes into tiny pieces, but there is nothing inside.")
  40. end
  41. AddTimer(NPC,500,"Collapse")
  42. AddTimer(NPC,2000,"Despawning")
  43. end
  44. end
  45. function Collapse(NPC)
  46. SpawnSet(NPC,"model_type",2501)
  47. PlaySound(NPC,"sounds/widgets/chests/chest_smash001.wav", GetX(NPC), GetY(NPC), GetZ(NPC))
  48. end
  49. function Despawning(NPC,Spawn)
  50. SpawnSet(NPC,"visual_state",0)
  51. Despawn(NPC)
  52. end
  53. function respawn(NPC)
  54. spawn(NPC)
  55. end