DestroyerofNorth Posted August 26, 2015 Share Posted August 26, 2015 Hi, i want my character to make more damage with pickaxe only, but i don't know the right code for that. Link to comment Share on other sites More sharing options...
DarkXero Posted August 26, 2015 Share Posted August 26, 2015 @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 More sharing options...
DestroyerofNorth Posted August 27, 2015 Author Share Posted August 27, 2015 Thx is this version ok to? local my_multiplier = 1.5local old_CalcDamage = inst.components.combat.CalcDamageinst.components.combat.CalcDamage = function(self, target, weapon, multiplier)if weapon and weapon.prefab == "pickaxe"then multiplier = (3) * my_multiplierendreturn old_CalcDamage(self, target, weapon, multiplier)end and could i combine it with that? local my_multiplier = 1.5local old_CalcDamage = inst.components.combat.CalcDamageinst.components.combat.CalcDamage = function(self, target, weapon, multiplier)if target and target.prefab == "dragonfly"then multiplier = (150) * my_multiplierendreturn old_CalcDamage(self, target, weapon, multiplier)end Link to comment Share on other sites More sharing options...
DarkXero Posted August 27, 2015 Share Posted August 27, 2015 @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 More sharing options...
DestroyerofNorth Posted August 27, 2015 Author Share Posted August 27, 2015 Thank you Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now