Serpens Posted August 29, 2016 Share Posted August 29, 2016 I tried it with the pickable component, but I still can pick it up like a normal item... local function MakeSlowPick(inst) -- to make it harder to collect and run, without defeating the enemies inst:AddComponent("pickable") inst.components.pickable:SetUp(inst.prefab) end AddPrefabPostInit("teleportato_box", MakeSlowPick) Link to comment Share on other sites More sharing options...
Lumina Posted August 29, 2016 Share Posted August 29, 2016 I don't know if it's possible. So i can't really help you. What i know is that if the teleportato things are set piece, you could try to make a scenario, maybe ? Like, putting this in a chest, it will require time to open the chest and it's a dangerous thing to do with enemies around. Link to comment Share on other sites More sharing options...
Serpens Posted August 29, 2016 Author Share Posted August 29, 2016 (edited) Do you know how to add scenarios and set_pieces? I think scenarios and set_pieces have huge potential and it is sad that the game devs only made a few. But the set_piece scripts look very complicated ... and I have no clue how to make my own: Don't Starve Together\data\scripts\map\static_layouts But I could simply search for the parts, spawn a chest near them, and then transfer them into the chest. That should work. Adding a custom scenario would also be nice, since I could make my own trap chests But how to add a scenario? One way the pickable thing might be possible is to add a helper thing. I mean like tallbirdnest + tallbirdegg. The nest has the pickable component and takes a time to harvest an egg. I fear I have to do a simular thing with the teleportato parts... Edited August 29, 2016 by Serpens Link to comment Share on other sites More sharing options...
Lumina Posted August 29, 2016 Share Posted August 29, 2016 Making set piece : You need tiled, you can find it in don't starve mod tools. You also needs a ground.tsx, but i guess (and hope) it's in the tiled repertory of don't starve mod tools. Also, you can edit a existing set piece if you just want to change some prefabs. It will work fine even with custom prefabs. For example, i guess you could make a "my_teleportato_box" that will be the same than the actual set piece, except that you can replace the "teleportato_box" with a chest, and add a scenario that will tell "the chest contain "teleportato_box"" For the scenario part : { name = "", type = "treasurechest", shape = "rectangle", x = 130, y = 190, width = 61, height = 64, visible = true, properties = { ["scenario"] = "chest_food" } }, Here is the properties = { ["scenario"] = "chest_food" } for the "default_plus_start" In scenarios, you have : chest_food.lua chestfunctions = require("scenarios/chestfunctions") local function OnCreate(inst, scenariorunner) local items = { { item = "meat", count = 8, }, { item = "berries", count = 8, }, { item = "seeds", count = 10, }, { item = "carrot", count = 2, }, { item = "pumpkin", count = 2, }, { item = "dragonfruit", count = 2, }, { item = "eggplant", count = 2, }, { item = "tallbirdegg", count = 1, }, } chestfunctions.AddChestItems(inst, items) end return { OnCreate = OnCreate } So i suppose you could use the same kind of function to make a scenario when the thing is in a chest. I suppose, because i'm not confident enough to try scenario at the moment. But you could do things like spawning monster (the sleepingspider_spiderambush.lua) or make the user lose sanity when picking an item (staff_hound), or waking sleeping monster when picking an item (same setpiece) and others stuffs that could be great for a challenge mod. Link to comment Share on other sites More sharing options...
Serpens Posted August 29, 2016 Author Share Posted August 29, 2016 thank you But where to put the scennario code? At the moment the only mods I made used modmain only. Can I put all of this also in the modmain? I mean for adding a Recipe you need "AddRecipe". Is there something like this for scenario? Or how do I let the game know, that I want to add a scenario? Link to comment Share on other sites More sharing options...
Lumina Posted August 29, 2016 Share Posted August 29, 2016 hmm, i guess it's like prefab and all, probably a "scenarios" folder with the scenario.lua And the "scenario.lua" is asked by the property of one item of the set piece. The only mod with scenario i've seen was a now deleted mod on the workshop. I'm not sure it's ok to put it here. And this example mod, but mosts parts are probably not working anymore, it's old. I guess the structure of folder could still ok. Set Pieces.zip Link to comment Share on other sites More sharing options...
Serpens Posted August 30, 2016 Author Share Posted August 30, 2016 56 minutes ago, Lumina said: hmm, i guess it's like prefab and all, probably a "scenarios" folder with the scenario.lua And the "scenario.lua" is asked by the property of one item of the set piece. The only mod with scenario i've seen was a now deleted mod on the workshop. I'm not sure it's ok to put it here. And this example mod, but mosts parts are probably not working anymore, it's old. I guess the structure of folder could still ok. Set Pieces.zip thanks I remebered the Mod Multi-Worlds DST And it has scenarios and set_pieces, I will use this as help Link to comment Share on other sites More sharing options...
DarkXero Posted August 30, 2016 Share Posted August 30, 2016 The pickable component can help, yes. local function PickedFn(inst, data) inst.components.pickable:Regen() local picker = data and data.picker if picker and picker.components.inventory then local pos = inst:GetPosition() picker.components.inventory:GiveItem(inst, nil, pos) end end local function MakeSlowPick(inst) if inst.components.inventoryitem then inst.components.inventoryitem.canbepickedup = false inst:AddComponent("pickable") inst:ListenForEvent("picked", PickedFn) inst.components.pickable:Regen() end end AddPrefabPostInit("teleportato_box", MakeSlowPick) 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