Vull Posted April 16, 2017 Share Posted April 16, 2017 (edited) How can I do this so that damage increases my character every time it comes down to the maximum amount of life ??? I'm Russian, we unfortunately do not have this popular game, and mods and even less do. Do not swear strongly, I use an interpreter I want to add my character The less damage he has, the more he attacks local function VI(inst) if inst.components.health.maxhealth <= (75) then inst.components.combat.damagemultiplier = (99999999) end end local function onload(inst) inst:ListenForEvent("Я пришёл,что бы научить тебя", onbecamehuman) inst:ListenForEvent("ms_becameghost", onbecameghost) if inst:HasTag("playerghost") then onbecameghost(inst) else onbecamehuman(inst) end end local common_postinit = function(inst) inst.MiniMapEntity:SetIcon( "kama.tex" ) end local function uraken(inst) if inst.components.sanity.current <= (20) then inst.components.combat.damagemultiplier = 10.0 inst.components.health:StartRegen(5, 20) end end local master_postinit = function(inst) inst.soundsname = "willow" inst.components.health:SetMaxHealth(100) inst.components.hunger:SetMax(75) inst.components.sanity:SetMax(50) inst.components.sanity.night_drain_mult = (0.50) inst.components.combat.damagemultiplier = 1 inst.components.hunger.hungerrate = 1 * TUNING.WILSON_HUNGER_RATE inst.components.locomotor.walkspeed = (TUNING.WILSON_WALK_SPEED * 1.1) inst.components.locomotor.runspeed = (TUNING.WILSON_RUN_SPEED * 1.1) inst:ListenForEvent("healthdelta", function(inst) VI(inst) end) inst:ListenForEvent("sanitydelta", function(inst) uraken(inst) end) inst:ListenForEvent("killed", function(inst) levelup(inst) end) inst.OnLoad = onload inst.OnNewSpawn = onload end return MakePlayerCharacter("kama", prefabs, assets, common_postinit, master_postinit, start_inv) Edited April 16, 2017 by Vull Link to comment Share on other sites More sharing options...
. . . Posted April 16, 2017 Share Posted April 16, 2017 I think this should work for you ! inst:ListenForEvent("healthdelta", function(inst, data) if inst.components.health.currenthealth <= 75 then inst.components.combat.damagemultiplier = (99999999) end end) Link to comment Share on other sites More sharing options...
Vull Posted April 16, 2017 Author Share Posted April 16, 2017 28 minutes ago, SuperDavid said: I think this should work for you ! inst:ListenForEvent("healthdelta", function(inst, data) if inst.components.health.currenthealth <= 75 then inst.components.combat.damagemultiplier = (99999999) end end) inst:ListenForEvent("healthdelta", function(inst, data) insert into local master_postinit = function(inst)?? Link to comment Share on other sites More sharing options...
Vull Posted April 16, 2017 Author Share Posted April 16, 2017 The fewer lives my character has, the more damage he does Link to comment Share on other sites More sharing options...
. . . Posted April 17, 2017 Share Posted April 17, 2017 Put this inside YOURCHARACTER.lua is master_postinit and when he have fewer lives than 75 more damage he does Link to comment Share on other sites More sharing options...
Vull Posted April 17, 2017 Author Share Posted April 17, 2017 43 minutes ago, SuperDavid said: Put this inside YOURCHARACTER.lua is master_postinit and when he have fewer lives than 75 more damage he does like this? local master_postinit = function(inst) inst:ListenForEvent("healthdelta", function(inst, data) if inst.components.health.currenthealth <= 75 then inst.components.combat.damagemultiplier = (99999999) end end inst.soundsname = "willow" inst.components.health:SetMaxHealth(100) inst.components.hunger:SetMax(75) inst.components.sanity:SetMax(50) inst.components.sanity.night_drain_mult = (0.50) inst.components.combat.damagemultiplier = 1 inst.components.hunger.hungerrate = 1 * TUNING.WILSON_HUNGER_RATE inst.components.locomotor.walkspeed = (TUNING.WILSON_WALK_SPEED * 1.1) inst.components.locomotor.runspeed = (TUNING.WILSON_RUN_SPEED * 1.1) inst:ListenForEvent("killed", function(inst) levelup(inst) end) inst.OnLoad = onload inst.OnNewSpawn = onload end Link to comment Share on other sites More sharing options...
. . . Posted April 17, 2017 Share Posted April 17, 2017 (edited) yes, test in game it should work Edited April 17, 2017 by SuperDavid Link to comment Share on other sites More sharing options...
Vull Posted April 17, 2017 Author Share Posted April 17, 2017 5 hours ago, SuperDavid said: yes, test in game it should work Shows an error Link to comment Share on other sites More sharing options...
Vull Posted April 17, 2017 Author Share Posted April 17, 2017 10 hours ago, SuperDavid said: yes, test in game it should work Link to comment Share on other sites More sharing options...
Lumina Posted April 17, 2017 Share Posted April 17, 2017 You forgot the final ) inst:ListenForEvent("healthdelta", function(inst, data) if inst.components.health.currenthealth <= 75 then inst.components.combat.damagemultiplier = (99999999) end end) Link to comment Share on other sites More sharing options...
Vull Posted April 17, 2017 Author Share Posted April 17, 2017 5 minutes ago, Lumina said: You forgot the final ) inst:ListenForEvent("healthdelta", function(inst, data) if inst.components.health.currenthealth <= 75 then inst.components.combat.damagemultiplier = (99999999) end end) Thanks, it worked ))) Thanks 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