Skip to content

Commit

Permalink
Fix or disable issues reported from Global additions
Browse files Browse the repository at this point in the history
  • Loading branch information
claywar committed Aug 26, 2024
1 parent e22e4cd commit cc97141
Show file tree
Hide file tree
Showing 260 changed files with 1,676 additions and 807 deletions.
5 changes: 4 additions & 1 deletion scripts/actions/mobskills/astral_flow.lua
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,10 @@ mobskillObject.onMobWeaponSkill = function(target, mob, skill)

if not GetMobByID(avatar):isSpawned() then
GetMobByID(avatar):setSpawn(mob:getXPos() + 1, mob:getYPos(), mob:getZPos() + 1, mob:getRotPos())
SpawnMob(avatar):updateEnmity(mob:getTarget())
local mobTarget = mob:getTarget()
if mobTarget then
SpawnMob(avatar):updateEnmity(mobTarget)
end
end

return xi.effect.ASTRAL_FLOW
Expand Down
4 changes: 4 additions & 0 deletions scripts/actions/mobskills/eclosion.lua
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,10 @@ mobskillObject.onMobWeaponSkill = function(target, mob, skill)
DisallowRespawn(mobID, true)

local wamoura = GetMobByID(mobID + 1)
if not wamoura then
return
end

wamoura:setSpawn(mobArg:getXPos(), mobArg:getYPos(), mobArg:getZPos())
SpawnMob(mobID + 1)

Expand Down
12 changes: 9 additions & 3 deletions scripts/actions/mobskills/fission.lua
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ mobskillObject.onMobSkillCheck = function(target, mob, skill)
local fam = 1
for i = momma + 1, momma + mob:getLocalVar('maxBabies') do
local baby = GetMobByID(i)
if not baby:isSpawned() then
if baby and not baby:isSpawned() then
fam = 0
break
end
Expand All @@ -25,8 +25,14 @@ mobskillObject.onMobWeaponSkill = function(target, mob, skill)
local pos = mob:getPos()
for babyID = momma + 1, momma + mob:getLocalVar('maxBabies') do
local baby = GetMobByID(babyID)
if not baby:isSpawned() then
SpawnMob(babyID):updateEnmity(mob:getTarget())
if baby and not baby:isSpawned() then
SpawnMob(babyID)

local mobTarget = mob:getTarget()
if mobTarget then
baby:updateEnmity(mobTarget)
end

baby:setPos(pos.x, pos.y, pos.z)
break
end
Expand Down
12 changes: 7 additions & 5 deletions scripts/actions/mobskills/pod_ejection.lua
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,13 @@ end

mobskillObject.onMobWeaponSkill = function(target, mob, skill)
mob:timer(3000, function(mobArg)
if mob:isAlive() then
local gunpod = GetMobByID(mob:getID() + 1)
gunpod:setSpawn(mob:getXPos(), mob:getYPos(), mob:getZPos(), mob:getRotPos())
gunpod:spawn()
gunpod:updateEnmity(utils.randomEntry(mob:getBattlefield():getPlayers()))
if mobArg:isAlive() then
local gunpod = GetMobByID(mobArg:getID() + 1)
if gunpod then
gunpod:setSpawn(mobArg:getXPos(), mobArg:getYPos(), mobArg:getZPos(), mobArg:getRotPos())
gunpod:spawn()
gunpod:updateEnmity(utils.randomEntry(mobArg:getBattlefield():getPlayers()))
end
end
end)

Expand Down
2 changes: 1 addition & 1 deletion scripts/actions/mobskills/sand_blast.lua
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ mobskillObject.onMobWeaponSkill = function(target, mob, skill)
if mob:getPool() == 1318 and mob:getLocalVar('SAND_BLAST') == 1 then -- Feeler Anltion
local alastorId = mob:getID() + 6
local alastor = GetMobByID(alastorId)
if not alastor:isSpawned() then -- Alastor Antlion
if alastor and not alastor:isSpawned() then -- Alastor Antlion
mob:setLocalVar('SAND_BLAST', 0) -- Don't spawn more NMs
alastor:setSpawn(mob:getXPos() + 1, mob:getYPos() + 1, mob:getZPos() + 1) -- Set its spawn location.
SpawnMob(alastorId, 120):updateClaim(target)
Expand Down
6 changes: 4 additions & 2 deletions scripts/actions/mobskills/sand_pit.lua
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,10 @@ mobskillObject.onMobWeaponSkill = function(target, mob, skill)

