Jump to content

Resurrect by ballphin doesn't work since all followers has been removed when player death


Littlefat1213
  • DLC VERSION - IMPORTANT!: Shipwrecked Pending

player can't be saved by ballphin since all the followers has been removed in OnDeath function in leader component

------ Player Death Event is listened by leader component -------
local function OnDeath(inst)
    inst.components.leader:RemoveAllFollowers()
end
local Leader = Class(function(self, inst)
    self.inst = inst
    self.followers = {}
    self.numfollowers = 0

	--self.loyaltyeffectiveness = nil

    inst:ListenForEvent("newcombattarget", OnNewCombatTarget)
    inst:ListenForEvent("attacked", OnAttacked)
    inst:ListenForEvent("death", OnDeath)

    self._onfollowerdied = function(follower)    self:RemoveFollower(follower)       end
    self._onfollowerremoved = function(follower) self:RemoveFollower(follower, true) end
end)

--------------Player Death Event is also listened by gamelogic.lua Line 351----------
wilson:ListenForEvent( "death", function(inst, data) OnPlayerDeath(wilson, data) end)

-- and finally call function Resurrectable:CanResurrect(cause)--
function Resurrectable:CanResurrect(cause)
	self.resurrectionmethod = nil 

	if cause == "drowning" then 

		-- You are amphibious
		if self.cantdrown then
			self.resurrectionmethod = "amphibious"
			return true 
		end

		-- Ressurection Buddies
		if(self.inst.components.leader ~= nil) then
      ----- when reach here, all follower has been removed because of the OnDeath in leader component --------
			for k,v in pairs(self.inst.components.leader.followers) do 
				if k:HasTag("ballphin") and k:IsNear(self.inst, 32) then
					if math.random() < TUNING.BALLPHIN_DROWN_RESCUE_CHANCE then	
						self.resurrectionmethod = "ballphins"
						return true
					end
				end
			end
		end
	end 
  ......

 


Steps to Reproduce

As Above




User Feedback


There are no comments to display.



Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×
  • Create New...