DarivenCZ Posted June 7, 2017 Share Posted June 7, 2017 Im making character mod. There will be character with an icy beard. Does anyone know, how to change the beard abbility to cool. Link to comment Share on other sites More sharing options...
GuyNamedChris Posted June 7, 2017 Share Posted June 7, 2017 Wrong place bud, you're looking for the Mods section. @ImDaMisterL can you move this topic? Link to comment Share on other sites More sharing options...
alainmcd Posted June 7, 2017 Share Posted June 7, 2017 (edited) Hi @DarivenCZ, welcome to the forums! Add this to your master_postinit function after AddComponent("beard"): inst.components.beard.insulation_factor = -1 Post here for modding questions. Edited June 7, 2017 by alainmcd Link to comment Share on other sites More sharing options...
DarivenCZ Posted June 8, 2017 Author Share Posted June 8, 2017 sorry it was my first time writing on forum Link to comment Share on other sites More sharing options...
DarivenCZ Posted June 9, 2017 Author Share Posted June 9, 2017 and thanks for help Link to comment Share on other sites More sharing options...
DarivenCZ Posted June 10, 2017 Author Share Posted June 10, 2017 I have one more question: how can i make my character overheat fast ? Link to comment Share on other sites More sharing options...
. . . Posted June 10, 2017 Share Posted June 10, 2017 This should make your character overheat faster ! inst.components.temperature.inherentsummerinsulation = -150 Link to comment Share on other sites More sharing options...
DarivenCZ Posted June 10, 2017 Author Share Posted June 10, 2017 thanks Link to comment Share on other sites More sharing options...
dudedudedude Posted June 11, 2017 Share Posted June 11, 2017 Can I ask a related question? How can I remove the sanity bonus from shaving the beard? Or change it into a penalty instead? Link to comment Share on other sites More sharing options...
alainmcd Posted June 11, 2017 Share Posted June 11, 2017 @dudedudedude, you can put this in your modmain.lua: local function beardpostinit(self) local OldShave = self.Shave self.Shave = function(self, who, withwhat) if who == self.inst and who.prefab == "yourcharacter" then local SANITYBONUS = 0 local sanitysmall = GLOBAL.TUNING.SANITY_SMALL GLOBAL.TUNING.SANITY_SMALL = SANITYBONUS local shaved, reason = OldShave(self, who, withwhat) GLOBAL.TUNING.SANITY_SMALL = sanitysmall return shaved, reason else return OldShave(self, who, withwhat) end end end AddComponentPostInit("beard", beardpostinit) Or try something more elegant. Link to comment Share on other sites More sharing options...
DarivenCZ Posted June 12, 2017 Author Share Posted June 12, 2017 And now i would like that in every phase of the beard my character will have different stats (health,sanity,hunger). Thanks for Answer Link to comment Share on other sites More sharing options...
DarivenCZ Posted June 12, 2017 Author Share Posted June 12, 2017 If it is possible Link to comment Share on other sites More sharing options...
alainmcd Posted June 12, 2017 Share Posted June 12, 2017 3 hours ago, DarivenCZ said: And now i would like that in every phase of the beard my character will have different stats (health,sanity,hunger). Thanks for Answer local function beardpostinit(self) local OldShave = self.Shave self.Shave = function(self, who, withwhat) if who == self.inst and who.prefab == "yourcharacter" then local SANITYBONUS = (GLOBAL.TheWorld.state.isday and 0) or (GLOBAL.TheWorld.state.isdusk and 5) or -50 local sanitysmall = GLOBAL.TUNING.SANITY_SMALL GLOBAL.TUNING.SANITY_SMALL = SANITYBONUS local shaved, reason = OldShave(self, who, withwhat) GLOBAL.TUNING.SANITY_SMALL = sanitysmall if shaved and who.components.health and not who:HasTag("playerghost") then local HEALTHBONUS = (GLOBAL.TheWorld.state.isday and 10) or (GLOBAL.TheWorld.state.isdusk and -20) or 30 who.components.health:DoDelta(HEALTHBONUS) end return shaved, reason else return OldShave(self, who, withwhat) end end end AddComponentPostInit("beard", beardpostinit) Untested. Link to comment Share on other sites More sharing options...
Lumina Posted June 12, 2017 Share Posted June 12, 2017 (Just want to thanks alainmcd for the help you provide, it's nice to you) Link to comment Share on other sites More sharing options...
alainmcd Posted June 12, 2017 Share Posted June 12, 2017 @Lumina, thank you for the kind words. I always see you helping others around here. Great work! Link to comment Share on other sites More sharing options...
DarivenCZ Posted June 12, 2017 Author Share Posted June 12, 2017 Thanks for help alainmcd I really appreciate it. I have one and last thing. What means "AddcomponentPostInIt is not declared". I am still new in programming dont starve mods and I do not know what I have to do Link to comment Share on other sites More sharing options...
alainmcd Posted June 12, 2017 Share Posted June 12, 2017 It means it can't find AddcomponentPostInIt. Lua is case sensitive, so AddcomponentPostInIt is not the same as AddComponentPostInit. AddComponentPostInit is a special function that allows your mod to modify or extend a certain component; its first argument is the component to manipulate, the second argument should be a function to apply to said component. AddPrefabPostInit does the same for prefabs. Link to comment Share on other sites More sharing options...
DarivenCZ Posted June 13, 2017 Author Share Posted June 13, 2017 (edited) 22 hours ago, alainmcd said: local function beardpostinit(self) local OldShave = self.Shave self.Shave = function(self, who, withwhat) if who == self.inst and who.prefab == "yourcharacter" then local SANITYBONUS = (GLOBAL.TheWorld.state.isday and 0) or (GLOBAL.TheWorld.state.isdusk and 5) or -50 local sanitysmall = GLOBAL.TUNING.SANITY_SMALL GLOBAL.TUNING.SANITY_SMALL = SANITYBONUS local shaved, reason = OldShave(self, who, withwhat) GLOBAL.TUNING.SANITY_SMALL = sanitysmall if shaved and who.components.health and not who:HasTag("playerghost") then local HEALTHBONUS = (GLOBAL.TheWorld.state.isday and 10) or (GLOBAL.TheWorld.state.isdusk and -20) or 30 who.components.health:DoDelta(HEALTHBONUS) end return shaved, reason else return OldShave(self, who, withwhat) end end end AddComponentPostInit("beard", beardpostinit) Untested. Is there anything else I have to rename except yourcharacter ? And thanks for the awnser. Edited June 13, 2017 by DarivenCZ Link to comment Share on other sites More sharing options...
dudedudedude Posted June 13, 2017 Share Posted June 13, 2017 @alainmcd Have you got any idea why the beard does not show on a character despite the game starting up normally? I deleted the extra features I got from here so it was just basic Wilson beard, but the beard still did not show up on my test character in game. Link to comment Share on other sites More sharing options...
alainmcd Posted June 13, 2017 Share Posted June 13, 2017 @DarivenCZ, changing yourcharacter should be enough. Change the values as you please. @dudedudedude, no, since I haven't seen your code. Even then, I'm hardly the person to ask about animations. Have you used the beard component's AddCallBack? AnimState:OverrideSymbol? Link to comment Share on other sites More sharing options...
DarivenCZ Posted June 13, 2017 Author Share Posted June 13, 2017 (edited) Still nothing. The Warning sreen still tells "variable AddComponentInit is not declared" have i done something wrong ? my characters name is wintel : local function beardpostinit(self) local OldShave = self.Shave self.Shave = function(self, who, withwhat) if who == self.inst and who.prefab == "wintel" then local SANITYBONUS = (GLOBAL.TheWorld.state.isday and 0) or (GLOBAL.TheWorld.state.isdusk and 5) or -50 local sanitysmall = GLOBAL.TUNING.SANITY_SMALL GLOBAL.TUNING.SANITY_SMALL = SANITYBONUS local shaved, reason = OldShave(self, who, withwhat) GLOBAL.TUNING.SANITY_SMALL = sanitysmall if shaved and who.components.health and not who:HasTag("playerghost") then local HEALTHBONUS = (GLOBAL.TheWorld.state.isday and 10) or (GLOBAL.TheWorld.state.isdusk and -20) or 30 who.components.health:DoDelta(HEALTHBONUS) end return shaved, reason else return OldShave(self, who, withwhat) end end end AddComponentPostInit("beard", beardpostinit) thanks for help Edited June 13, 2017 by DarivenCZ Link to comment Share on other sites More sharing options...
alainmcd Posted June 13, 2017 Share Posted June 13, 2017 This belongs in your modmain.lua, not your character file. Are you placing it there? Link to comment Share on other sites More sharing options...
DarivenCZ Posted June 13, 2017 Author Share Posted June 13, 2017 facepalm - thanks Link to comment Share on other sites More sharing options...
DarivenCZ Posted June 13, 2017 Author Share Posted June 13, 2017 what i have to change if i want to increase his sanity in small beard +20 in middle beard + 20 and so on. Again thanks for help Link to comment Share on other sites More sharing options...
alainmcd Posted June 13, 2017 Share Posted June 13, 2017 I'd suggest using inst.component.beard:AddCallback() in your character's master_postinit. 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