Alpaca's, Starving Posted March 22, 2013 Share Posted March 22, 2013 So in my mod Uncraftable Craftables I was thinking of updating it when I thought of an idea that you could backwash your items to there original state I was thinking of a new wigdet like in Handy-Crockpot but I am not that good with modmain codingAny help I would thank for! I'm looking at you [MENTION=10271]WrathOf[/MENTION] or [MENTION=3814]Starvation[/MENTION] Link to comment https://forums.kleientertainment.com/forums/topic/12886-requesthelp-with-code-2-or-more-when-crafting/ Share on other sites More sharing options...
~Matt Posted March 22, 2013 Share Posted March 22, 2013 I think this would be within the Pumpkin Lantern's code, as you can choose to "Murder" it and get a pumpkin and fireflies. Have no idea where it's located tho. Link to comment https://forums.kleientertainment.com/forums/topic/12886-requesthelp-with-code-2-or-more-when-crafting/#findComment-119529 Share on other sites More sharing options...
Alpaca's, Starving Posted March 22, 2013 Author Share Posted March 22, 2013 Nah sorry that's not what I mean it's to do with when you craft something but then you get 2 of an item if you get me Link to comment https://forums.kleientertainment.com/forums/topic/12886-requesthelp-with-code-2-or-more-when-crafting/#findComment-119534 Share on other sites More sharing options...
WrathOf Posted March 22, 2013 Share Posted March 22, 2013 I am not sure I understand what you are looking for.I can help you with making a new crafting menu tab to organize your recipes but they seemed ok to me with the way you are doing now too.Are you also wanting to support hammering the crafted items back resources?EDIT:From your post above, so you want the build button on the crafting menu to create more than 1 of the item? Not sure there is a viable way to do that without getting messy. Link to comment https://forums.kleientertainment.com/forums/topic/12886-requesthelp-with-code-2-or-more-when-crafting/#findComment-119536 Share on other sites More sharing options...
~Matt Posted March 22, 2013 Share Posted March 22, 2013 Yep, now I do. I think that code would be within the wall items' codes. Bad thing is that I also don't have a clue of where that one's located. Good luck on this endeavor, would be a great addition to the mod. Link to comment https://forums.kleientertainment.com/forums/topic/12886-requesthelp-with-code-2-or-more-when-crafting/#findComment-119541 Share on other sites More sharing options...
Alpaca's, Starving Posted March 22, 2013 Author Share Posted March 22, 2013 Oh **** yeah I forgot about that thanks Matt so much!Hopefully this works Link to comment https://forums.kleientertainment.com/forums/topic/12886-requesthelp-with-code-2-or-more-when-crafting/#findComment-119553 Share on other sites More sharing options...
Heavenfall Posted March 22, 2013 Share Posted March 22, 2013 Is there a problem with altering the builder component? That's the one that converts recipes into spawned prefabs anyway. Link to comment https://forums.kleientertainment.com/forums/topic/12886-requesthelp-with-code-2-or-more-when-crafting/#findComment-119593 Share on other sites More sharing options...
Alpaca's, Starving Posted March 22, 2013 Author Share Posted March 22, 2013 (edited) [MENTION=12700]Heavenfall[/MENTION] No it's just I'm trying to make so you can get 2 more items when you craft but I can't seem to find the codeEDIT: Sorry didn't read it right but I'm looking in the builder component but I have no clue where I start? Edited March 22, 2013 by Alpaca's, Starving Link to comment https://forums.kleientertainment.com/forums/topic/12886-requesthelp-with-code-2-or-more-when-crafting/#findComment-119626 Share on other sites More sharing options...
Heavenfall Posted March 22, 2013 Share Posted March 22, 2013 If you have no coding experience, perhaps start by reading some tutorials on LUA or tinkering with the code itself. This isn't going to be just a value that you can change, this will need actual code to do what you want. Link to comment https://forums.kleientertainment.com/forums/topic/12886-requesthelp-with-code-2-or-more-when-crafting/#findComment-119634 Share on other sites More sharing options...
Starvation Posted March 22, 2013 Share Posted March 22, 2013 Ok, i'm a tiny bit confused here What do you need help with? Link to comment https://forums.kleientertainment.com/forums/topic/12886-requesthelp-with-code-2-or-more-when-crafting/#findComment-119636 Share on other sites More sharing options...
WrathOf Posted March 22, 2013 Share Posted March 22, 2013 The walls recipe creates a stack of wall items that have a delpoy component to allow you to place them. So I guess you would need to create "_item" prefabs in a similar fashion. Everything you need should be in the walls.lua but they got a bit fancy in the way they structured the code to handle multiple types of walls in one file. You do not need to go that far though. [MENTION=3814]Starvation[/MENTION]No worries, this beyond your experience....not sure why he looped you in on this. Link to comment https://forums.kleientertainment.com/forums/topic/12886-requesthelp-with-code-2-or-more-when-crafting/#findComment-119638 Share on other sites More sharing options...
Alpaca's, Starving Posted March 22, 2013 Author Share Posted March 22, 2013 (edited) Sorry [MENTION=3814]Starvation[/MENTION] that was just for the crockpot type of thing with the recipe wigdet but I've figured that out [MENTION=10271]WrathOf[/MENTION] I'll give it another shot wish me luck!EDIT: Still needing asistance [MENTION=10271]WrathOf[/MENTION] I'm not sure what you mean by "_item" prefab and all the rest Edited March 22, 2013 by Alpaca's, Starving Link to comment https://forums.kleientertainment.com/forums/topic/12886-requesthelp-with-code-2-or-more-when-crafting/#findComment-119645 Share on other sites More sharing options...
WrathOf Posted March 22, 2013 Share Posted March 22, 2013 Ok well....you got some code or at least tell me what you are trying to spawn multiples of? Link to comment https://forums.kleientertainment.com/forums/topic/12886-requesthelp-with-code-2-or-more-when-crafting/#findComment-119679 Share on other sites More sharing options...
Alpaca's, Starving Posted March 22, 2013 Author Share Posted March 22, 2013 Alright let me explain this as clear as possibleAs when crafting Walls they give you multiple walls [4] So I was wondering where the code for getting multiple walls when crafting isHope that easy for you to understand [MENTION=10271]WrathOf[/MENTION] Link to comment https://forums.kleientertainment.com/forums/topic/12886-requesthelp-with-code-2-or-more-when-crafting/#findComment-119686 Share on other sites More sharing options...
WrathOf Posted March 22, 2013 Share Posted March 22, 2013 In walls.lua at the end of the file they define a table which says...{name = "stone", loot = "rocks", maxloots = 2, stacksize = 6, ....That is used by the MakeWallType function to create 3 prefabs, a wall, a wall_item and a wall_placer.In the itemfn function used to create the wall_item prefab, it sets the stacksize as specified (6 in the stone wall case)....inst:AddComponent("stackable")inst.components.stackable.maxsize = TUNING.STACK_SIZE_MEDITEMinst.components.stackable.stacksize = data.stacksizeand then added a deployable component so that when you click a wall_item in your inventory, you can place a wall prefab.....inst:AddComponent("deployable")inst.components.deployable.ondeploy = ondeploywallinst.components.deployable.test = test_wallinst.components.deployable.min_spacing = 0inst.components.deployable.placer = "wall_"..data.name.."_placer"all of which I am sure if clear as mud.... :SI think I will just have to setup one as an example since it is hard to explain all the steps involved....so what prefab are you most interested in? Link to comment https://forums.kleientertainment.com/forums/topic/12886-requesthelp-with-code-2-or-more-when-crafting/#findComment-119711 Share on other sites More sharing options...
Alpaca's, Starving Posted March 22, 2013 Author Share Posted March 22, 2013 Hmm I was intrestested in adding boards.lua and cutstone.lua so I could make them back into there original form Link to comment https://forums.kleientertainment.com/forums/topic/12886-requesthelp-with-code-2-or-more-when-crafting/#findComment-119732 Share on other sites More sharing options...
WrathOf Posted March 22, 2013 Share Posted March 22, 2013 Oh...you want to deconstruct the refined items? That's something different altogether...hmm. Link to comment https://forums.kleientertainment.com/forums/topic/12886-requesthelp-with-code-2-or-more-when-crafting/#findComment-119740 Share on other sites More sharing options...
Alpaca's, Starving Posted March 22, 2013 Author Share Posted March 22, 2013 Yeah that's what I was picking at Link to comment https://forums.kleientertainment.com/forums/topic/12886-requesthelp-with-code-2-or-more-when-crafting/#findComment-119743 Share on other sites More sharing options...
WrathOf Posted March 22, 2013 Share Posted March 22, 2013 Ok so in that case, you should only need to add the workable component to the refined item's prefab in a PrefabPostInit....inst:AddComponent("workable")inst.components.workable:SetWorkAction(ACTIONS.HAMMER)inst.components.workable:SetWorkLeft(2)inst.components.workable:SetOnFinishCallback(onhammered)inst.components.workable:SetOnWorkCallback(onhit) and define the onhammered and onhit functions to assign to it....local function onhammered(inst, worker) inst.components.lootdropper:DropLoot() SpawnPrefab("collapse_small").Transform:SetPosition(inst.Transform:GetWorldPosition()) inst.SoundEmitter:PlaySound("dontstarve/common/destroy_?????") --change to appropriate sound inst:Remove()endlocal function onhit(inst, worker) inst.AnimState:PlayAnimation("hit")endwhere the sound can be "..../destroy_wood", "..../destroy_metal", "..../destroy_stone" or "..../destroy_straw" Link to comment https://forums.kleientertainment.com/forums/topic/12886-requesthelp-with-code-2-or-more-when-crafting/#findComment-119781 Share on other sites More sharing options...
Alpaca's, Starving Posted March 22, 2013 Author Share Posted March 22, 2013 Getting crashes for some reason Link to comment https://forums.kleientertainment.com/forums/topic/12886-requesthelp-with-code-2-or-more-when-crafting/#findComment-119795 Share on other sites More sharing options...
WrathOf Posted March 22, 2013 Share Posted March 22, 2013 Well...then we are getting somewhere. :DWhat does the log.txt file say? Maybe provide some code to check over?Do I need ask Maxwell to give me psychic powers? I am sure it will cost dearly. Link to comment https://forums.kleientertainment.com/forums/topic/12886-requesthelp-with-code-2-or-more-when-crafting/#findComment-119825 Share on other sites More sharing options...
Alpaca's, Starving Posted March 22, 2013 Author Share Posted March 22, 2013 Heheheh anyway it's saysSomething to do with lootdropper component Link to comment https://forums.kleientertainment.com/forums/topic/12886-requesthelp-with-code-2-or-more-when-crafting/#findComment-119831 Share on other sites More sharing options...
WrathOf Posted March 23, 2013 Share Posted March 23, 2013 [MENTION=12388]Alpaca's, Starving[/MENTION]Ok try this out as an example for the wood boards....local function onhammered_general(inst, worker) if inst.components.stackable then for i=1, inst.components.stackable:StackSize() do inst.components.lootdropper:DropLoot() end end GLOBAL.SpawnPrefab("collapse_small").Transform:SetPosition(inst.Transform:GetWorldPosition()) inst.SoundEmitter:PlaySound(inst.sounds_hammered) inst:Remove()endlocal function onhit_general(inst, worker) --inst.AnimState:PlayAnimation("hit")endlocal function MakeDeconstructable(inst) --Make sure have workable component if not inst.components.workable then inst:AddComponent("workable") end inst.components.workable:SetWorkAction(GLOBAL.ACTIONS.HAMMER) inst.components.workable:SetWorkLeft(2) inst.components.workable:SetOnFinishCallback(onhammered_general) inst.components.workable:SetOnWorkCallback(onhit_general) --Make sure have loot dropper which defaults to using recipe if not inst.components.lootdropper then inst:AddComponent("lootdropper") end if not inst.SoundEmitter then inst.entity:AddSoundEmitter() endendlocal function woodPrefabPostInit(inst) --Call generic function to add workable component MakeDeconstructable(inst) --Create custom inst variable for specifying the sound to use inst.sounds_hammered = "dontstarve/common/destroy_wood"endAddPrefabPostInit("boards", woodPrefabPostInit) Link to comment https://forums.kleientertainment.com/forums/topic/12886-requesthelp-with-code-2-or-more-when-crafting/#findComment-119904 Share on other sites More sharing options...
Alpaca's, Starving Posted March 23, 2013 Author Share Posted March 23, 2013 Sorry @WraftOf I think I'll leave this it's not that useful as I wanted to do it in the recipe tab without hammering it Link to comment https://forums.kleientertainment.com/forums/topic/12886-requesthelp-with-code-2-or-more-when-crafting/#findComment-119919 Share on other sites More sharing options...
WrathOf Posted March 23, 2013 Share Posted March 23, 2013 You can reduce the amount of hits to 1 with...inst.components.workable:SetWorkLeft(1)as for doing this from the crafting menu...no idea other than creating a new deconstruction menu based off of the crafting menu code...not something I am interested in taking on at the moment. Link to comment https://forums.kleientertainment.com/forums/topic/12886-requesthelp-with-code-2-or-more-when-crafting/#findComment-119946 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