Jump to content

Wes balloon dealing less damage on some targets


Recommended Posts

Hi, how to make the Balloon (pop damage) deals different damage only for certain targets? (Checking player tag and follower component with a leader)

I want edit Wes balloons to deal 1 damage on them, and 5 to all other targets, someone can help?

Link to comment
Share on other sites

"Solved", I did check on combat.CalcDamage, with AddComponentPostInit. Unfortunelly doing it on 'balloon' prefab dont works for me, so, all calc damages will check this. Isn't the best, but if someone want know how do it, here is:

local ALLY_DMG = 1
local function OverrideCombat(comp)
	local oldCalcDamage = comp.CalcDamage
	comp.CalcDamage = function(self, target, weapon, multiplier)
		local dmg = oldCalcDamage(self, target, weapon, multiplier)
		if target ~= nil and self.inst.prefab == "balloon" then
			local has_player_leader = target.components.follower ~= nil and target.components.follower.leader ~= nil and target.components.follower.leader:HasTag("player") and true or false
			if (target:HasTag("Player")) or (target:HasTag("companion") or has_player_leader) then
				dmg = ALLY_DMG
			end
		end
		return dmg
	end
end
AddComponentPostInit("combat", OverrideCombat)

 

  • Sanity 1
Link to comment
Share on other sites

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
 Share

×
×
  • Create New...