TheBasaltWatcher.lua 3.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283
  1. --[[
  2. Script Name : SpawnScripts/ForestRuins/TheBasaltWatcher.lua
  3. Script Author : Dorbin
  4. Script Date : 2022.02.23 04:02:42
  5. Script Purpose : The Basalt Watcher wakeup script (THIS IS CLASSIC/OLD SCHOOL Version of activation)
  6. Version Notes: This script is the older/most dynamic setup. Updated/Live version = Always targetable but unattackable until awakened. Activates occasionally at 6:30am pre-dawn to attack Blackfurl pirates. Goes down the stairs, across the front gate, up the opposite stairs and resets to inactive. Updated is NOT KOS to players.
  7. :
  8. --]]
  9. function hailed(NPC, Spawn)
  10. end
  11. function respawn(NPC)
  12. spawn(NPC)
  13. end
  14. function spawn(NPC)
  15. SetPlayerProximityFunction(NPC, 15, "InRange", "LeaveRange")
  16. AddTimer(NPC,math.random(1260000, 2160000),"wakeup") --random activation between 12 (~21min) and 24 (37min) Norrath/in-game hours
  17. end
  18. function InRange(NCP,Spawn) --(Doesn't trigger) VERY small chance to activate when players are near
  19. if math.random(1, 100) == 1 then
  20. wakeup(NPC)
  21. end
  22. end
  23. function wakeup(NPC)
  24. local players = GetPlayersInZone(GetZone(NPC)) --zone callout and activation
  25. for index, player in pairs(players) do
  26. SendPopUpMessage(player, "Grinding stone can be heard as something ancient stirs in the ruins.", 255, 255, 0)
  27. SendMessage(player, "Grinding stone can be heard as something ancient stirs in the ruins.")
  28. end
  29. SpawnSet(NPC, "show_name", "1")
  30. SpawnSet(NPC, "targetable", "1")
  31. SpawnSet(NPC, "attackable", "1")
  32. SpawnSet(NPC, "show_level", "1")
  33. SpawnSet(NPC, "faction", "357")
  34. AddTimer(NPC,900000,"sleep") --sleep timer if not attacked after 15 min
  35. end
  36. function sleep(NPC) --return to inactive state
  37. SpawnSet(NPC, "show_name", "0")
  38. SpawnSet(NPC, "targetable", "0")
  39. SpawnSet(NPC, "attackable", "0")
  40. SpawnSet(NPC, "show_level", "0")
  41. SpawnSet(NPC, "faction", "0")
  42. AddTimer(NPC,math.random(1260000, 2160000),"wakeup") --RE-start of 'wakeup' timer, random activation between 12 (21min) and 24 (37min) Norrath/in-game hours
  43. end
  44. function aggro(NPC, Spawn)
  45. if math.random(1,100) >=40 then
  46. if HasLanguage(Spawn,27) then
  47. local choice = math.random(1, 2)
  48. if choice == 1 then
  49. PlayFlavor(NPC, "", "I will destroy you!", "", 892689932, 1216702018, Spawn, 27)
  50. else
  51. PlayFlavor(NPC, "", "Kill without mercy!", "", 704507717, 740925398, Spawn, 27)
  52. end
  53. elseif not HasLanguage(Spawn,27) then
  54. local choice = math.random(1, 2)
  55. if choice == 1 then
  56. 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)
  57. else
  58. 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)
  59. end
  60. end
  61. end
  62. end
  63. function death(NPC, Spawn)
  64. if HasLanguage(Spawn,27) then
  65. if choice == 1 then
  66. PlayFlavor(NPC, "", "I have failed!", "", 0, 0, Spawn, 27)
  67. end
  68. elseif not HasLanguage(Spawn,27) then
  69. 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)
  70. end
  71. end