aggresiveGobinvisiblecubeTreeHouse1.lua 4.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144
  1. --[[
  2. Script Name : SpawnScripts/IsleRefuge1/aggresiveGobinvisiblecubeTreeHouse1.lua
  3. Script Author : Dorbin
  4. Script Date : 2022.09.17 11:09:02
  5. Script Purpose :
  6. :
  7. --]]
  8. function spawn(NPC)
  9. Cage4(NPC, Spawn)
  10. end
  11. function respawn(NPC)
  12. spawn(NPC)
  13. end
  14. function Cage4(NPC, Spawn)
  15. local zone = GetZone(NPC)
  16. local Goblin1 = SpawnByLocationID(zone, 133775719) --Goblin1
  17. local Goblin2 = SpawnByLocationID(zone, 133775720) --Goblin1
  18. AddTimer(NPC,3500,"GobLiveCheck")
  19. end
  20. function GobLiveCheck(NPC, Spawn)
  21. local zone = GetZone(NPC)
  22. local Goblin1 = GetSpawnByLocationID(zone, 133775719) --Goblin1
  23. local Goblin2 = GetSpawnByLocationID(zone, 133775720) --Goblin1
  24. local Refugee = GetSpawnByLocationID(zone, 133775727) --Refugee
  25. if IsAlive(Goblin1) ==false and IsAlive(Goblin2) ==false then
  26. if Refugee~=nil then
  27. waypoints(NPC,Spawn)
  28. SpawnSet(Refugee,"mood_state",0)
  29. SpawnSet(Refugee,"initial_state",16512)
  30. AddTimer(NPC,2000,"ThankYou")
  31. AddTimer(NPC,15000,"DespawnTimer",1,Refugee)
  32. end
  33. else
  34. AddTimer(NPC,6000,"GobLiveCheck")
  35. choice = MakeRandomInt(1,10)
  36. if choice == 1 then
  37. PlayFlavor(Refugee, "", "", "cringe",0,0)
  38. elseif choice == 2 then
  39. PlayFlavor(Refugee, "", "", "tantrum_short",0,0)
  40. elseif choice == 3 then
  41. PlayFlavor(Refugee, "", "", "sigh",0,0)
  42. elseif choice == 4 then
  43. PlayFlavor(Refugee, "", "", "squeal",0,0)
  44. elseif choice == 5 then
  45. PlayFlavor(Refugee, "", "", "threten",0,0)
  46. elseif choice == 6 then
  47. PlayFlavor(Refugee, "", "", "wince",0,0)
  48. elseif choice == 7 then
  49. PlayFlavor(Refugee, "", "", "crazy",0,0)
  50. elseif choice == 8 then
  51. PlayFlavor(Refugee, "", "", "pout",0,0)
  52. elseif choice == 9 then
  53. PlayFlavor(Refugee, "", "", "frustrated",0,0)
  54. elseif choice == 10 then
  55. PlayFlavor(Refugee, "", "", "sulk",0,0)
  56. end
  57. end
  58. end
  59. function waypoints(NPC,Spawn)
  60. local zone = GetZone(NPC)
  61. local Refugee = GetSpawnByLocationID(zone, 133775727) --Refugee
  62. local x=GetX(NPC)
  63. local y=GetY(NPC)
  64. local z=GetZ(NPC)
  65. PlaySound(NPC, "sounds/widgets/doors/door_metal_slam001.wav", GetX(NPC), GetY(NPC), GetZ(NPC))
  66. MovementLoopAddLocation(Refugee, x, y, z, 4, 1)
  67. MovementLoopAddLocation(Refugee, x, y, z, 4, 6,"ThankYou")
  68. MovementLoopAddLocation(Refugee, x, y, z, 4, 0)
  69. MovementLoopAddLocation(Refugee, -72.64, 2.31, -172.96, 4, 0)
  70. MovementLoopAddLocation(Refugee, -67.83, 2.09, -175.00, 4, 0)
  71. MovementLoopAddLocation(Refugee, -55.47, 2.10, -167.74, 4, 0,"DespawnTimer")
  72. MovementLoopAddLocation(Refugee, -51.07, 2.03, -155.3, 4, 0)
  73. MovementLoopAddLocation(Refugee, -58.84, 2.47, -136.94, 4, 0)
  74. MovementLoopAddLocation(Refugee, -73.15, 4.10, -131.35, 4, 0)
  75. MovementLoopAddLocation(Refugee, -78.35, 4.31, -106.29, 4, 0)
  76. MovementLoopAddLocation(Refugee, -85.59, 4.39, -88.34, 4, 0)
  77. MovementLoopAddLocation(Refugee, -90.67, 5.88, -79.50, 4, 0)
  78. MovementLoopAddLocation(Refugee,-92.94, 5.43, -67.58, 4, 0)
  79. MovementLoopAddLocation(Refugee, -94.12, -9.04, -38.63, 4, 0)
  80. MovementLoopAddLocation(Refugee, -85.31, -11.73, -4.94, 4, 0)
  81. MovementLoopAddLocation(Refugee, -72.75, -8.70, 29.3, 4, 0)
  82. MovementLoopAddLocation(Refugee, -69.56, -7.11, 42.6, 4, 0)
  83. MovementLoopAddLocation(Refugee, -67.84, -8.05, 58.29, 4, 1)
  84. MovementLoopAddLocation(Refugee, -67.84, -8.05, 58.29, 4, 6,"ThankYou")
  85. MovementLoopAddLocation(Refugee, -67.84, -8.05, 58.29, 4, 30,"Despawn")
  86. MovementLoopAddLocation(Refugee, -67.84, -8.05, 58.29, 4, 0)
  87. end
  88. function ThankYou(NPC,Spawn)
  89. local zone = GetZone(NPC)
  90. local Refugee = GetSpawnByLocationID(zone, 133775727) --Refugee
  91. SpawnSet(Refugee,"name","a liberated refugee")
  92. SpawnSet(Refugee,"faction","34")
  93. SpawnSet(Refugee,"hp","45")
  94. SpawnSet(Refugee,"power","45")
  95. SpawnSet(Refugee,"aggro_radius","3")
  96. FaceTarget(Refugee,Spawn)
  97. choice = MakeRandomInt(1,4)
  98. if choice == 1 then
  99. PlayFlavor(Refugee, "", "", "thanks",0,0)
  100. elseif choice == 2 then
  101. PlayFlavor(Refugee, "", "", "bow",0,0)
  102. elseif choice == 3 then
  103. PlayFlavor(Refugee, "", "", "notworthy",0,0)
  104. elseif choice == 4 then
  105. PlayFlavor(Refugee, "", "", "cheer",0,0)
  106. end
  107. end
  108. function ThankYou2(NPC,Spawn)
  109. local zone = GetZone(NPC)
  110. local Refugee = GetSpawnByLocationID(zone, 133775727) --Refugee
  111. PlayFlavor(Refugee, "", "", "notworthy",0,0)
  112. end
  113. function DespawnTimer(NPC)
  114. local zone = GetZone(NPC)
  115. local Refugee = GetSpawnByLocationID(zone, 133775727) --Refugee
  116. if Refugee ~=nil and IsAlive(Refugee)== true then
  117. AddTimer(NPC,10000,"DespawnTimer")
  118. else
  119. Despawn(NPC)
  120. end
  121. end
  122. function Despawn(NPC)
  123. local zone = GetZone(NPC)
  124. local Refugee = GetSpawnByLocationID(zone, 133775727) --Refugee
  125. Despawn(Refugee)
  126. Despawn(NPC)
  127. end