if spawnId > 0 then
local executioner = GetMobByID(spawnId)
executioner:setSpawn(npcX-1, npcY-2, npcZ-1) -- Set its spawn location.
SpawnMob(spawnId):updateEnmity(target)
if executioner then
executioner:setSpawn(npcX-1, npcY-2, npcZ-1) -- Set its spawn location.
SpawnMob(spawnId):updateEnmity(target)
end
end
elseif poolID == 4046 then
-- Tuchulcha (Sheep in Antlion's Clothing)
Expand Down
7 changes: 6 additions & 1 deletion scripts/actions/mobskills/summonshadows.lua
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,12 @@ mobskillObject.onMobWeaponSkill = function(target, mob, skill)
local shadowOne = GetMobByID(zeidId + 1)
local shadowTwo = GetMobByID(zeidId + 2)

if not shadowOne:isSpawned() and not shadowTwo:isSpawned() then
if
shadowOne and
shadowTwo and
not shadowOne:isSpawned() and
not shadowTwo:isSpawned()
then
local xPos = mob:getXPos()
local yPos = mob:getYPos()
local zPos = mob:getZPos()
Expand Down
21 changes: 12 additions & 9 deletions scripts/battlefields/Apollyon/cs_apollyon.lua
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ function content:onBattlefieldTick(battlefield, tick)
-- Get which player is going to be aggrod
local player = GetPlayerByID(battlefield:getLocalVar('AutoAggroTarget'))

if player:isDead() then
if player and player:isDead() then
-- Need to find a new target
local players = battlefield:getPlayers()

Expand All @@ -79,13 +79,14 @@ function content:onBattlefieldTick(battlefield, tick)
end

local boss = GetMobByID(nextBoss)
if player and boss then
battlefield:setLocalVar('AutoAggro', boss:getID())
battlefield:setLocalVar('AutoAggroTime', os.time() + utils.minutes(7))
battlefield:setLocalVar('AutoAggroTarget', player:getID())

battlefield:setLocalVar('AutoAggro', boss:getID())
battlefield:setLocalVar('AutoAggroTime', os.time() + utils.minutes(7))
battlefield:setLocalVar('AutoAggroTarget', player:getID())

if boss:isAlive() then
boss:updateEnmity(player)
if boss:isAlive() then
boss:updateEnmity(player)
end
end
end

Expand Down Expand Up @@ -117,8 +118,10 @@ function content.handleBossCombatTick(boss, supportOffsets, otherSupportOffsets)

for _, offset in ipairs(offsets) do
local support = GetMobByID(bossID + offset)
support:setSpawn(bossX + math.random(-2, 2), bossY, bossZ + math.random(-2, 2))
support:spawn()
if support then
support:setSpawn(bossX + math.random(-2, 2), bossY, bossZ + math.random(-2, 2))
support:spawn()
end
end

-- Alternate which support group to spawn
Expand Down
6 changes: 4 additions & 2 deletions scripts/battlefields/Apollyon/nw_apollyon.lua
Original file line number Diff line number Diff line change
Expand Up @@ -41,8 +41,10 @@ end

local depowerBoss = function(bossID)
local boss = GetMobByID(bossID)
boss:delMod(xi.mod.ATTP, 100)
boss:delMod(xi.mod.ACC, 50)
if boss then
boss:delMod(xi.mod.ATTP, 100)
boss:delMod(xi.mod.ACC, 50)
end
end

content.paths =
Expand Down
20 changes: 12 additions & 8 deletions scripts/battlefields/Apollyon/se_apollyon.lua
Original file line number Diff line number Diff line change
Expand Up @@ -244,18 +244,22 @@ content.groups =
death = function(battlefield, mob, count)
if count == 2 then
local crate = GetNPCByID(ID.SE_APOLLYON.npc.TIME_CRATES[3])
crate:setPos(floorThreeCratePositions[battlefield:getLocalVar('timeCrateIndex')])
npcUtil.showCrate(GetNPCByID(ID.SE_APOLLYON.npc.TIME_CRATES[3]))

if crate then
crate:setPos(floorThreeCratePositions[battlefield:getLocalVar('timeCrateIndex')])
npcUtil.showCrate(GetNPCByID(ID.SE_APOLLYON.npc.TIME_CRATES[3]))
end
elseif count == 4 then
local crate = GetMobByID(ID.SE_APOLLYON.npc.RECOVER_CRATES[3])
crate:setPos(floorThreeCratePositions[battlefield:getLocalVar('recoverCrateIndex')])
xi.limbus.showRecoverCrate(ID.SE_APOLLYON.npc.RECOVER_CRATES[3])

if crate then
crate:setPos(floorThreeCratePositions[battlefield:getLocalVar('recoverCrateIndex')])
xi.limbus.showRecoverCrate(ID.SE_APOLLYON.npc.RECOVER_CRATES[3])
end
elseif count == 8 then
local crate = GetNPCByID(ID.SE_APOLLYON.npc.ITEM_CRATES[3])
crate:setPos(floorThreeCratePositions[battlefield:getLocalVar('itemCrateIndex')])
npcUtil.showCrate(GetNPCByID(ID.SE_APOLLYON.npc.ITEM_CRATES[3]))
if crate then
crate:setPos(floorThreeCratePositions[battlefield:getLocalVar('itemCrateIndex')])
npcUtil.showCrate(GetNPCByID(ID.SE_APOLLYON.npc.ITEM_CRATES[3]))
end
end
end,
},
Expand Down
19 changes: 12 additions & 7 deletions scripts/battlefields/Apollyon/sw_apollyon.lua
Original file line number Diff line number Diff line change
Expand Up @@ -302,20 +302,25 @@ content.groups =

