R3N_R3N Posted April 17, 2016 Share Posted April 17, 2016 (edited) Im planning on making 2 different craftable items for my mod charcater 1 that restores health and 1 that restores sanity kind off like a healing salve, but how do I do this? I know little about modding so yeah, all help is appreciated. Edited April 17, 2016 by AquaRC forogt to add a detail Link to comment https://forums.kleientertainment.com/forums/topic/66417-craftable-item-like-healing-salve/ Share on other sites More sharing options...
MF99K Posted April 17, 2016 Share Posted April 17, 2016 (edited) inst:AddComponent("edible") inst.components.edible.healthvalue = ## inst.components.edible.hungervalue = ## replace the ## with the number you want. this goes in the local function fn() section. if you want a sanity effect, add this: inst.components.edible.sanityvalue = ## Edited April 17, 2016 by mf99k Link to comment https://forums.kleientertainment.com/forums/topic/66417-craftable-item-like-healing-salve/#findComment-751464 Share on other sites More sharing options...
R3N_R3N Posted April 17, 2016 Author Share Posted April 17, 2016 Thanks for the line of code, but what I meant is how do I make it then add it, because all the guides I have seen have only been equipment like hats and tools etc. But I haven't seen any healing salve like items been added. So if someone can teach me or give me a link to a guide that would be helpful. I've already done the art for this item i just need to know how to turn it into 1 so all help and info is much appreaciated and very healful! Link to comment https://forums.kleientertainment.com/forums/topic/66417-craftable-item-like-healing-salve/#findComment-751525 Share on other sites More sharing options...
Aquaterion Posted April 17, 2016 Share Posted April 17, 2016 (edited) I didn't test it but here you go(I'm hoping you know what you have to do in modmain, such as setting up strings and adding the prefab name to "PREFABFILES" list; local assets = { Asset("ANIM", "anim/ITEM.zip"), --replace ITEM with ur .zip name. } local function fn() local inst = CreateEntity() inst.entity:AddTransform() inst.entity:AddAnimState() inst.entity:AddSoundEmitter() inst.entity:AddNetwork() MakeInventoryPhysics(inst) inst.AnimState:SetBank("item")--replace item with ur animation bank inst.AnimState:SetBuild("item")-- replace item with ur animation build inst.AnimState:PlayAnimation("idle") inst.entity:SetPristine() if not TheWorld.ismastersim then return inst end --make the item stackable(optional), you can remove this if you want it to be 1 item per inventory slot inst:AddComponent("stackable") inst.components.stackable.maxsize = TUNING.STACK_SIZE_SMALLITEM --POSSIBLE STACK SIZES: --STACK_SIZE_LARGEITEM (10) --STACK_SIZE_MEDITEM (20) --STACK_SIZE_SMALLITEM (40) inst:AddComponent("inspectable") inst:AddComponent("inventoryitem") --make the item edible inst:AddComponent("edible") inst.components.edible.foodtype = FOODTYPE.VEGGIE inst.components.edible.healthvalue = 0--replace with the number you want it to increase/decrease your health with. inst.components.edible.hungervalue = 0--replace with the number you want it to increase/decrease your hunger with. inst.components.edible.sanityvalue = 0--replace with the number you want it to increase/decrease your sanity with. --[[list of foodtypes: MEAT,WOOD,VEGGIE,ELEMENTAL,GEARS,HORRIBLE,INSECT,SEEDS,BERRY,RAW,BURNT,ROUGHAGE FOODTYPE.BERRY is edible by SMALLBIRD, FOODTYPE.BURNT is edible by LAVAE, FOODTYPE.RAW can be eaten off the floor by certain monsters ]]-- --make the item rot(optional), you can remove this if you dont want ur item to rot inst:AddComponent("perishable") inst.components.perishable:StartPerishing() inst.components.perishable.onperishreplacement = "spoiled_food" --"item" to change into when it rots inst.components.perishable:SetPerishTime(TUNING.PERISH_MED) -- time it takes to perish, --[[POSSIBLE PERISH TIMES: PERISH_ONE_DAY = 1 * 1 FULL DAY PERISH_TWO_DAY = 2 * 1 FULL DAY PERISH_SUPERFAST = 3 * 1 FULL DAY PERISH_FAST = 6 * 1 FULL DAY PERISH_FASTISH = 8 * 1 FULL DAY PERISH_MED = 10 * 1 FULL DAY PERISH_SLOW = 15 * 1 FULL DAY PERISH_PRESERVED = 20 * 1 FULL DAY PERISH_SUPERSLOW = 40 * 1 FULL DAY ]]-- --make the item cookable(optional), you can remove this if you dont want ur item to be cookable inst:AddComponent("cookable") inst.components.cookable.product = "cooked_smallmeat" -- "item" to change into when it cooks MakeHauntableLaunchAndPerish(inst) return inst end return Prefab("item", fn, assets)-- replace "item" with the name you want to give to your item Edited April 18, 2016 by Aquaterion Link to comment https://forums.kleientertainment.com/forums/topic/66417-craftable-item-like-healing-salve/#findComment-751537 Share on other sites More sharing options...
R3N_R3N Posted April 18, 2016 Author Share Posted April 18, 2016 I know how to play with some strings in mod main but I don't know how to add the prefab name to "PREFABFILES" list; Link to comment https://forums.kleientertainment.com/forums/topic/66417-craftable-item-like-healing-salve/#findComment-751793 Share on other sites More sharing options...
Aquaterion Posted April 18, 2016 Share Posted April 18, 2016 7 hours ago, AquaRC said: I know how to play with some strings in mod main but I don't know how to add the prefab name to "PREFABFILES" list; I think you know, maybe I confused you; I meant this: PrefabFiles = { "item1", "item2", } Link to comment https://forums.kleientertainment.com/forums/topic/66417-craftable-item-like-healing-salve/#findComment-751894 Share on other sites More sharing options...
R3N_R3N Posted April 18, 2016 Author Share Posted April 18, 2016 oh ok xD that Link to comment https://forums.kleientertainment.com/forums/topic/66417-craftable-item-like-healing-salve/#findComment-751910 Share on other sites More sharing options...
R3N_R3N Posted April 18, 2016 Author Share Posted April 18, 2016 Well I tried adding in the item and I followed a tutorial , but then it led to a total bust because when I run the game it freezes but dosen't crash. Link to comment https://forums.kleientertainment.com/forums/topic/66417-craftable-item-like-healing-salve/#findComment-751915 Share on other sites More sharing options...
Aquaterion Posted April 18, 2016 Share Posted April 18, 2016 10 minutes ago, AquaRC said: Well I tried adding in the item and I followed a tutorial , but then it led to a total bust because when I run the game it freezes but dosen't crash. check the clientlog, Documents/Klei/DontStarveTogether/clientlog.txt Link to comment https://forums.kleientertainment.com/forums/topic/66417-craftable-item-like-healing-salve/#findComment-751919 Share on other sites More sharing options...
R3N_R3N Posted April 18, 2016 Author Share Posted April 18, 2016 ok btw this mod is Don't Starve, Im trying to add these items to DS first so yeah then dst later. so do I post the log here? Im not very smart with mods. you see this is ym first mod so yeah...Im horrible at this xD Link to comment https://forums.kleientertainment.com/forums/topic/66417-craftable-item-like-healing-salve/#findComment-751920 Share on other sites More sharing options...
Aquaterion Posted April 18, 2016 Share Posted April 18, 2016 remove the following lines then: inst.entity:AddNetwork() inst.entity:SetPristine() if not TheWorld.ismastersim then return inst end as I believe they're for networking(which dont starve doesn't need since its not multiplayer) Link to comment https://forums.kleientertainment.com/forums/topic/66417-craftable-item-like-healing-salve/#findComment-751923 Share on other sites More sharing options...
R3N_R3N Posted April 18, 2016 Author Share Posted April 18, 2016 ok I will try that, then i will try adding the items again. Link to comment https://forums.kleientertainment.com/forums/topic/66417-craftable-item-like-healing-salve/#findComment-751925 Share on other sites More sharing options...
R3N_R3N Posted April 18, 2016 Author Share Posted April 18, 2016 Ugh item modding is so complicated, I wish someone just made a consumable item tutorial xD Link to comment https://forums.kleientertainment.com/forums/topic/66417-craftable-item-like-healing-salve/#findComment-751926 Share on other sites More sharing options...
Aquaterion Posted April 18, 2016 Share Posted April 18, 2016 Just now, AquaRC said: Ugh item modding is so complicated, I wish someone just made a consumable item tutorial xD Well I tried, but I didn't test the code, so just post your crash log, Documents\Klei\DoNotStarve\log.txt Link to comment https://forums.kleientertainment.com/forums/topic/66417-craftable-item-like-healing-salve/#findComment-751927 Share on other sites More sharing options...
Aquaterion Posted April 19, 2016 Share Posted April 19, 2016 Have you given up? @AquaRC if you want you can give me the images and I can try making it myself Link to comment https://forums.kleientertainment.com/forums/topic/66417-craftable-item-like-healing-salve/#findComment-752269 Share on other sites More sharing options...
R3N_R3N Posted April 21, 2016 Author Share Posted April 21, 2016 yeah I've given up xD sure I can give you the images in a bit Im playing right now xD Link to comment https://forums.kleientertainment.com/forums/topic/66417-craftable-item-like-healing-salve/#findComment-753477 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