ZombieTG Posted July 31, 2015 Share Posted July 31, 2015 So i need some help with some coding, I'm new to this. I need a code where my character takes more damage and Also if there's a code for the water balloon where when throwing it and on impact causing damage in certain amount of area within where the impact landed? Link to comment Share on other sites More sharing options...
DarkXero Posted August 1, 2015 Share Posted August 1, 2015 @ZombieTG: -- extra damage -- master_postinit local extra_multiplier = 1.25 local old_gta = inst.components.combat.GetAttacked inst.components.combat.GetAttacked = function(self, attacker, damage, weapon, stimuli) damage = damage and (damage * extra_multiplier) return old_gta(self, attacker, damage, weapon, stimuli) end-- Waterballoon damage-- modmainAddPrefabPostInit("waterballoon", function(inst) if GLOBAL.TheWorld.ismastersim then local old_ohfn = inst.components.complexprojectile.onhitfn local function NewOnHit(waterballoon, attacker, target) local x, y, z = waterballoon.Transform:GetWorldPosition() local radius = 5 local damage = 20 local ents = GLOBAL.TheSim:FindEntities(x, y, z, radius, nil, { "FX", "NOCLICK", "DECOR", "INLIMBO", "player", "playerghost" }) for i, v in ipairs(ents) do if v.components.combat and not (v == inst) then v.components.combat:GetAttacked(inst, damage) end end old_ohfn(waterballoon, attacker, target) end inst.components.complexprojectile:SetOnHit(NewOnHit) endend) Link to comment Share on other sites More sharing options...
ZombieTG Posted August 1, 2015 Author Share Posted August 1, 2015 @DarkXero Thank you !!! Link to comment Share on other sites More sharing options...
Fidooop Posted August 2, 2015 Share Posted August 2, 2015 (edited) or you could just do this for more damage inst.components.health.absorb = 0.8--1 = 100%, 0.8 = 80%, 2 = 200%, etc. Edited August 2, 2015 by Fidooop 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