JakeBR72 Posted May 18, 2015 Share Posted May 18, 2015 (edited) SOLVED: EXAMPLE PROJECT HERE: http://steamcommunity.com/sharedfiles/filedetails/?id=445182091 Is there a sample mod anywhere which shows the structure of a placeable item like a chest?-Has crafting recipe-Placeable in the world (like a campire) I've tried to work my way through but can't get my item to be placeable after clicking on the crafting recipe. my recipe is as follows: local myprefab = AddRecipe("myprefab", {Ingredient("boards", 1)}, GLOBAL.RECIPETABS.FARM, GLOBAL.TECH.NONE)myprefab.atlas = "images/inventoryimages/myprefab.xml"But when I click on it it just completes and doesn't let me place it. Any help would be greatly appreciated! my file structure: http://i.imgur.com/60IpMo2.pngmyprefab.lua : http://pastebin.com/MiWkMG7P SOLVED: EXAMPLE PROJECT HERE: http://steamcommunity.com/sharedfiles/filedetails/?id=445182091 Edited May 18, 2015 by JakeBR72 Link to comment https://forums.kleientertainment.com/forums/topic/54148-custom-craftableplaceable-item-like-a-chest-or-campfire/ Share on other sites More sharing options...
DarkXero Posted May 18, 2015 Share Posted May 18, 2015 local myrecipe = AddRecipe("myprefab", -- name {Ingredient("boards", 1)}, -- ingredients GLOBAL.RECIPETABS.FARM, -- tab GLOBAL.TECH.NONE, -- level "myprefab", -- placer nil, -- min_spacing nil, -- nounlock nil, -- numtogive nil, -- builder_tag "images/inventoryimages/myprefab.xml", -- atlas "myprefab.tex") -- image Link to comment https://forums.kleientertainment.com/forums/topic/54148-custom-craftableplaceable-item-like-a-chest-or-campfire/#findComment-638635 Share on other sites More sharing options...
JakeBR72 Posted May 18, 2015 Author Share Posted May 18, 2015 local myrecipe = AddRecipe("myprefab", -- name{Ingredient("boards", 1)}, -- ingredientsGLOBAL.RECIPETABS.FARM, -- tabGLOBAL.TECH.NONE, -- level"myprefab", -- placernil, -- min_spacingnil, -- nounlocknil, -- numtogivenil, -- builder_tag"images/inventoryimages/myprefab.xml", -- atlas"myprefab.tex") -- imagethanks for the explanations, I knew i was missing some fields. that fixed that issue but it seems to be invisible and nonexistant... Link to comment https://forums.kleientertainment.com/forums/topic/54148-custom-craftableplaceable-item-like-a-chest-or-campfire/#findComment-638637 Share on other sites More sharing options...
DarkXero Posted May 18, 2015 Share Posted May 18, 2015 MakePlacer returns a prefab.You have two prefabs with the same name. Try using:MakePlacer("common/myprefab_placer", "myprefab", "myprefab", "idle")and puttin myprefab_placer in AddRecipe. Link to comment https://forums.kleientertainment.com/forums/topic/54148-custom-craftableplaceable-item-like-a-chest-or-campfire/#findComment-638640 Share on other sites More sharing options...
JakeBR72 Posted May 18, 2015 Author Share Posted May 18, 2015 MakePlacer returns a prefab.You have two prefabs with the same name. Try using:MakePlacer("common/myprefab_placer", "myprefab", "myprefab", "idle")and puttin myprefab_placer in AddRecipe.I don't think im following, putting that line in modmain causes a crash. To be honest I'm not even sure my file structure is correct. I only have 1 prefab which is the myprefab.lua Link to comment https://forums.kleientertainment.com/forums/topic/54148-custom-craftableplaceable-item-like-a-chest-or-campfire/#findComment-638643 Share on other sites More sharing options...
DarkXero Posted May 18, 2015 Share Posted May 18, 2015 In your prefab.lua, you have:return Prefab("common/myprefab", fn, assets, prefabs), MakePlacer("common/myprefab", "myprefab", "myprefab", "idle")Edit that MakePlacer line. Link to comment https://forums.kleientertainment.com/forums/topic/54148-custom-craftableplaceable-item-like-a-chest-or-campfire/#findComment-638644 Share on other sites More sharing options...
JakeBR72 Posted May 18, 2015 Author Share Posted May 18, 2015 In your prefab.lua, you have:return Prefab("common/myprefab", fn, assets, prefabs), MakePlacer("common/myprefab", "myprefab", "myprefab", "idle")Edit that MakePlacer line.Ok, the collision box is in place when built but there is still no art being shown. Link to comment https://forums.kleientertainment.com/forums/topic/54148-custom-craftableplaceable-item-like-a-chest-or-campfire/#findComment-638649 Share on other sites More sharing options...
DarkXero Posted May 18, 2015 Share Posted May 18, 2015 If you c_spawn("myprefab") via the console, does something show up? Link to comment https://forums.kleientertainment.com/forums/topic/54148-custom-craftableplaceable-item-like-a-chest-or-campfire/#findComment-638651 Share on other sites More sharing options...
JakeBR72 Posted May 18, 2015 Author Share Posted May 18, 2015 (edited) If you c_spawn("myprefab") via the console, does something show up?no but the hitbox is there so the prefab is being created in the world. while writing this i reworked the animation and spriter files. Got it showing up in game. thanks for your help man, I really appreciate it! I'm going to upload a sample structure template for future people to use for their mods since there isnt much documentation. Edited May 18, 2015 by JakeBR72 Link to comment https://forums.kleientertainment.com/forums/topic/54148-custom-craftableplaceable-item-like-a-chest-or-campfire/#findComment-638652 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