MaltusEverling.lua 3.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128
  1. --[[
  2. Script Name : SpawnScripts/Nektropos1/MaltusEverling.lua
  3. Script Author : smash
  4. Script Date : 2018.06.07
  5. Script Purpose :
  6. :
  7. --]]
  8. function spawn(NPC)
  9. SetPlayerProximityFunction(NPC, 15, "StartSpeech", "Filler")
  10. end
  11. function Filler()
  12. end
  13. function StartSpeech(NPC, Player)
  14. if GetTempVariable(NPC, "SpeechStarted") ~= "true" then
  15. FaceTarget(NPC, Player)
  16. SetTempVariable(NPC, "SpeechStaarted", "true")
  17. Say(NPC, "Why have you come to disturb me and my family?")
  18. AddTimer(NPC, 2500, "Speech2")
  19. SetTempVariable(NPC, "TargetPlayer", Player)
  20. end
  21. end
  22. function Speech2(NPC)
  23. Say(NPC, "You enter my home without welcome or being bid to enter.")
  24. AddTimer(NPC, 2500, "Speech3")
  25. end
  26. function Speech3(NPC)
  27. Say(NPC, "Then you attack my family and slaughter them.")
  28. AddTimer(NPC, 2500, "Speech4")
  29. end
  30. function Speech4(NPC)
  31. Say(NPC, "You have destroyed most of my research subjects.")
  32. AddTimer(NPC, 2500, "Speech5")
  33. end
  34. function Speech5(NPC)
  35. Say(NPC, "But it is a minor setback. I shall recreate them from your remains.")
  36. AddTimer(NPC, 2500, "Speech6")
  37. end
  38. function Speech6(NPC)
  39. Say(NPC, "Now to harvest the parts necessary to reconstruct my family.")
  40. AddTimer(NPC, 2500, "Speech7")
  41. end
  42. function Speech7(NPC)
  43. local pet = GetSpawnByLocationID(GetZone(NPC), 616650)
  44. if pet ~= nil then
  45. SetTempVariable(NPC, "pet", pet)
  46. end
  47. Say(NPC, "I should prepare the machine now, while my creations take care of you.")
  48. MoveToLocation(NPC, 211, -16, 8.2, 2, "", true)
  49. MoveToLocation(NPC, 215, -16, 9.2, 2, "", true)
  50. MoveToLocation(NPC, 214.6, -16, 16.56, 2, "", true)
  51. MoveToLocation(NPC, 211.9, -16, 17.79, 2, "DelayedPathing")
  52. end
  53. function DelayedPathing(NPC)
  54. SetHeading(NPC, 0)
  55. AddTimer(NPC, 2500, "DoDelayedPathing")
  56. end
  57. function DoDelayedPathing(NPC)
  58. MoveToLocation(NPC, 214.6, -16, 16.56, 2, "", true)
  59. MoveToLocation(NPC, 215, -16, 9.2, 2, "", true)
  60. MoveToLocation(NPC, 211.9, -16, 9.5, 2, "Speech8")
  61. end
  62. function Speech8(NPC)
  63. SetHeading(NPC, 180)
  64. AddTimer(NPC, 2500, "DelayedSpeech")
  65. end
  66. function DelayedSpeech(NPC)
  67. Say(NPC, "What, what is happening?")
  68. local zone = GetZone(NPC)
  69. --Spawn the lightning effects
  70. SpawnByLocationID(zone, 616653)
  71. SpawnByLocationID(zone, 616654)
  72. SpawnByLocationID(zone, 1585440)
  73. AddTimer(NPC, 2500, "Speech9")
  74. end
  75. function Speech9(NPC)
  76. local player = GetTempVariable(NPC, "TargetPlayer")
  77. if player ~= nil then
  78. FaceTarget(NPC, player)
  79. end
  80. Say(NPC, "What did you do to my machine? I know this is your fault!")
  81. AddTimer(NPC, 2500, "BeginAttack")
  82. end
  83. function BeginAttack(NPC)
  84. Say(NPC, "Stop what you are doing and destroy these intruders.")
  85. SpawnSet(NPC, "attackable", "1")
  86. local player = GetTempVariable(NPC, "TargetPlayer")
  87. local pet = GetTempVariable(NPC, "pet")
  88. if pet ~= nil then
  89. SpawnSet(pet, "attackable", "1")
  90. end
  91. local zone = GetZone(NPC)
  92. local laborer1 = GetSpawnByLocationID(zone, 616652)
  93. local laborer2 = GetSpawnByLocationID(zone, 616649)
  94. SpawnSet(laborer1, "attackable", "1")
  95. SpawnSet(laborer2, "attackable", "1")
  96. SpawnSet(laborer1, "show_level", "1")
  97. SpawnSet(laborer2, "show_level", "1")
  98. if player ~= nil then
  99. Attack(NPC, player)
  100. Attack(laborer1, player)
  101. Attack(laborer2, player)
  102. SpawnSet(laborer1, "show_leve", "1")
  103. SpawnSet(laborer2, "show_level", "1")
  104. SpawnSet(NPC, "show_level", "1")
  105. end
  106. end