local position = positions[#positions]
local mob = GetMobByID(ID.SW_APOLLYON.mob.JIDRA_BOSS)
mob:setPos(position.x, position.y, position.z, position.rot)
if mob then
mob:setPos(position.x, position.y, position.z, position.rot)
end
end,

death = function(battlefield, mob, count)
local addID = mob:getID() + 7
local add = GetMobByID(addID)
add:setSpawn(mob:getXPos(), mob:getYPos(), mob:getZPos(), mob:getRotPos())
SpawnMob(addID)

local enmityList = mob:getEnmityList()
local target = utils.randomEntry(enmityList)['entity']
if add then
add:setSpawn(mob:getXPos(), mob:getYPos(), mob:getZPos(), mob:getRotPos())
SpawnMob(addID)

if target ~= nil then
add:updateEnmity(target)
local enmityList = mob:getEnmityList()
local target = utils.randomEntry(enmityList)['entity']

if target ~= nil then
add:updateEnmity(target)
end
end
end,
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,11 @@ function content:handleCrateDefeated(battlefield, mob)
local crateId = battlefield:getArmouryCrate()
local crate = GetNPCByID(crateId)

crate:teleport(mob:getPos(), mob:getRotPos())
npcUtil.showCrate(crate)
crate:addListener('ON_TRIGGER', 'TRIGGER_CRATE', utils.bind(self.handleOpenArmouryCrate, self))
if crate then
crate:teleport(mob:getPos(), mob:getRotPos())
npcUtil.showCrate(crate)
crate:addListener('ON_TRIGGER', 'TRIGGER_CRATE', utils.bind(self.handleOpenArmouryCrate, self))
end
end

content.groups =
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -80,10 +80,12 @@ function content:setupBattlefield(battlefield)

-- Select Tuchulcha's sandpit positions
local tuchulcha = GetMobByID(content.groups[1].mobIds[battlefieldArea][1])
tuchulcha:setLocalVar('sand_pit1', selectedPositions[4])
tuchulcha:setLocalVar('sand_pit2', selectedPositions[5])
tuchulcha:setLocalVar('sand_pit3', selectedPositions[6])
tuchulcha:setPos(antlionPositions[battlefieldArea][selectedPositions[7]])
if tuchulcha then
tuchulcha:setLocalVar('sand_pit1', selectedPositions[4])
tuchulcha:setLocalVar('sand_pit2', selectedPositions[5])
tuchulcha:setLocalVar('sand_pit3', selectedPositions[6])
tuchulcha:setPos(antlionPositions[battlefieldArea][selectedPositions[7]])
end
end

content.groups =
Expand Down
3 changes: 2 additions & 1 deletion scripts/battlefields/Navukgo_Execution_Chamber/omens.lua
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ function content:battlefieldEntry(player, battlefield)
local mobOffset = math.floor(additionalEntered / 3)
local flanObj = GetMobByID(navukgoID.mob.IMMORTAL_FLAN + (battlefieldArea - 1) * 7 + mobOffset)

if not flanObj:isSpawned() then
if flanObj and not flanObj:isSpawned() then
flanObj:spawn()
battlefield:setLocalVar('numSpawned', mobOffset)
end
Expand All @@ -50,6 +50,7 @@ local handleDeath = function(battlefield, mob)
local mobObj = GetMobByID(mobId)

if
mobObj and
mobObj:isSpawned() and
not mobObj:isDead()
then
Expand Down
1 change: 1 addition & 0 deletions scripts/battlefields/QuBia_Arena/awful_autopsy.lua
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ local handleDeath = function(battlefield, mob)
local mobObj = GetMobByID(mobId)

if
mobObj and
mobObj:isSpawned() and
not mobObj:isDead()
then
Expand Down
10 changes: 6 additions & 4 deletions scripts/battlefields/Temenos/central_temenos_2nd_floor.lua
Original file line number Diff line number Diff line change
Expand Up @@ -40,10 +40,12 @@ function content:handleElementalDeath(elementalMod, bonusMod, bonusAmount, weakE
local mysticID = mob:getID() + 6
local mystic = GetMobByID(mysticID)

mystic:timer(3000, function(mobArg)
mystic:setSpawn(mob:getXPos(), mob:getYPos(), mob:getZPos(), mob:getRotPos())
SpawnMob(mysticID)
end)
if mystic then
mystic:timer(3000, function(mobArg)
mystic:setSpawn(mob:getXPos(), mob:getYPos(), mob:getZPos(), mob:getRotPos())
SpawnMob(mysticID)
end)
end

return
end
Expand Down
50 changes: 27 additions & 23 deletions scripts/battlefields/Temenos/central_temenos_4th_floor.lua
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ local despawnGroupCrates = function(crateGroup)
for i = 1, crateGroup.count do
local crate = GetEntityByID(crateGroup.offset + i - 1)

if crate:getLocalVar('opened') == 0 then
if crate and crate:getLocalVar('opened') == 0 then
crate:setLocalVar('opened', 1)
npcUtil.disappearCrate(crate)
end
Expand All @@ -47,29 +47,33 @@ function content:onBattlefieldInitialise(battlefield)
local crateID = group.offset + j - 1
local crate = GetEntityByID(crateID)

crate:setStatus(xi.status.NORMAL)
crate:setUntargetable(false)
crate:setAnimationSub(8)
crate:setModelId(961)

crate:addListener('ON_TRIGGER', 'TRIGGER_CRATE', function(player, npc)
npcUtil.openCrate(npc, function()
despawnGroupCrates(group)

if j == itemIndex then
content:handleLootRolls(player:getBattlefield(), content.loot[1], npc)
else
-- Spawn a random mob from the corresponding mob group
local mobGroup = ID.CENTRAL_TEMENOS_4TH_FLOOR.mob.GROUPS[index]
local mobID = mobGroup.offset + math.random(0, mobGroup.count - 1)
local mob = GetMobByID(mobID)

mob:setSpawn(npc:getXPos(), npc:getYPos(), npc:getZPos(), npc:getRotPos())
mob:spawn()
mob:updateEnmity(player)
end
if crate then
crate:setStatus(xi.status.NORMAL)
crate:setUntargetable(false)
crate:setAnimationSub(8)
crate:setModelId(961)

crate:addListener('ON_TRIGGER', 'TRIGGER_CRATE', function(player, npc)
npcUtil.openCrate(npc, function()
despawnGroupCrates(group)

if j == itemIndex then
content:handleLootRolls(player:getBattlefield(), content.loot[1], npc)
else
-- Spawn a random mob from the corresponding mob group
local mobGroup = ID.CENTRAL_TEMENOS_4TH_FLOOR.mob.GROUPS[index]
local mobID = mobGroup.offset + math.random(0, mobGroup.count - 1)
local mob = GetMobByID(mobID)

if mob then
mob:setSpawn(npc:getXPos(), npc:getYPos(), npc:getZPos(), npc:getRotPos())
mob:spawn()
mob:updateEnmity(player)
end
end
end)
end)
end)
end
end
end
end
Expand Down
Loading

0 comments on commit cc97141

Please sign in to comment.