aggresiveGobinvisiblecube.lua 3.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110
  1. --[[
  2. Script Name : SpawnScripts/IsleRefuge1/aggresiveGobinvisiblecube.lua
  3. Script Author : Dorbin
  4. Script Date : 2022.09.08 02:09:19
  5. Script Purpose : Handle's goblin aggressor spawns & refugees on Isle of Refuge
  6. :
  7. --]]
  8. function spawn(NPC)
  9. Cage1(NPC, Spawn)
  10. end
  11. function respawn(NPC)
  12. spawn(NPC)
  13. end
  14. function Cage1(NPC, Spawn)
  15. local zone = GetZone(NPC)
  16. local Goblin1 = GetSpawnByLocationID(zone, 133775211) --Goblin1
  17. if IsAlive(Goblin1)== false or Goblin1 == nil then
  18. SpawnByLocationID(zone, 133775211) --Goblin1
  19. end
  20. AddTimer(NPC,3500,"GobLiveCheck")
  21. end
  22. function GobLiveCheck(NPC, Spawn)
  23. local zone = GetZone(NPC)
  24. local Goblin1 = GetSpawnByLocationID(zone, 133775211) --Goblin1
  25. local Refugee = GetSpawnByLocationID(zone, 133775246) --Refugee
  26. if IsAlive(Goblin1) ==false then
  27. if Refugee~=nil then
  28. waypoints(NPC,Spawn)
  29. SpawnSet(Refugee,"mood_state",0)
  30. SpawnSet(Refugee,"initial_state",16512)
  31. AddTimer(NPC,2000,"ThankYou")
  32. AddTimer(NPC,15000,"DespawnTimer",1,Refugee)
  33. end
  34. else
  35. AddTimer(NPC,6000,"GobLiveCheck")
  36. choice = MakeRandomInt(1,10)
  37. if choice == 1 then
  38. PlayFlavor(Refugee, "", "", "cringe",0,0)
  39. elseif choice == 2 then
  40. PlayFlavor(Refugee, "", "", "tantrum_short",0,0)
  41. elseif choice == 3 then
  42. PlayFlavor(Refugee, "", "", "sigh",0,0)
  43. elseif choice == 4 then
  44. PlayFlavor(Refugee, "", "", "squeal",0,0)
  45. elseif choice == 5 then
  46. PlayFlavor(Refugee, "", "", "threten",0,0)
  47. elseif choice == 6 then
  48. PlayFlavor(Refugee, "", "", "wince",0,0)
  49. elseif choice == 7 then
  50. PlayFlavor(Refugee, "", "", "crazy",0,0)
  51. elseif choice == 8 then
  52. PlayFlavor(Refugee, "", "", "pout",0,0)
  53. elseif choice == 9 then
  54. PlayFlavor(Refugee, "", "", "frustrated",0,0)
  55. elseif choice == 10 then
  56. PlayFlavor(Refugee, "", "", "sulk",0,0)
  57. end
  58. end
  59. end
  60. function waypoints(NPC,Spawn)
  61. local zone = GetZone(NPC)
  62. local Refugee = GetSpawnByLocationID(zone, 133775246) --Refugee
  63. local x=GetX(NPC)
  64. local y=GetY(NPC)
  65. local z=GetZ(NPC)
  66. PlaySound(NPC, "sounds/widgets/doors/door_metal_slam001.wav", GetX(NPC), GetY(NPC), GetZ(NPC))
  67. MovementLoopAddLocation(Refugee, x, y, z, 4, 1)
  68. MovementLoopAddLocation(Refugee, x, y, z, 4, 6,"ThankYou")
  69. MovementLoopAddLocation(Refugee, x, y, z, 4, 0)
  70. MovementLoopAddLocation(Refugee, 282.81, -4.21, 0.39, 4, 0)
  71. MovementLoopAddLocation(Refugee, 270.8, -4.25, 2.77, 4, 0)
  72. MovementLoopAddLocation(Refugee, 261.68, -4.09, 1.95, 4, 0)
  73. MovementLoopAddLocation(Refugee, 253.4, -3.93, 1.41, 4, 0,"DespawnTimer")
  74. MovementLoopAddLocation(Refugee, 252.05, -3.92, 1.43, 4, 15)
  75. end
  76. function ThankYou(NPC,Spawn)
  77. local zone = GetZone(NPC)
  78. local Refugee = GetSpawnByLocationID(zone, 133775246) --Refugee
  79. FaceTarget(Refugee,Spawn)
  80. choice = MakeRandomInt(1,4)
  81. if choice == 1 then
  82. PlayFlavor(Refugee, "", "", "thanks",0,0)
  83. elseif choice == 2 then
  84. PlayFlavor(Refugee, "", "", "bow",0,0)
  85. elseif choice == 3 then
  86. PlayFlavor(Refugee, "", "", "notworthy",0,0)
  87. elseif choice == 3 then
  88. PlayFlavor(Refugee, "", "", "cheer",0,0)
  89. end
  90. end
  91. function DespawnTimer(NPC,Spawn)
  92. local zone = GetZone(NPC)
  93. local Refugee = GetSpawnByLocationID(zone, 133775246) --Refugee
  94. Despawn(Refugee)
  95. Despawn(NPC)
  96. end