Th3_Acid Posted December 29, 2023 Share Posted December 29, 2023 As the title says. I want to create custom fuel (hunger) stat for a character and I'd need to know how such things are implemented in original game or other mods if there are any good examples. But also, how or where do get to I extract original characters' files in order to base ideas for implementing mechanics similar to theirs? Link to comment https://forums.kleientertainment.com/forums/topic/153602-beginner-needs-help-how-do-i-make-custom-health-resource-similar-to-wandas/ Share on other sites More sharing options...
ClumsyPenny Posted December 30, 2023 Share Posted December 30, 2023 19 hours ago, Th3_Acid said: how or where do get to I extract original characters' files in order to base ideas for implementing mechanics similar to theirs? C:\Program Files (x86)\Steam\steamapps\common\Don't Starve Together\data\databundles\scripts.zip The directory should be something like this. Inside the .zip you'll find the scripts folder, this is where all the code is. 20 hours ago, Th3_Acid said: I want to create custom fuel (hunger) stat for a character and I'd need to know how such things are implemented in original game It really really depends what you want to do. First things first, you'll need to change the badge visually. You need to create a custom Hunger badge, then add it to your character's common_postinit function, like this: local FuelBadge = require("widgets/fuelbadge") local function common_postinit(inst) -- Your other code here if not TheNet:IsDedicated() then inst.CreateHungerBadge = FuelBadge end end It's this easy because Klei is already accounting for the possibility of custom Health/Hunger/Sanity badges in widgets/statusdisplays.lua. Wanda uses a similar feature too for her special health, see prefabs/wanda.lua. References for various badges are in widgets/healthbadge.lua, hungerbadge, wandaagebadge, etc. If you want some special behavior that differs from regular Hunger for your Fuel meter, then I need to know what it is to help you. But for reference, Wanda uses the health component's "redirect" function to redirect changes to health to the oldager component, which handles the damage over time mechanic and only being able to heal from certain sources. Thankfully, both the hunger and sanity component also have a similar "redirect" function, so you're in luck. You don't necessarily need to make a component to handle your new behavior, it really just depends on the complexity of it. Link to comment https://forums.kleientertainment.com/forums/topic/153602-beginner-needs-help-how-do-i-make-custom-health-resource-similar-to-wandas/#findComment-1691747 Share on other sites More sharing options...
Th3_Acid Posted January 1, 2024 Author Share Posted January 1, 2024 Thank you @ClumsyPenny for directions. I've been looking at Wanda's and Hunger Badge's codes respectively and have managed to change sprites of the badge with some placeholder art. I would have questions regarding wholistic change of the badge art with the frame and other such effects but that's not a priority at the moment for me. What I'm having issues with at the moment is exothermic aura. I'm trying to make a character that is a living flame, a will-o'-wisp kind and to properly realise this idea I need a way to generate heat not only for the entities around the player but also character themselves. At the moment my character generates heat for the surrounding area and items in the inventory but there is no meaningful results on the player's temperature. I plan on creating a conditional fuel (hunger) consumption rates depending on the difficulty of sustaining flame's temperature but for that I need to properly understand temperature and heater components respectively. So I thank in advance to anyone wiling to guide me here. Here's code regarding my use of components.heater -- Function basically taken from wx78 local function GetFlameTemperatureFn(inst, observer) return 220 + (inst.components.hunger:GetPercent() * 380) end local master_postinit = function(inst) -- Other code inst:AddComponent("heater") inst.components.heater:SetThermics(true, false) inst.components.heater.heatfn = GetFlameTemperatureFn inst.components.health.fire_damage_scale = 0 -- And again more irrelevant code end Link to comment https://forums.kleientertainment.com/forums/topic/153602-beginner-needs-help-how-do-i-make-custom-health-resource-similar-to-wandas/#findComment-1691915 Share on other sites More sharing options...
ClumsyPenny Posted January 1, 2024 Share Posted January 1, 2024 3 hours ago, Th3_Acid said: but there is no meaningful results on the player's temperature. Looking at the "temperature" component code, it looks like that an entity with temperature excludes itself when checking for "heaters" around, so it can't affect itself. The way WX-78's modules work is that they set their minimum/maximum temperature just above/below the freezing/overheating thresholds, but the heat/cold doesn't affect WX-78 themself. Link to comment https://forums.kleientertainment.com/forums/topic/153602-beginner-needs-help-how-do-i-make-custom-health-resource-similar-to-wandas/#findComment-1691942 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