9
3

aggresiveGobinvisiblecube.lua 3.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107
  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 = SpawnByLocationID(zone, 133775211) --Goblin1
  17. AddTimer(NPC,3500,"GobLiveCheck")
  18. end
  19. function GobLiveCheck(NPC, Spawn)
  20. local zone = GetZone(NPC)
  21. local Goblin1 = GetSpawnByLocationID(zone, 133775211) --Goblin1
  22. local Refugee = GetSpawnByLocationID(zone, 133775246) --Refugee
  23. if IsAlive(Goblin1) ==false then
  24. if Refugee~=nil then
  25. waypoints(NPC,Spawn)
  26. SpawnSet(Refugee,"mood_state",0)
  27. SpawnSet(Refugee,"initial_state",16512)
  28. AddTimer(NPC,2000,"ThankYou")
  29. AddTimer(NPC,15000,"DespawnTimer",1,Refugee)
  30. end
  31. else
  32. AddTimer(NPC,6000,"GobLiveCheck")
  33. choice = MakeRandomInt(1,10)
  34. if choice == 1 then
  35. PlayFlavor(Refugee, "", "", "cringe",0,0)
  36. elseif choice == 2 then
  37. PlayFlavor(Refugee, "", "", "tantrum_short",0,0)
  38. elseif choice == 3 then
  39. PlayFlavor(Refugee, "", "", "sigh",0,0)
  40. elseif choice == 4 then
  41. PlayFlavor(Refugee, "", "", "squeal",0,0)
  42. elseif choice == 5 then
  43. PlayFlavor(Refugee, "", "", "threten",0,0)
  44. elseif choice == 6 then
  45. PlayFlavor(Refugee, "", "", "wince",0,0)
  46. elseif choice == 7 then
  47. PlayFlavor(Refugee, "", "", "crazy",0,0)
  48. elseif choice == 8 then
  49. PlayFlavor(Refugee, "", "", "pout",0,0)
  50. elseif choice == 9 then
  51. PlayFlavor(Refugee, "", "", "frustrated",0,0)
  52. elseif choice == 10 then
  53. PlayFlavor(Refugee, "", "", "sulk",0,0)
  54. end
  55. end
  56. end
  57. function waypoints(NPC,Spawn)
  58. local zone = GetZone(NPC)
  59. local Refugee = GetSpawnByLocationID(zone, 133775246) --Refugee
  60. local x=GetX(NPC)
  61. local y=GetY(NPC)
  62. local z=GetZ(NPC)
  63. PlaySound(NPC, "sounds/widgets/doors/door_metal_slam001.wav", GetX(NPC), GetY(NPC), GetZ(NPC))
  64. MovementLoopAddLocation(Refugee, x, y, z, 4, 1)
  65. MovementLoopAddLocation(Refugee, x, y, z, 4, 6,"ThankYou")
  66. MovementLoopAddLocation(Refugee, x, y, z, 4, 0)
  67. MovementLoopAddLocation(Refugee, 282.81, -4.21, 0.39, 4, 0)
  68. MovementLoopAddLocation(Refugee, 270.8, -4.25, 2.77, 4, 0)
  69. MovementLoopAddLocation(Refugee, 261.68, -4.09, 1.95, 4, 0)
  70. MovementLoopAddLocation(Refugee, 253.4, -3.93, 1.41, 4, 0,"DespawnTimer")
  71. MovementLoopAddLocation(Refugee, 252.05, -3.92, 1.43, 4, 15)
  72. end
  73. function ThankYou(NPC,Spawn)
  74. local zone = GetZone(NPC)
  75. local Refugee = GetSpawnByLocationID(zone, 133775246) --Refugee
  76. FaceTarget(Refugee,Spawn)
  77. choice = MakeRandomInt(1,4)
  78. if choice == 1 then
  79. PlayFlavor(Refugee, "", "", "thanks",0,0)
  80. elseif choice == 2 then
  81. PlayFlavor(Refugee, "", "", "bow",0,0)
  82. elseif choice == 3 then
  83. PlayFlavor(Refugee, "", "", "notworthy",0,0)
  84. elseif choice == 3 then
  85. PlayFlavor(Refugee, "", "", "cheer",0,0)
  86. end
  87. end
  88. function DespawnTimer(NPC,Spawn)
  89. local zone = GetZone(NPC)
  90. local Refugee = GetSpawnByLocationID(zone, 133775246) --Refugee
  91. Despawn(Refugee)
  92. Despawn(NPC)
  93. end