PaladinPlayer Posted December 17, 2014 Share Posted December 17, 2014 Hi Community! After trying to create a cosmetic mod that adds a new character to Don't Starve Together (and succeeding! (http://steamcommunity.com/sharedfiles/filedetails/?id=355886074) I decided to try and add stats to it but that's when the problem kicked in, when ever I tried to change her stats my game crashed and said the changed stat was a nil value.Also (a commenter's idea) I wanted to try to add birds not flying away from her if she had no weapon equipped. ANY help is appreciated because my knowledge on modding is fairly limited and also if you do help me (if you want) I'll add your name/your url to the mod page referencing your kindness in helping me. (The download is the crash image with the changed stat from the lua file.) (and this link should take you to the mod page as I couldn't upload the base mod) http://steamcommunity.com/sharedfiles/filedetails/?id=355886074 Link to comment Share on other sites More sharing options...
rezecib Posted December 17, 2014 Share Posted December 17, 2014 @PaladinPlayer, Split fn into two functions (which both need to be passed to MakePlayerCharacter). The game calls these functions common_postinit and master_postinit, but you can call them whatever. Most of the stuff (all of the stuff I see in your screenshot) should be in the master_postinit, except maybe the soundsname. Currently it's interpreting your fn() as the common_postinit. Link to comment Share on other sites More sharing options...
Dragon Wolf Leo Posted December 17, 2014 Share Posted December 17, 2014 Like rezecib said, you need to split your fn into two functions. The common_postinit deals with client-sided components such as the minimap icon and the talker component, while master_postinit is for only the host. Many components are host-sided, and I think that includes the locomotor. Link to comment Share on other sites More sharing options...
PaladinPlayer Posted December 17, 2014 Author Share Posted December 17, 2014 Thanks for your all of your help guys!I just have to questions,Firstly did you have any url, name or mod that you wanted me to use to reference you being extremely helpful on the workshop?And secondly I wanted to make her an ornithologist but I figured have birds not fly away from her who be two over powered (especially winter), So would you have any ideas for a bird-themed ability? Link to comment Share on other sites More sharing options...
PaladinPlayer Posted December 17, 2014 Author Share Posted December 17, 2014 @PaladinPlayer, Split fn into two functions (which both need to be passed to MakePlayerCharacter). The game calls these functions common_postinit and master_postinit, but you can call them whatever. Most of the stuff (all of the stuff I see in your screenshot) should be in the master_postinit, except maybe the soundsname. Currently it's interpreting your fn() as the common_postinit. Like rezecib said, you need to split your fn into two functions. The common_postinit deals with client-sided components such as the minimap icon and the talker component, while master_postinit is for only the host. Many components are host-sided, and I think that includes the locomotor. Thanks for your all of your help guys!I just have to questions,Firstly did you have any url, name or mod that you wanted me to use to reference you being extremely helpful on the workshop?And secondly I wanted to make her an ornithologist but I figured have birds not fly away from her who be two over powered (especially winter), So would you have any ideas for a bird-themed ability? I will be giving her bird-themed starting items but I was wondering if you guys had any ideas for an ability. Link to comment Share on other sites More sharing options...
Dryicefox Posted December 18, 2014 Share Posted December 18, 2014 I will be giving her bird-themed starting items but I was wondering if you guys had any ideas for an ability.Use a thing as a fan. -5 temp -10 hunger Link to comment Share on other sites More sharing options...
PaladinPlayer Posted December 20, 2014 Author Share Posted December 20, 2014 @PaladinPlayer, Split fn into two functions (which both need to be passed to MakePlayerCharacter). The game calls these functions common_postinit and master_postinit, but you can call them whatever. Most of the stuff (all of the stuff I see in your screenshot) should be in the master_postinit, except maybe the soundsname. Currently it's interpreting your fn() as the common_postinit. Hey @rezecib, do you know how to change drop rates for birds? Link to comment Share on other sites More sharing options...
rezecib Posted December 20, 2014 Share Posted December 20, 2014 @PaladinPlayer, I didn't, but now I do. But do you mean the rate at which birds appear, or the rate at which they drop seeds? For birds appearance,GLOBAL.TUNING.BIRD_SPAWN_DELAY = {min=5, max=15}GLOBAL.TUNING.BIRD_SPAWN_MAX = 4 -- max number of birds that can spawnGLOBAL.TUNING.BIRD_SPAWN_DELAY_FEATHERHAT = {min=2, max=10}GLOBAL.TUNING.BIRD_SPAWN_MAX_FEATHERHAT = 7Those being the default values. For birds seed drop rate, for k,v in pairs({'robin', 'robin_winter', 'crow'}) do AddPrefabPostInit(v, function(inst) if GLOBAL.TheWorld.ismastersim then inst.components.periodicspawner:SetRandomTimes(40, 60) end end)end40 is the default base time, and 60 is the default variance in that time. So you can set those as you want. Although I'm guessing you wanted to do it in a character-specific way, it looks like there's no built-in support for that. Even the bird hat appears to globally increase bird spawn rates. If you want to make it specific to your character, you'll probably have to substitute the birdspawner component with a version of your own that checks for your character and gives them special treatment. Link to comment Share on other sites More sharing options...
PaladinPlayer Posted December 20, 2014 Author Share Posted December 20, 2014 @PaladinPlayer, I didn't, but now I do. But do you mean the rate at which birds appear, or the rate at which they drop seeds? For birds appearance,GLOBAL.TUNING.BIRD_SPAWN_DELAY = {min=5, max=15}GLOBAL.TUNING.BIRD_SPAWN_MAX = 4 -- max number of birds that can spawnGLOBAL.TUNING.BIRD_SPAWN_DELAY_FEATHERHAT = {min=2, max=10}GLOBAL.TUNING.BIRD_SPAWN_MAX_FEATHERHAT = 7Those being the default values. For birds seed drop rate, for k,v in pairs({'robin', 'robin_winter', 'crow'}) do AddPrefabPostInit(v, function(inst) if GLOBAL.TheWorld.ismastersim then inst.components.periodicspawner:SetRandomTimes(40, 60) end end)end40 is the default base time, and 60 is the default variance in that time. So you can set those as you want. Although I'm guessing you wanted to do it in a character-specific way, it looks like there's no built-in support for that. Even the bird hat appears to globally increase bird spawn rates. If you want to make it specific to your character, you'll probably have to substitute the birdspawner component with a version of your own that checks for your character and gives them special treatment. @rezecib I was thinking along the lings of when birds were murdered (in inventory not using and form of combat) they would drop more meat or feathers because she knows the anatomy of birds very well. Also would there be anyway to stop birds flying away? I was thinking if they did not fly away from here she could catch or kill the birds at a cost of sanity. Link to comment Share on other sites More sharing options...
PaladinPlayer Posted December 20, 2014 Author Share Posted December 20, 2014 (edited) I'm think going to make her vegetarian Edited December 23, 2014 by PaladinPlayer Link to comment Share on other sites More sharing options...
rezecib Posted December 20, 2014 Share Posted December 20, 2014 @PaladinPlayer, Well, for dropping more morsels/feathers, that depends on how you want to do it. You'd modify the lootdropper component for birds.for k,v in pairs({'robin', 'robin_winter', 'crow'}) do AddPrefabPostInit(v, function(inst) if GLOBAL.TheWorld.ismastersim then for i,e in pairs(inst.components.lootdropper.randomloot) do -- this would change the chance from 50/50 feather/morsel to 66/33 feather/morsel if e.prefab == "feather_"..v.prefab then e.weight = 2 end end -- you have to fix the total random weight after doing this (previous weights were 1 for both feather and morsel) inst.components.lootropper.totalrandomweight = inst.components.lootdropper.totalrandomweight + 1 end end)endOr... you could make it so that there's an additional 50% chance of a feather (so it'll drop either a feather or a morsel, then have a 50% chance of dropping a feather):for k,v in pairs({'robin', 'robin_winter', 'crow'}) do AddPrefabPostInit(v, function(inst) if GLOBAL.TheWorld.ismastersim then inst.components.lootdropper:AddChanceLoot("feather_"..v.prefab, 0.5) end end)endAs for making her not scare birds away... that's harder, because I think it's handled by the scarytoprey tag normally, which also affects bunnies. So you'd probably have to change the bird brain to also check for another tag that overrides scarytoprey. Link to comment Share on other sites More sharing options...
PaladinPlayer Posted December 22, 2014 Author Share Posted December 22, 2014 (edited) @PaladinPlayer, Well, for dropping more morsels/feathers, that depends on how you want to do it. You'd modify the lootdropper component for birds.for k,v in pairs({'robin', 'robin_winter', 'crow'}) do AddPrefabPostInit(v, function(inst) if GLOBAL.TheWorld.ismastersim then for i,e in pairs(inst.components.lootdropper.randomloot) do -- this would change the chance from 50/50 feather/morsel to 66/33 feather/morsel if e.prefab == "feather_"..v.prefab then e.weight = 2 end end -- you have to fix the total random weight after doing this (previous weights were 1 for both feather and morsel) inst.components.lootropper.totalrandomweight = inst.components.lootdropper.totalrandomweight + 1 end end)endOr... you could make it so that there's an additional 50% chance of a feather (so it'll drop either a feather or a morsel, then have a 50% chance of dropping a feather):for k,v in pairs({'robin', 'robin_winter', 'crow'}) do AddPrefabPostInit(v, function(inst) if GLOBAL.TheWorld.ismastersim then inst.components.lootdropper:AddChanceLoot("feather_"..v.prefab, 0.5) end end)endAs for making her not scare birds away... that's harder, because I think it's handled by the scarytoprey tag normally, which also affects bunnies. So you'd probably have to change the bird brain to also check for another tag that overrides scarytoprey.@rezecib I toyed around with the distance birds see the play at changed it to zero and now the birds will not fly away. This works but it will apply to everyone on the server so I will keep looking and messing around with code but the real thing I wanted to ask you about was crashing when ever I try to add the ghost build to then anim folder it crashes but if I don't do know include it the ghost is invisible and any shift tabbing, alt tabbing or pressing escape will crash the game with out a log in don't starve and it will create a window saying don't starve has stopped working. So if you could help me out (again) that would be greatly appreciated (this seems to be a reoccurring problem.) Nevermind the ghost is visible now but shift-tabbing will still crash the game. Edited December 23, 2014 by PaladinPlayer 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