acuriousrock.lua 2.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182
  1. --[[
  2. Script Name : SpawnScripts/Caves/acuriousrock.lua
  3. Script Author : Dorbin
  4. Script Date : 2022.10.13 07:10:20
  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 <= 33 then
  25. SendMessage(Spawn,"You've found something inside the rock!")
  26. local LootChoice = MakeRandomInt(1,17)
  27. if LootChoice == 1 then
  28. SummonItem(Spawn,1619,1) --a dull mineral cluster
  29. elseif LootChoice == 2 then
  30. SummonItem(Spawn,164540,1) --miner's ring
  31. elseif LootChoice == 3 then
  32. SummonItem(Spawn,5489,1) -- copper cluster
  33. elseif LootChoice == 4 then
  34. SummonItem(Spawn,4689,1) -- bronze cluster
  35. elseif LootChoice == 5 then
  36. SummonItem(Spawn,138927,1) --circlet of hardened sand
  37. elseif LootChoice == 6 then
  38. SummonItem(Spawn,11703,3) --rough malachite
  39. elseif LootChoice == 7 then
  40. SummonItem(Spawn,13585,1) --sundered obsidian
  41. elseif LootChoice == 8 then
  42. SummonItem(Spawn,14463,3) -- tin cluster
  43. elseif LootChoice == 9 then
  44. SummonItem(Spawn,14463,3) -- tin clusterx2
  45. elseif LootChoice == 10 then
  46. SummonItem(Spawn,11703,3) --rough malachitex2
  47. elseif LootChoice == 11 then
  48. SummonItem(Spawn,13585,1) --sundered obsidianx2
  49. elseif LootChoice == 12 then
  50. SummonItem(Spawn,14463,3) -- tin clusterx2
  51. elseif LootChoice == 13 then
  52. SummonItem(Spawn,164540,1) --miner's ringx2
  53. elseif LootChoice == 14 then
  54. SummonItem(Spawn,164540,1) --miner's ringx3
  55. end
  56. else
  57. SendMessage(Spawn,"The rock crumbles into fragments, but there is nothing inside.")
  58. end
  59. AddTimer(NPC,500,"Collapse")
  60. AddTimer(NPC,2000,"Despawning")
  61. end
  62. end
  63. function Collapse(NPC)
  64. SpawnSet(NPC,"model_type",2501)
  65. PlaySound(NPC,"sounds/widgets/chests/chest_smash001.wav", GetX(NPC), GetY(NPC), GetZ(NPC))
  66. end
  67. function Despawning(NPC,Spawn)
  68. SpawnSet(NPC,"visual_state",0)
  69. Despawn(NPC)
  70. end
  71. function respawn(NPC)
  72. spawn(NPC)
  73. end