Tomyciga Posted August 12, 2024 Share Posted August 12, 2024 Hello, I'm new into custom character creation and I want to create a character that gets stronger while having the hunger at certain percentage, I tried to found a programing for this but I could't, how do I do the coding for this? Thanks in advance Link to comment https://forums.kleientertainment.com/forums/topic/158993-help-with-custom-character-perks/ Share on other sites More sharing options...
Mint Candy Posted August 18, 2024 Share Posted August 18, 2024 local function hungerfn(inst) if hungerfn = /count/ then DAMAGE_MULTIPLIER = /needed count, 1 = normal, 1.5 = +50% damage and etc/ end Try smthng like this xd Link to comment https://forums.kleientertainment.com/forums/topic/158993-help-with-custom-character-perks/#findComment-1741214 Share on other sites More sharing options...
Chesed Posted August 18, 2024 Share Posted August 18, 2024 (edited) I made something very very simple for you just to give you the example of the kind of code you'd need. I kind of just threw it together based on two of my mods so idk if it's elegant but I've tested it and it works. Put this in your character.lua. Quote local function HungerDamageCalc(inst,data) local hunger = inst.components.hunger:GetPercent() if hunger < 0.5 then inst.components.combat.damagemultiplier = 1.0 end if hunger >= 0.5 then inst.components.combat.damagemultiplier = 1.25 end end Put this in the master_postinit function of your character.lua. Quote inst:ListenForEvent("hungerdelta", HungerDamageCalc) Edited August 18, 2024 by Chesed 1 Link to comment https://forums.kleientertainment.com/forums/topic/158993-help-with-custom-character-perks/#findComment-1741274 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