tehMugwump Posted July 25, 2013 Share Posted July 25, 2013 (edited) Ok, on Wolfgang Classic, I've had to include the whole damn hats.lua file because I can't get this ONE line to work from the modmain:Hats.lua:if owner:HasTag("player") then--owner.AnimState:Hide("HEAD") -- this keeps his head from dissappearing when wearing hatsendWhat I'd LIKE to do:Modmain (with or without the 'if' statement):function show_Head(inst)if owner:HasTag("player") thenowner.AnimState:Show("HEAD")endend---------------AddPrefabPostInit("hats", show_Head)Of course the simplest approach won't work for me.I think it's another case of, hats.lua is loaded on start, then the modmain, but the modmain won't be effective if hats are swapped after load... Edited July 25, 2013 by tehMugwump Link to comment https://forums.kleientertainment.com/forums/topic/18801-modders-your-new-friend-at-klei/page/18/#findComment-264575 Share on other sites More sharing options...
infernalthing Posted July 25, 2013 Share Posted July 25, 2013 How can you make your character be able to finish adventure mode and be put on the throne?Does this have to do with animations or the puppet.lua/maxwellthrone.lua? Link to comment https://forums.kleientertainment.com/forums/topic/18801-modders-your-new-friend-at-klei/page/18/#findComment-264892 Share on other sites More sharing options...
tehMugwump Posted July 25, 2013 Share Posted July 25, 2013 (edited) [MENTION=55]Ipsquiggle[/MENTION], in Test Tools, GetMouseWordPos now crashes the game. (used to spawn entities and objects with GetMouseWordPos).Test Tools >> commands.lua:55 - inst.Transform:SetPosition(TheInput:GetMouseWorldPos():Get())Here's the error from log:..._starve/data/../mods/Test Tools/scripts/commands.lua:55: attempt to call method 'GetMouseWorldPos' (a nil value)LUA ERROR stack traceback: C:/Program Files/Steam/steamapps/common/dont_starve/data/../mods/Test Tools/scripts/commands.lua(55,1) in function 'Spawn' C:/Program Files/Steam/steamapps/common/dont_starve/data/../mods/Test Tools/scripts/components/testtoolcontroller.lua(126,1) in function 'fn' C:/Program Files/Steam/steamapps/common/dont_starve/data/scripts/events.lua(46,1) in function 'HandleEvent' C:/Program Files/Steam/steamapps/common/dont_starve/data/scripts/input.lua(96,1) in function 'OnKey' C:/Program Files/Steam/steamapps/common/dont_starve/data/scripts/input.lua(223,1)C:/Program Files/Steam/steamapps/common/dont_starve/data/scripts/frontend.lua(257,1) SCRIPT ERROR! Showing error screenSomething must have changed with 'GetMouseWorldPos' because Spawn(self.entityPrefab) still works with the other commands (inventory, food, etc) Edited July 25, 2013 by tehMugwump Link to comment https://forums.kleientertainment.com/forums/topic/18801-modders-your-new-friend-at-klei/page/18/#findComment-265049 Share on other sites More sharing options...
simplex Posted July 25, 2013 Share Posted July 25, 2013 (edited) Ok, on Wolfgang Classic, I've had to include the whole damn hats.lua file because I can't get this ONE line to work from the modmain:Hats.lua:if owner:HasTag("player") then--owner.AnimState:Hide("HEAD") -- this keeps his head from dissappearing when wearing hatsendTry this:AddSimPostInit(function(inst) if inst.prefab == "wolfgang" then inst:ListenForEvent("equipped", function(inst, data) if data.slot == GLOBAL.EQUIPSLOTS.HEAD then inst.AnimState:Show("HEAD") end end) endend)I'm assuming you're still overriding the standard wolfgang prefab in your wolfgang classic mod. If not, change the name of the prefab accordingly. Edited July 25, 2013 by simplex Link to comment https://forums.kleientertainment.com/forums/topic/18801-modders-your-new-friend-at-klei/page/18/#findComment-265069 Share on other sites More sharing options...
tehMugwump Posted July 25, 2013 Share Posted July 25, 2013 Try this:AddSimPostInit(function(inst) if inst.prefab == "wolfgang" then inst:ListenForEvent("equipped", function(inst, data) if data.slot == GLOBAL.EQUIPSLOTS.HEAD then inst.AnimState:Show("HEAD") end end) endend)I'm assuming you're still overriding the standard wolfgang prefab in your wolfgang classic mod. If not, change the name of the prefab accordingly.ooooo, thanks. I'll give it a go! Link to comment https://forums.kleientertainment.com/forums/topic/18801-modders-your-new-friend-at-klei/page/18/#findComment-265073 Share on other sites More sharing options...
simplex Posted July 25, 2013 Share Posted July 25, 2013 (edited) [MENTION=55]Ipsquiggle[/MENTION], in Test Tools, GetMouseWordPos now crashes the game. (used to spawn entities and objects with GetMouseWordPos).Test Tools >> commands.lua:55 - inst.Transform:SetPosition(TheInput:GetMouseWorldPos():Get())TheInput:GetMouseWorldPos() no longer exists. Replacing it by TheInput:GetWorldPosition() should do it.---edit---Actually, TheInput:GetWorldPosition():Get() will give you the same as TheSim:GetPosition(), so you may prefer the latter (or not).---edit 2---I'm guessing this change was made so that naming conventions would fit conceptually with the PS4. Although I think TheInput:GetWorldPosition() should've been aliased to the old TheInput:GetMouseWorldPos() to preserve compatibility with older code, especially since that would've required a single line of code. Edited July 25, 2013 by simplex Link to comment https://forums.kleientertainment.com/forums/topic/18801-modders-your-new-friend-at-klei/page/18/#findComment-265077 Share on other sites More sharing options...
tehMugwump Posted July 26, 2013 Share Posted July 26, 2013 No longer exists? Just like that? Sheesh.Thanks for looking into this [MENTION=44092]simplex[/MENTION]. Gives me a place to start!TheInput:GetMouseWorldPos() no longer exists. Replacing it by TheInput:GetWorldPosition() should do it.---edit---Actually, TheInput:GetWorldPosition():Get() will give you the same as TheSim:GetPosition(), so you may prefer the latter (or not).---edit 2---I'm guessing this change was made so that naming conventions would fit conceptually with the PS4. Although I think TheInput:GetWorldPosition() should've been aliased to the old TheInput:GetMouseWorldPos() to preserve compatibility with older code, especially since that would've required a single line of code. Link to comment https://forums.kleientertainment.com/forums/topic/18801-modders-your-new-friend-at-klei/page/18/#findComment-265231 Share on other sites More sharing options...
simplex Posted July 26, 2013 Share Posted July 26, 2013 No longer exists? Just like that? Sheesh.Thanks for looking into this [MENTION=44092]simplex[/MENTION]. Gives me a place to start!No problem. Replacing TheInput:GetMouseWorldPos() by TheInput:GetWorldPosition() really should be all you need, since TheInput:GetWorldPosition() works just like TheInput:GetMouseWorldPos() used to. And, in fact, that's what the new DebugSpawn() does! Link to comment https://forums.kleientertainment.com/forums/topic/18801-modders-your-new-friend-at-klei/page/18/#findComment-265234 Share on other sites More sharing options...
tehMugwump Posted July 26, 2013 Share Posted July 26, 2013 Worked like a charm. Thanks again!No problem. Replacing TheInput:GetMouseWorldPos() by TheInput:GetWorldPosition() really should be all you need, since TheInput:GetWorldPosition() works just like TheInput:GetMouseWorldPos() used to. And, in fact, that's what the new DebugSpawn() does!One other thing that is now broke is 'Freebuild'.This no longer works and I have no clue what's changed with the new tech tree here either...function Freebuild() local inst = GetPlayer() if inst then if inst.components.builder.freebuildmode then inst.components.builder.freebuildmode = false else inst.components.builder.freebuildmode = true end inst:PushEvent("techlevelchange") endend Link to comment https://forums.kleientertainment.com/forums/topic/18801-modders-your-new-friend-at-klei/page/18/#findComment-265625 Share on other sites More sharing options...
simplex Posted July 26, 2013 Share Posted July 26, 2013 Worked like a charm. Thanks again!One other thing that is now broke is 'Freebuild'.This no longer works and I have no clue what's changed with the new tech tree here either...function Freebuild() local inst = GetPlayer() if inst then if inst.components.builder.freebuildmode then inst.components.builder.freebuildmode = false else inst.components.builder.freebuildmode = true end inst:PushEvent("techlevelchange") endendThe event's name has changed. Try replacing "techlevelchange" by "techtreechange". Link to comment https://forums.kleientertainment.com/forums/topic/18801-modders-your-new-friend-at-klei/page/18/#findComment-266039 Share on other sites More sharing options...
tehMugwump Posted July 26, 2013 Share Posted July 26, 2013 The event's name has changed. Try replacing "techlevelchange" by "techtreechange".Thanks again [MENTION=44092]simplex[/MENTION]. Is this something I should have known? Were did you learn of these changes? Link to comment https://forums.kleientertainment.com/forums/topic/18801-modders-your-new-friend-at-klei/page/18/#findComment-266054 Share on other sites More sharing options...
Developer Ipsquiggle Posted July 26, 2013 Author Developer Share Posted July 26, 2013 Worked like a charm. Thanks again!One other thing that is now broke is 'Freebuild'.This no longer works and I have no clue what's changed with the new tech tree here either...function Freebuild() local inst = GetPlayer() if inst then if inst.components.builder.freebuildmode then inst.components.builder.freebuildmode = false else inst.components.builder.freebuildmode = true end inst:PushEvent("techlevelchange") endendWhoops, sorry I've missed all this, between the broken notifications and the release business, I forgot to check this thread...I notice that in the development branch the event pushed is "unlockrecipe". Try that instead perhaps? Link to comment https://forums.kleientertainment.com/forums/topic/18801-modders-your-new-friend-at-klei/page/18/#findComment-266060 Share on other sites More sharing options...
simplex Posted July 26, 2013 Share Posted July 26, 2013 Whoops, sorry I've missed all this, between the broken notifications and the release business, I forgot to check this thread...I notice that in the development branch the event pushed is "unlockrecipe". Try that instead perhaps?Both "unlockrecipe" and "techtreechange" should work, since in widgets/crafting.lua we have both the linesself.inst:ListenForEvent("techtreechange", function(inst, data) self:UpdateRecipes() end, self.owner)andself.inst:ListenForEvent("unlockrecipe", function(inst, data) self:UpdateRecipes() end, self.owner)Moreover, since that's the only place in the game code that makes use of both events, these approaches should have exactly the same effect. I just suggested "techtreechange" because it's a more direct analogue to the old "techlevelchange".Thanks again [MENTION=44092]simplex[/MENTION]. Is this something I should have known? Were did you learn of these changes?Since these changes are not really documented, it's perfectly understandable that you didn't know of them. I learned of them by reading the game code. Link to comment https://forums.kleientertainment.com/forums/topic/18801-modders-your-new-friend-at-klei/page/18/#findComment-266076 Share on other sites More sharing options...
tehMugwump Posted July 26, 2013 Share Posted July 26, 2013 Ah, unlockrecipe seemed to do it. That was one of the last pieces of the puzzle. Couldn't have done it without you guys! Link to comment https://forums.kleientertainment.com/forums/topic/18801-modders-your-new-friend-at-klei/page/18/#findComment-266204 Share on other sites More sharing options...
Lexicroft Posted July 26, 2013 Share Posted July 26, 2013 Jeez, just now want to update my character mods, I just start Don't starve and it instantly kick me out, then I download samplecharacter mod and see what is different, the bigportraits is the problem, I got it, start the game, and it works.Then I enable my character item mods, and it just kick me again, I just can't see / know what is error but I think it just the .tex again but what, then I download sample prefab, and I just don't know what is changed. Is there anybody already done this? Link to comment https://forums.kleientertainment.com/forums/topic/18801-modders-your-new-friend-at-klei/page/18/#findComment-266267 Share on other sites More sharing options...
Lexicroft Posted July 26, 2013 Share Posted July 26, 2013 OH MY!There is change in build.binI think I get it but, this will be nasty ton of works, redo all of my item one by oneNnnnnnnnnnnnnnnnooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooo Link to comment https://forums.kleientertainment.com/forums/topic/18801-modders-your-new-friend-at-klei/page/18/#findComment-266354 Share on other sites More sharing options...
tehMugwump Posted July 26, 2013 Share Posted July 26, 2013 If you haven't yet, check out your log.txt file. It almost always points you to the trouble spot from a crash.Jeez, just now want to update my character mods, I just start Don't starve and it instantly kick me out, then I download samplecharacter mod and see what is different, the bigportraits is the problem, I got it, start the game, and it works.Then I enable my character item mods, and it just kick me again, I just can't see / know what is error but I think it just the .tex again but what, then I download sample prefab, and I just don't know what is changed. Is there anybody already done this? Link to comment https://forums.kleientertainment.com/forums/topic/18801-modders-your-new-friend-at-klei/page/18/#findComment-266406 Share on other sites More sharing options...
tehMugwump Posted July 26, 2013 Share Posted July 26, 2013 Hmmm, not working. It reads up to the listen event, but then nothing. (I get prints outs up to that point)Also, if I throw in 'inst.AnimState:Show("HEAD")' up front, Wolfgang's head shows on load, but as soon as I switch hats, it vanishes...AddSimPostInit(function(inst)print "about to enter 'head' sim post init..." if inst.prefab == "wolfgang" then inst.AnimState:Show("HEAD") print "now IN 'head' sim post init..." inst:ListenForEvent("equipped", function(inst, data) if data.slot == GLOBAL.EQUIPSLOTS.HEAD then print "now IN GLOBAL.EQUIPSLOTS.HEAD check..." inst.AnimState:Show("HEAD") print "head should be showing" end end) endend)Try this:AddSimPostInit(function(inst) if inst.prefab == "wolfgang" then inst:ListenForEvent("equipped", function(inst, data) if data.slot == GLOBAL.EQUIPSLOTS.HEAD then inst.AnimState:Show("HEAD") end end) endend)I'm assuming you're still overriding the standard wolfgang prefab in your wolfgang classic mod. If not, change the name of the prefab accordingly. Link to comment https://forums.kleientertainment.com/forums/topic/18801-modders-your-new-friend-at-klei/page/18/#findComment-266411 Share on other sites More sharing options...
simplex Posted July 26, 2013 Share Posted July 26, 2013 Hmmm, not working. It reads up to the listen event, but then nothing. (I get prints outs up to that point)Ouch, huge "duh!" moment for me. It's not the equipper that receives the "equipped" event, but the item that gets equipped. This should work:AddComponentPostInit("equippable", function(Equippable, inst) inst:ListenForEvent("equipped", function(inst, data) if data.slot == GLOBAL.EQUIPSLOTS.HEAD and data.owner.prefab == "wolfgang" then data.owner.AnimState:Show("HEAD") end end)end) Link to comment https://forums.kleientertainment.com/forums/topic/18801-modders-your-new-friend-at-klei/page/18/#findComment-266532 Share on other sites More sharing options...
Lexicroft Posted July 27, 2013 Share Posted July 27, 2013 (edited) If you haven't yet, check out your log.txt file. It almost always points you to the trouble spot from a crash.Thank you , [MENTION=10028]tehMugwump[/MENTION]I now can exactly know what is not working , thanks to you :)But now I got new problem-I have a custom recipetabs-I have a custom item in my custom recipetabsE:/Games/Steam/steamapps/common/dont_starve/data/scripts/mods.lua(17,1) error calling gamepostinit in mod BRSITEM: ...steamapps/common/dont_starve/data/scripts/recipe.lua:26: attempt to index field 'level' (a number value)LUA ERROR stack traceback: E:/Games/Steam/steamapps/common/dont_starve/data/scripts/recipe.lua(26,1) in function '_ctor' E:/Games/Steam/steamapps/common/dont_starve/data/scripts/class.lua(28,1) in function 'Recipe' E:/Games/Steam/steamapps/common/dont_starve/data/../mods/BRSITEM/modmain.lua(148,1) =(tail call) ? =[C] in function 'xpcall' E:/Games/Steam/steamapps/common/dont_starve/data/scripts/mods.lua(15,1) E:/Games/Steam/steamapps/common/dont_starve/data/scripts/mods.lua(405,1) in function 'SetPostEnv' E:/Games/Steam/steamapps/common/dont_starve/data/scripts/mainfunctions.lua(562,1)It seems there is a new way how to declare recipe ?So, How it works now?Thanks anyway Edited July 27, 2013 by Lexicroft Link to comment https://forums.kleientertainment.com/forums/topic/18801-modders-your-new-friend-at-klei/page/18/#findComment-266973 Share on other sites More sharing options...
tehMugwump Posted July 27, 2013 Share Posted July 27, 2013 Here you go. Look under 'Tech Trees'.Thank you , [MENTION=10028]tehMugwump[/MENTION]I now can exactly know what is not working , thanks to you But now I got new problem-I have a custom recipetabs-I have a custom item in my custom recipetabsE:/Games/Steam/steamapps/common/dont_starve/data/scripts/mods.lua(17,1) error calling gamepostinit in mod BRSITEM: ...steamapps/common/dont_starve/data/scripts/recipe.lua:26: attempt to index field 'level' (a number value)LUA ERROR stack traceback: E:/Games/Steam/steamapps/common/dont_starve/data/scripts/recipe.lua(26,1) in function '_ctor' E:/Games/Steam/steamapps/common/dont_starve/data/scripts/class.lua(28,1) in function 'Recipe' E:/Games/Steam/steamapps/common/dont_starve/data/../mods/BRSITEM/modmain.lua(148,1) =(tail call) ? =[C] in function 'xpcall' E:/Games/Steam/steamapps/common/dont_starve/data/scripts/mods.lua(15,1) E:/Games/Steam/steamapps/common/dont_starve/data/scripts/mods.lua(405,1) in function 'SetPostEnv' E:/Games/Steam/steamapps/common/dont_starve/data/scripts/mainfunctions.lua(562,1)It seems there is a new way how to declare recipe ?So, How it works now?Thanks anyway Link to comment https://forums.kleientertainment.com/forums/topic/18801-modders-your-new-friend-at-klei/page/18/#findComment-267309 Share on other sites More sharing options...
_Q_ Posted July 27, 2013 Share Posted July 27, 2013 How to remove recipe from recipe tab? Like I want to remove crock pot from recipe tab, so when the game starts there is no crock pot recipe. Link to comment https://forums.kleientertainment.com/forums/topic/18801-modders-your-new-friend-at-klei/page/18/#findComment-267313 Share on other sites More sharing options...
simplex Posted July 27, 2013 Share Posted July 27, 2013 How to remove recipe from recipe tab? Like I want to remove crock pot from recipe tab, so when the game starts there is no crock pot recipe.I'm not sure you can remove a recipe, properly. But if not, you can hide it by attaching a filter to the crafting widget. In this scenario, a filter is just a function that will receive each recipe's name and return true or false. Check widgets/crafting.lua for details. Link to comment https://forums.kleientertainment.com/forums/topic/18801-modders-your-new-friend-at-klei/page/18/#findComment-267562 Share on other sites More sharing options...
_Q_ Posted July 27, 2013 Share Posted July 27, 2013 I'm not sure you can remove a recipe, properly. But if not, you can hide it by attaching a filter to the crafting widget. In this scenario, a filter is just a function that will receive each recipe's name and return true or false. Check widgets/crafting.lua for details.There is some function in player_common.lua --give the default recipes for k,v in pairs(Recipes) do if v.level == 0 then inst.components.builder:AddRecipe(v.name) end endMaybe I could edit that with PrefabPostInit. Link to comment https://forums.kleientertainment.com/forums/topic/18801-modders-your-new-friend-at-klei/page/18/#findComment-267813 Share on other sites More sharing options...
Lexicroft Posted July 27, 2013 Share Posted July 27, 2013 Here you go. Look under 'Tech Trees'.Thanks to you, it's done Link to comment https://forums.kleientertainment.com/forums/topic/18801-modders-your-new-friend-at-klei/page/18/#findComment-267832 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