TheBasaltWatcher.lua 3.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081
  1. --[[
  2. Script Name : SpawnScripts/Classic_forest/TheBasaltWatcher.lua
  3. Script Author : Dorbin
  4. Script Date : 2022.10.11 04:10:38
  5. Script Purpose : Classic Version of the basalt watcher
  6. :
  7. --]]
  8. function hailed(NPC, Spawn)
  9. end
  10. function respawn(NPC)
  11. spawn(NPC)
  12. end
  13. function spawn(NPC)
  14. SetPlayerProximityFunction(NPC, 15, "InRange", "LeaveRange")
  15. AddTimer(NPC,math.random(1260000, 2160000),"wakeup") --random activation between 12 (~21min) and 24 (37min) Norrath/in-game hours
  16. end
  17. function InRange(NCP,Spawn) --(Doesn't trigger) VERY small chance to activate when players are near
  18. if math.random(1, 100) == 1 then
  19. wakeup(NPC)
  20. end
  21. end
  22. function wakeup(NPC)
  23. local players = GetPlayersInZone(GetZone(NPC)) --zone callout and activation
  24. for index, player in pairs(players) do
  25. SendPopUpMessage(player, "Grinding stone can be heard as something ancient stirs in the ruins.", 255, 255, 0)
  26. SendMessage(player, "Grinding stone can be heard as something ancient stirs in the ruins.","yellow")
  27. end
  28. SpawnSet(NPC, "show_name", "1")
  29. SpawnSet(NPC, "targetable", "1")
  30. SpawnSet(NPC, "attackable", "1")
  31. SpawnSet(NPC, "show_level", "1")
  32. SpawnSet(NPC, "faction", "1")
  33. AddTimer(NPC,900000,"sleep") --sleep timer if not attacked after 15 min
  34. end
  35. function sleep(NPC) --return to inactive state
  36. SpawnSet(NPC, "show_name", "0")
  37. SpawnSet(NPC, "targetable", "0")
  38. SpawnSet(NPC, "attackable", "0")
  39. SpawnSet(NPC, "show_level", "0")
  40. SpawnSet(NPC, "faction", "0")
  41. AddTimer(NPC,math.random(1260000, 2160000),"wakeup") --RE-start of 'wakeup' timer, random activation between 12 (21min) and 24 (37min) Norrath/in-game hours
  42. end
  43. function aggro(NPC, Spawn)
  44. if math.random(1,100) >=40 then
  45. if HasLanguage(Spawn,27) then
  46. local choice = math.random(1, 2)
  47. if choice == 1 then
  48. PlayFlavor(NPC, "", "I will destroy you!", "", 892689932, 1216702018, Spawn, 27)
  49. else
  50. PlayFlavor(NPC, "", "Kill without mercy!", "", 704507717, 740925398, Spawn, 27)
  51. end
  52. elseif not HasLanguage(Spawn,27) then
  53. local choice = math.random(1, 2)
  54. if choice == 1 then
  55. PlayFlavor(NPC, "voiceover/english/elemental_earth_base_1/ft/elemental/elemental_earth_base_1_1_garbled_7c1e7a03.mp3", "I will destroy these intruders!", "", 2956610216, 1562072254, Spawn, 27)
  56. else
  57. PlayFlavor(NPC, "voiceover/english/elemental_earth_base_1/ft/elemental/elemental_earth_base_1_1_garbled_e0fead4d.mp3", "I will destroy you!", "", 892689932, 1216702018, Spawn, 27)
  58. end
  59. end
  60. end
  61. end
  62. function death(NPC, Spawn)
  63. if HasLanguage(Spawn,27) then
  64. if choice == 1 then
  65. PlayFlavor(NPC, "", "I have failed!", "", 0, 0, Spawn, 27)
  66. end
  67. elseif not HasLanguage(Spawn,27) then
  68. PlayFlavor(NPC, "voiceover/english/elemental_earth_base_1/ft/elemental/elemental_earth_base_1_1_garbled_fc50550a.mp3", "I have failed!", "", 704507717, 740925398, Spawn, 27)
  69. end
  70. end