whismerhill Posted September 27, 2016 Share Posted September 27, 2016 (edited) I don't get it: I am rewritting pretty much from scratch a mod to dig out sinkholes (e.g. create caves). I know you can do it in console but what's the fun in that ? ^^ Mainly because all mods I found on the subject overwrite cave_entrance.lua & therefore have a bunch of issues, since there's at least 2 versions of it, depending on DLC. So the goal was for the sinkhole to not be covered by rock so I got this idea : temprecipe = GLOBAL.Recipe("cave_entrance.open", {Ingredient("rope", 20)}, RECIPETABS.TOWN, TECH.NONE, "cave_entrance_placer") the strange thing, is "cave_entrance.open" worked ... once. Since then I had image/atlas/string problems and strangely this does not work anymore when you place it, the character says : "I can't do that". "cave_entrance" works but places the rock on it which you will dig out & recover lots of ingredients used for construction.... plus it doesn't make much sense to dig out access to the underworld, and then place a rock on it to dig it out again xD Edited September 28, 2016 by whismerhill Link to comment https://forums.kleientertainment.com/forums/topic/70489-recipe-weirdness/ Share on other sites More sharing options...
Mobbstar Posted September 27, 2016 Share Posted September 27, 2016 You could create a dummy prefab to spawn a cave entrance and unplug it immediately. Link to comment https://forums.kleientertainment.com/forums/topic/70489-recipe-weirdness/#findComment-819100 Share on other sites More sharing options...
whismerhill Posted September 28, 2016 Author Share Posted September 28, 2016 after trying again & again I must have dreamed that it worked one time... So I'm trying to go the dummy prefab way : here's the result everything is working, got recipe, text, image, placer but on placing the recipe I get the error message (in console, doesn't crash DS) Spoiler scripts/mainfunctions.lua(145,1) Failed to spawn cave_entrance_dummy here's the content of cave_entrance_dummy.lua : require "prefabutil" local function onbuilt(sim) local item = SpawnPrefab("cave_entrance") -- _G.cave_entrance.Open(item) --inst:remove() end return Prefab ( "cave_entrance_dummy", onbuilt, nil, nil), MakePlacer( "common/cave_entrance_placer", "cave_entrance", "cave_entrance", "idle_open" ) as you can see there's some commented out stuff. I'm trying to make the dummy work first & foremost ^^. Have a hard time finding examples of dummy prefabs out there Link to comment https://forums.kleientertainment.com/forums/topic/70489-recipe-weirdness/#findComment-819305 Share on other sites More sharing options...
Mobbstar Posted September 28, 2016 Share Posted September 28, 2016 you forgot "return item" at the end of the "onbuilt" function ... return item end return Prefab ... Link to comment https://forums.kleientertainment.com/forums/topic/70489-recipe-weirdness/#findComment-819556 Share on other sites More sharing options...
whismerhill Posted September 28, 2016 Author Share Posted September 28, 2016 (edited) haaaaa return is not my friend I'm afraid xD. Thanks a bunch this dummy prefab now works, just need to Open it now lol (which is the whole point of its existence) Edited September 28, 2016 by whismerhill Link to comment https://forums.kleientertainment.com/forums/topic/70489-recipe-weirdness/#findComment-819621 Share on other sites More sharing options...
Mobbstar Posted September 28, 2016 Share Posted September 28, 2016 44 minutes ago, whismerhill said: haaaaa return is not my friend I'm afraid xD. Thanks a bunch this dummy prefab now works, just need to Open it now lol (which is the whole point of its existence) inst.components.workable:WorkedBy(GetPlayer(), inst.components.workable.workleft) GetPlayer() is exclusive to singleplayer, it won't work in DST, but you could easily work around that using the "onbuilt" event. Link to comment https://forums.kleientertainment.com/forums/topic/70489-recipe-weirdness/#findComment-819628 Share on other sites More sharing options...
whismerhill Posted September 28, 2016 Author Share Posted September 28, 2016 (edited) Thanks. replaced "inst" with "item" and it works right away. So in fact this code makes the player do the action I want to do, but instantly. Interesting... the whole time I wanted to execute a function located in the prefab, or apply to it a property. "getplayer" & "work" on the generated prefab is a completely different approach xD I'll try to keep this outlook on stuff in mind in the future. Edited September 28, 2016 by whismerhill Link to comment https://forums.kleientertainment.com/forums/topic/70489-recipe-weirdness/#findComment-819635 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