Lukasai Posted March 14, 2015 Share Posted March 14, 2015 Heya! I'm back! Our mods me and my friends make with this forums help were super successful and I want to thank you all! We do have new characters in the works right now, and we really need help with all of the prefabs we've come up with~ Okay, so we'll need... How to make a custom item and how to make a character start out with said itemSanity increase around certain characters and decrease around certain other characters (If this isn't possible it's not 100% necessary!)How to make certain custom items craftable for only one character (And can you make food craftable? Because these items are food. I would just use the Crock Pot but im not sure how only a specific character being able to make the item would work with DST. That's all for now, if other problems or needs arise I'll be back ;-; Link to comment https://forums.kleientertainment.com/forums/topic/52012-character-prefab-help/ Share on other sites More sharing options...
rezecib Posted March 14, 2015 Share Posted March 14, 2015 ow to make a custom item and how to make a character start out with said item This guide will help a lot with that, although there are a few more details on the animation pipeline here, and a few things to update to DST. Sanity increase around certain characters and decrease around certain other characters (If this isn't possible it's not 100% necessary!) Add this to the character's master_postinit:sanityrates ={ wilson = 1, willow = -1,-- add whoever you want, 1 for giving sanity, -1 for decreasing}inst.components.sanity.custom_rate_fn = function(inst) local rate = 0 for k,v in pairs(AllPlayers) do if v ~= inst and sanityrates[v.prefab] then local max_radius_sq = 100 local distmult = 1 - math.max(1, inst:GetDistanceSqToInst(v)/max_radius_sq) rate = rate + sanityrates[v.prefab]*TUNING.SANITYAURA_TINY*distmult end end return rateendYou can play with the TUNING.SANITYAURA part to change how much it is, or just add another multiplier (other options for the SANITYAURA are _SMALL, _MED, _LARGE, _HUGE). How to make certain custom items craftable for only one character This is really easy now. (And can you make food craftable? Because these items are food. I would just use the Crock Pot but im not sure how only a specific character being able to make the item would work with DST. You can definitely make food craftable normally. Making recipes in a crockpot specific to a character is probably pretty hard, though. Link to comment https://forums.kleientertainment.com/forums/topic/52012-character-prefab-help/#findComment-621593 Share on other sites More sharing options...
Lukasai Posted March 17, 2015 Author Share Posted March 17, 2015 (edited) This guide will help a lot with that, although there are a few more details on the animation pipeline here, and a few things to update to DST. Add this to the character's master_postinit:sanityrates ={ wilson = 1, willow = -1,-- add whoever you want, 1 for giving sanity, -1 for decreasing}inst.components.sanity.custom_rate_fn = function(inst) local rate = 0 for k,v in pairs(AllPlayers) do if v ~= inst and sanityrates[v.prefab] then local max_radius_sq = 100 local distmult = 1 - math.max(1, inst:GetDistanceSqToInst(v)/max_radius_sq) rate = rate + sanityrates[v.prefab]*TUNING.SANITYAURA_TINY*distmult end end return rateendYou can play with the TUNING.SANITYAURA part to change how much it is, or just add another multiplier (other options for the SANITYAURA are _SMALL, _MED, _LARGE, _HUGE). This is really easy now. You can definitely make food craftable normally. Making recipes in a crockpot specific to a character is probably pretty hard, though. Okay, thank you so much!...butBecause i'm a total noob, i'm not sure I put the sanity raising/lowering thing in the right place. I found where to put it, i'm just not 100% it's in the right spot. I'd test it, but im not sure that'd work and that would make test results inaccurate.Here's the master_postinit.local master_postinit = function(inst)sanityrates ={ willow = -1, dante = -1, white = 1, lilum = 1, winston = 1, -- add whoever you want, 1 for giving sanity, -1 for decreasing}inst.components.sanity.custom_rate_fn = function(inst) local rate = 0 for k,v in pairs(AllPlayers) do if v ~= inst and sanityrates[v.prefab] then local max_radius_sq = 100 local distmult = 1 - math.max(1, inst:GetDistanceSqToInst(v)/max_radius_sq) rate = rate + sanityrates[v.prefab]*TUNING.SANITYAURA_TINY*distmult end end return rateend -- choose which sounds this character will play inst.soundsname = "wendy" -- Stats inst.components.combat.damagemultiplier = .8 inst.components.temperature.mintemp = 20. inst.components.health:SetMaxHealth(150) inst.components.hunger:SetMax(150) inst.components.sanity:SetMax(175) endI don't know... <.> Edited March 17, 2015 by Lukasai Link to comment https://forums.kleientertainment.com/forums/topic/52012-character-prefab-help/#findComment-622298 Share on other sites More sharing options...
rezecib Posted March 17, 2015 Share Posted March 17, 2015 @Lukasai, That looks right. Add a *100 or something to the "rate =" part to make the effect really noticeable, then you can tune it from there. I think the way I wrote it the effect may be too small to notice. Link to comment https://forums.kleientertainment.com/forums/topic/52012-character-prefab-help/#findComment-622317 Share on other sites More sharing options...
Lukasai Posted March 18, 2015 Author Share Posted March 18, 2015 @Lukasai, That looks right. Add a *100 or something to the "rate =" part to make the effect really noticeable, then you can tune it from there. I think the way I wrote it the effect may be too small to notice.http://prntscr.com/6i65auThat's what happened when I implemented it ;-;The part in question is:local master_postinit = function(inst)sanityrates ={ lilum = -1, luka = 1, -- add whoever you want, 1 for giving sanity, -1 for decreasing}inst.components.sanity.custom_rate_fn = function(inst) local rate = 0 for k,v in pairs(AllPlayers) do if v ~= inst and sanityrates[v.prefab] then local max_radius_sq = 100 local distmult = 1 - math.max(1, inst:GetDistanceSqToInst(v)/max_radius_sq) rate = rate + sanityrates[v.prefab]*TUNING.SANITYAURA_SMALL*distmult end end return rateend -- choose which sounds this character will play inst.soundsname = "wilson" -- Stats inst.components.health:SetMaxHealth(100) inst.components.hunger:SetMax(150) inst.components.sanity:SetMax(150)endreturn MakePlayerCharacter("winston", prefabs, assets, common_postinit, master_postinit, start_inv)Which is the master_postinit all the way to the end.And yes, im leaking this character to the world. Consider it a sneak peek. ;-; Link to comment https://forums.kleientertainment.com/forums/topic/52012-character-prefab-help/#findComment-622621 Share on other sites More sharing options...
rezecib Posted March 18, 2015 Share Posted March 18, 2015 @Lukasai, Oh, oops, add a "local" before the sanityrates table declaration. Link to comment https://forums.kleientertainment.com/forums/topic/52012-character-prefab-help/#findComment-622626 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