Metajoker Posted August 9, 2016 Share Posted August 9, 2016 (edited) Hey guys! So, I just created a custom character for DST, and at this point the only thing left to do is add any custom stats and perks. The perk I'd like the character to have is that the lower their hunger is (as in, the lower the score/the hungrier they are) the higher their strength proportionately. So basically, that if the character is close to starving they are much stronger, and if they are full they are weaker. How would I go about programming this, and where would I put it? Under stats? I would also be willing to go with what I assume would be a lot easier to program, where if the hunger goes below a certain set value, the character's strength immediately goes up to a higher set value, like a reversed Wolfgang. Thanks! Edited August 9, 2016 by Metajoker Ability -> Perk Link to comment Share on other sites More sharing options...
DarkXero Posted August 9, 2016 Share Posted August 9, 2016 Yes. Works similar with sanity, as posted in local function CalculateStrength(inst, data) inst.components.combat.damagemultiplier = Remap(1 - data.newpercent, 0, 1, 0.75, 2.25) end local function master_postinit(inst) inst:ListenForEvent("hungerdelta", CalculateStrength) end This would be the equivalent code. In the hunger component the hungerdelta event gets pushed to the player entity when the DoDelta method is executed. It gives a data table, with a newpercent key that holds the value that represents the percentage of how full you are. So if you are full, percent 1, 1 - 1 is 0, 0 remaps to 0.75. You do less damage. Starving, percent 0, 1 - 0 is 1, remaps to 2.25. Yo do more damage. 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