aggresiveGobinvisiblecube2.lua 3.5 KB

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