aggresiveGobinvisiblecubeTreeHouse1.lua 4.8 KB

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