AdipemDragon Posted February 11, 2016 Share Posted February 11, 2016 (edited) Okay, so I'm making a character mod for DST. Hell knows there's too many of those, yet here I am adding to the pile. All I want to know is how to start with hunger lowered from it's max. value, like Wolfgang initially spawns in. I tried digging into the code but it's just too much for me to understand how and when it happens. Also, could I use this knowledge to apply the same thing to starting with a lower max. life? Just like the max. health penalty for respawning, except you start off with it. There's probably some other topic asking about this very same issue, but I'm not willing to dig in. Edited February 11, 2016 by AdipemDragon Link to comment Share on other sites More sharing options...
Arkathorn Posted February 12, 2016 Share Posted February 12, 2016 DST forum is here. Also, should be this: inst.components.hunger:SetMax(amount) --Put this line in 'fn' for you character's prefab file. Link to comment Share on other sites More sharing options...
AdipemDragon Posted February 12, 2016 Author Share Posted February 12, 2016 Oh.... I must've really been tired last night... Sorry about that. And I can't wait until the mod is actually build up to the point where I can test this. But thanks! Now to figure out how to request this topic to be moved. Link to comment Share on other sites More sharing options...
AdipemDragon Posted February 12, 2016 Author Share Posted February 12, 2016 But... That's just how you set the max hunger for the character... I kinda wanted to know how to initially spawn in with less hunger than the one you set by: 14 hours ago, Arkathorn said: inst.components.hunger:SetMax(amount) Yknow, just like Wolfgang initially spawns in with an emptier stomach so you don't have the advantages of his Mighty form right away. And lastly, could I apply the same thing to spawn in with a lowered max life equivalent with the penalty of respawning via Telltale Heart 3 times? Link to comment Share on other sites More sharing options...
PanAzej Posted February 12, 2016 Share Posted February 12, 2016 You didn't specify what exactly you wanted to achieve at first. local function OnNewSpawn(inst) inst.components.hunger.current = inst.components.hunger.max * 0.75 end inst.OnNewSpawn = OnNewSpawn Put the last line in your char's master_postinit. About the health part I'm not 100% sure, but probably it should be like this: inst.components.health:SetPenalty(-penalty value here-) I'm not too sure about the penalty value (if it should be percentage-based or how many 'penalties' should be added), so you can just try and put "3" or "0.5" or something, and see what happens. Hope this helps. Link to comment Share on other sites More sharing options...
AdipemDragon Posted February 12, 2016 Author Share Posted February 12, 2016 (edited) @PanAzej Okay so as it is right now, should I shift around some things or is it good to go? Here's how that part is: ... inst.components.combat.damagemultiplier = 1.1 inst.components.hunger.hungerrate = 1.5 * TUNING.WILSON_HUNGER_RATE local function OnNewSpawn(inst) inst.components.hunger.current = inst.components.hunger.max * 0.5 inst.components.health:SetPenalty(3) end inst.OnNewSpawn = OnNewSpawn inst.OnLoad = onload inst.OnNewSpawn = onload end Edited February 12, 2016 by AdipemDragon I sent it too soon and it didn't make any sense. Link to comment Share on other sites More sharing options...
PanAzej Posted February 12, 2016 Share Posted February 12, 2016 You might want to put that part: local function OnNewSpawn(inst) inst.components.hunger.current = inst.components.hunger.max * 0.5 inst.components.health:SetPenalty(3) end after 'start_inv' and before 'common_postinit'. Link to comment Share on other sites More sharing options...
AdipemDragon Posted February 13, 2016 Author Share Posted February 13, 2016 Oh right, because anything after 'common_postinit' will basically be repeated each time you load the character or something like that, OK. Once I figure out why the server doesn't even want to launch while the mod is active, maybe I can finally test that. But thank you for your help, @PanAzej! Link to comment Share on other sites More sharing options...
AdipemDragon Posted February 13, 2016 Author Share Posted February 13, 2016 Well, after finally figuring out the thing that kept crashing my mod I got to test if that works... And it doesn't... ... local start_inv = { "trinket_21", "bird_egg" } local function OnNewSpawn(inst) inst.components.hunger.current = inst.components.hunger.max * 0.5 inst.components.health:SetPenalty(3) end local function onbecamehuman(inst) inst.components.locomotor:SetExternalSpeedMultiplier(inst, "wiego_speed_mod", 0.9) end ... Is this layed out correctly? Should I move it right before common_postinit? Also, the thing that prevented my mod from working was a misplaced dot instead of a comma in the speech file. Guess I overlooked it when I added new description lines. 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