Jump to content

[HELP PLS] more damage with specific weapon


Recommended Posts

@DestroyerofNorth:

local pickaxes = { pickaxe = true, goldenpickaxe = true }local old_CalcDamage = inst.components.combat.CalcDamageinst.components.combat.CalcDamage = function(self, target, weapon, multiplier)	local handitem = self.inst.components.inventory:GetEquippedItem(GLOBAL.EQUIPSLOTS.HANDS)	if handitem and pickaxes[handitem.prefab] then		multiplier = (multiplier or 1) * 2	end	return old_CalcDamage(self, target, weapon, multiplier)end
Link to comment
Share on other sites

Thx is this version ok to?

 

local my_multiplier = 1.5
local old_CalcDamage = inst.components.combat.CalcDamage
inst.components.combat.CalcDamage = function(self, target, weapon, multiplier)
if weapon and weapon.prefab == "pickaxe"
then multiplier = (3) * my_multiplier
end
return old_CalcDamage(self, target, weapon, multiplier)
end

 

and could i combine it with that?

 

local my_multiplier = 1.5
local old_CalcDamage = inst.components.combat.CalcDamage
inst.components.combat.CalcDamage = function(self, target, weapon, multiplier)
if target and target.prefab == "dragonfly"
then multiplier = (150) * my_multiplier
end
return old_CalcDamage(self, target, weapon, multiplier)
end
Link to comment
Share on other sites

@DestroyerofNorth, combined then like this:

local strength_multiplier = 1.5local pickaxe_multiplier = 3local dragonfly_multiplier = 150local old_CalcDamage = inst.components.combat.CalcDamageinst.components.combat.CalcDamage = function(self, target, weapon, multiplier)	multiplier = (multiplier or 1) * strength_multiplier	if weapon and weapon.prefab == "pickaxe" then		multiplier = multiplier * pickaxe_multiplier	end	if target and target.prefab == "dragonfly" then		multiplier = multiplier * dragonfly_multiplier	end	return old_CalcDamage(self, target, weapon, multiplier)end
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...