TheBasaltWatcher.lua 3.5 KB

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