9
3

TheBasaltWatcher.lua 3.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586
  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. require "SpawnScripts/Generic/NPCModule"
  9. function hailed(NPC, Spawn)
  10. end
  11. function respawn(NPC)
  12. spawn(NPC)
  13. end
  14. function spawn(NPC, Spawn)
  15. dmgMod = GetStr(NPC)/10
  16. Named(NPC)
  17. SetPlayerProximityFunction(NPC, 15, "InRange", "LeaveRange")
  18. AddTimer(NPC,math.random(1260000, 2160000),"wakeup") --random activation between 12 (~21min) and 24 (37min) Norrath/in-game hours
  19. SetInfoStructUInt(NPC, "override_primary_weapon", 1)
  20. SetInfoStructUInt(NPC, "primary_weapon_damage_low", math.floor(30 + dmgMod))
  21. SetInfoStructUInt(NPC, "primary_weapon_damage_high", math.floor(60 + dmgMod))
  22. end
  23. function InRange(NCP,Spawn) --(Doesn't trigger) VERY small chance to activate when players are near
  24. if math.random(1, 100) == 1 then
  25. wakeup(NPC)
  26. end
  27. end
  28. function wakeup(NPC)
  29. local players = GetPlayersInZone(GetZone(NPC)) --zone callout and activation
  30. for index, player in pairs(players) do
  31. SendPopUpMessage(player, "Grinding stone can be heard as something ancient stirs in the ruins.", 255, 255, 0)
  32. SendMessage(player, "Grinding stone can be heard as something ancient stirs in the ruins.","yellow")
  33. end
  34. SpawnSet(NPC, "show_name", "1")
  35. SpawnSet(NPC, "targetable", "1")
  36. SpawnSet(NPC, "attackable", "1")
  37. SpawnSet(NPC, "show_level", "1")
  38. SpawnSet(NPC, "faction", "1")
  39. AddTimer(NPC,900000,"sleep") --sleep timer if not attacked after 15 min
  40. end
  41. function sleep(NPC) --return to inactive state
  42. SpawnSet(NPC, "show_name", "0")
  43. SpawnSet(NPC, "targetable", "0")
  44. SpawnSet(NPC, "attackable", "0")
  45. SpawnSet(NPC, "show_level", "0")
  46. SpawnSet(NPC, "faction", "0")
  47. AddTimer(NPC,math.random(1260000, 2160000),"wakeup") --RE-start of 'wakeup' timer, random activation between 12 (21min) and 24 (37min) Norrath/in-game hours
  48. end
  49. function aggro(NPC, Spawn)
  50. if math.random(1,100) >=40 then
  51. if HasLanguage(Spawn,27) then
  52. local choice = math.random(1, 2)
  53. if choice == 1 then
  54. PlayFlavor(NPC, "", "I will destroy you!", "", 892689932, 1216702018, Spawn, 27)
  55. else
  56. PlayFlavor(NPC, "", "Kill without mercy!", "", 704507717, 740925398, Spawn, 27)
  57. end
  58. elseif not HasLanguage(Spawn,27) then
  59. local choice = math.random(1, 2)
  60. if choice == 1 then
  61. 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)
  62. else
  63. 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)
  64. end
  65. end
  66. end
  67. end
  68. function death(NPC, Spawn)
  69. if HasLanguage(Spawn,27) then
  70. if choice == 1 then
  71. PlayFlavor(NPC, "", "I have failed!", "", 0, 0, Spawn, 27)
  72. end
  73. elseif not HasLanguage(Spawn,27) then
  74. 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)
  75. end
  76. end