9
3

aggresiveGobinvisiblecube2.lua 3.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113
  1. --[[
  2. Script Name : SpawnScripts/IsleRefuge1/aggresiveGobinvisiblecube2.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. Cage2(NPC)
  10. end
  11. function respawn(NPC)
  12. spawn(NPC)
  13. end
  14. function Cage2(NPC, Spawn)
  15. local zone = GetZone(NPC)
  16. local Goblin1 = GetSpawnByLocationID(zone, 133775212) --Goblin1
  17. if IsAlive(Goblin1)== false or Goblin1 == nil then
  18. SpawnByLocationID(zone, 133775212) --Goblin1
  19. end
  20. AddTimer(NPC,3500,"GobLiveCheck")
  21. -- Say(NPC,"Spawning")
  22. end
  23. function GobLiveCheck(NPC, Spawn)
  24. local zone = GetZone(NPC)
  25. local Goblin1 = GetSpawnByLocationID(zone, 133775212) --Goblin1
  26. local Refugee = GetSpawnByLocationID(zone, 133775245) --Refugee
  27. -- Say(NPC,"Checking")
  28. if IsAlive(Goblin1) ==false then --CHECKS IF GOBLIN IS ALIVE, IF NOT THE FOLLOWING FREES THE REFUGEE
  29. if Refugee~=nil then
  30. waypoints(NPC,Spawn)
  31. SpawnSet(Refugee,"mood_state",0)
  32. SpawnSet(Refugee,"initial_state",16512)
  33. AddTimer(NPC,2000,"ThankYou")
  34. AddTimer(NPC,15000,"DespawnTimer")
  35. -- Say(Refugee,"Freedom")
  36. -- Say(NPC,"Goblin Dead - Free Refugee")
  37. -- Say(Goblin,"Dead")
  38. end
  39. else -- GOBLIN IS ALIVE. REFUGEE IS SAD.
  40. -- Say(NPC,"Alive")
  41. AddTimer(NPC,6000,"GobLiveCheck")
  42. choice = MakeRandomInt(1,10)
  43. if choice == 1 then
  44. PlayFlavor(Refugee, "", "", "cringe",0,0)
  45. elseif choice == 2 then
  46. PlayFlavor(Refugee, "", "", "tantrum_short",0,0)
  47. elseif choice == 3 then
  48. PlayFlavor(Refugee, "", "", "sigh",0,0)
  49. elseif choice == 4 then
  50. PlayFlavor(Refugee, "", "", "squeal",0,0)
  51. elseif choice == 5 then
  52. PlayFlavor(Refugee, "", "", "threten",0,0)
  53. elseif choice == 6 then
  54. PlayFlavor(Refugee, "", "", "wince",0,0)
  55. elseif choice == 7 then
  56. PlayFlavor(Refugee, "", "", "crazy",0,0)
  57. elseif choice == 8 then
  58. PlayFlavor(Refugee, "", "", "pout",0,0)
  59. elseif choice == 9 then
  60. PlayFlavor(Refugee, "", "", "frustrated",0,0)
  61. elseif choice == 10 then
  62. PlayFlavor(Refugee, "", "", "sulk",0,0)
  63. end
  64. end
  65. end
  66. function waypoints(NPC,Spawn)
  67. local zone = GetZone(NPC)
  68. local Refugee = GetSpawnByLocationID(zone, 133775245) --Refugee
  69. local x=GetX(NPC)
  70. local y=GetY(NPC)
  71. local z=GetZ(NPC)
  72. PlaySound(NPC, "sounds/widgets/doors/door_metal_slam001.wav", GetX(NPC), GetY(NPC), GetZ(NPC))
  73. MovementLoopAddLocation(Refugee, x, y, z, 4, 1)
  74. MovementLoopAddLocation(Refugee, x, y, z, 4, 6,"ThankYou")
  75. MovementLoopAddLocation(Refugee, x, y, z, 4, 0)
  76. MovementLoopAddLocation(Refugee, 273.33, -4.83, -6.67, 4, 0)
  77. MovementLoopAddLocation(Refugee, 264.44, -5.09, -6.10, 4, 0)
  78. MovementLoopAddLocation(Refugee, 258.38, -4.60, -5.26, 4, 0,"DespawnTimer")
  79. MovementLoopAddLocation(Refugee, 252.05, -3.92, 1.43, 4, 15)
  80. end
  81. function ThankYou(NPC,Spawn) --THANKS PLAYER WITH EMOTE BEFORE RUNNING W/ WAYPOINTS
  82. local zone = GetZone(NPC)
  83. local Refugee = GetSpawnByLocationID(zone, 133775245) --Refugee
  84. FaceTarget(Refugee,Spawn)
  85. choice = MakeRandomInt(1,4)
  86. if choice == 1 then
  87. PlayFlavor(Refugee, "", "", "thanks",0,0)
  88. elseif choice == 2 then
  89. PlayFlavor(Refugee, "", "", "bow",0,0)
  90. elseif choice == 3 then
  91. PlayFlavor(Refugee, "", "", "notworthy",0,0)
  92. elseif choice == 4 then
  93. PlayFlavor(Refugee, "", "", "cheer",0,0)
  94. end
  95. end
  96. function DespawnTimer(NPC,Spawn)
  97. local zone = GetZone(NPC)
  98. local Refugee = GetSpawnByLocationID(zone, 133775245) --Refugee
  99. Despawn(Refugee)
  100. Despawn(NPC)
  101. end