Alpaca's, Starving Posted March 26, 2013 Share Posted March 26, 2013 Waiting most eagerly for this to be updated for my mod Link to comment https://forums.kleientertainment.com/forums/topic/11621-tutorial-examplestemplates-for-mods-rain-update/page/2/#findComment-123350 Share on other sites More sharing options...
WrathOf Posted March 26, 2013 Author Share Posted March 26, 2013 (edited) Ok, posted revised versions of the files used by these example mods and mods based on them for the Doorway update.NOTE: If you are making a new crafting tab, make sure this is done in the modmain but outside any GamePostInit or SimPostInit functions. The game's new loading process now requires this.print("Loading My Cool Mod....")...--Add tab to master list defined in constants.lua--NOTE: Path to image in hard codes for the mod's folder name and MUST match the path specified in this mod's prefabs.xmlRECIPETABS["NEWTABNAME"] = {str = STRINGS.TABS.NEWTABNAME, sort=10, icon = "mods/MOD NAME/images/tab_newtabname.tex"}...local function modGamePostInit() -- Do stuffendAddGamePostInit(modGamePostInit)local function modSimPostInit(player) -- Do stuffendAddSimPostInit(modSimPostInit)print("loaded!")WrathOf's Alternate files for Mods Edited March 26, 2013 by WrathOf Link to comment https://forums.kleientertainment.com/forums/topic/11621-tutorial-examplestemplates-for-mods-rain-update/page/2/#findComment-123437 Share on other sites More sharing options...
Alpaca's, Starving Posted March 26, 2013 Share Posted March 26, 2013 How do I load my craftable uncraftables mod into this I'm having a hard time doing it Link to comment https://forums.kleientertainment.com/forums/topic/11621-tutorial-examplestemplates-for-mods-rain-update/page/2/#findComment-123511 Share on other sites More sharing options...
WrathOf Posted March 26, 2013 Author Share Posted March 26, 2013 You should just have to replace your old version of the crafting.lua file with the new one I posted and then move the lines where you are adding the new tab to outside of the AddCraftingMenu function:--NEW LocationRECIPETABS["CRAFT"] = {str = STRINGS.TABS.CRAFT, sort=10, icon = "mods/Uncraftable Craftables/images/tab_craftableuncraftables.tex"}local function AddCraftingMenu()... --OLD Location --RECIPETABS["CRAFT"] = {str = STRINGS.TABS.CRAFT, sort=10, icon = "mods/Uncraftable Craftables/images/tab_craftableuncraftables.tex"}... Link to comment https://forums.kleientertainment.com/forums/topic/11621-tutorial-examplestemplates-for-mods-rain-update/page/2/#findComment-123588 Share on other sites More sharing options...
Stroomschok Posted March 27, 2013 Share Posted March 27, 2013 Only in this section of the forums would these posts not get flamed with tl;dr responses. [MENTION=3587]Stroomschok[/MENTION]Where did you run off to? I didn't have much time to check back yet. Never would have guessed that buying a new house is this much work >_<I'll check your response tomorrow, after I had some fun with the latest update of the game Link to comment https://forums.kleientertainment.com/forums/topic/11621-tutorial-examplestemplates-for-mods-rain-update/page/2/#findComment-124420 Share on other sites More sharing options...
VirtualVampire Posted March 28, 2013 Share Posted March 28, 2013 Im new to modding, my question is how do I mode the files in my game? Link to comment https://forums.kleientertainment.com/forums/topic/11621-tutorial-examplestemplates-for-mods-rain-update/page/2/#findComment-124712 Share on other sites More sharing options...
WrathOf Posted March 28, 2013 Author Share Posted March 28, 2013 [MENTION=20527]VirtualVampire[/MENTION]Not sure what you mean? The game files are in the data/scripts folder and are text files with the .lua extension which you can edit in Notepad or whatever plain text editor you prefer.You can install one or all of my example mods to get you started with a folder structure to copy files into and then experiment with them from there. Make sure you mods uses the same scripts/prefabs or whatever folder structure the game uses for the file you are changing and the game will generally try to use your version versus the standard one. Link to comment https://forums.kleientertainment.com/forums/topic/11621-tutorial-examplestemplates-for-mods-rain-update/page/2/#findComment-124804 Share on other sites More sharing options...
xrvel Posted March 29, 2013 Share Posted March 29, 2013 (edited) If i want to change 2 recipes, is this code correct?-- Example Recipe Mod-- by WrathOf-- v0.7-- Updated for Revision 74452 2013-03-12_14-18-42 (A Little Rain Must Fall)--------------------------------------------------------------------------------- Support thread here: ---- This is a basic mod that allows you to change the items required to make a-- craftable in the game such as tool and weapons.-- -- Refer to the recipes.lua file in the game's scripts folder to see what the-- existing recipes are and what the internal names for the ingredients are.------ Note: Currently requires an override of the crafting.lua file to overcome a-- coding bug in the game's version. Make sure it is included with your-- mods that change or make new crafting recipes.------ To install this mod, put this file in a folder under-- "...\Steam\steamapps\common\dont_starve\mods" called "Example Recipe Mod",-- then open the "modsettings.lua" file in the mods folder and add the-- following but without the beginning "--":----ModManager:AddMod("Example Recipe Mod")---- When you run the game you should see a screen pop up that lists this mod as-- being loaded.---------------------------------------------------------------------------------print("Example Recipe Mod loaded.")--Callback function to change the recipe for pan flutes at GamePostInit.--The name can be almost anything, just don't start with 0-9 and use the exact--same name in the AddGamePostInit line below.local function modGamePostInit() --Search for the recipe you want to change local recipe = GLOBAL.GetRecipe("panflute") --If find it then change it if recipe then --Set the ingredients for a recipe to a new list recipe.ingredients = { --Each ingredient is the internal name for it & the amount needed GLOBAL.Ingredient("cutgrass", 1), } --No need to update the crafting menu since this change is done before the game builds the menu end --Search for the recipe you want to change local recipe2 = GLOBAL.GetRecipe("meatrack") --If find it then change it if recipe2 then --Set the ingredients for a recipe to a new list recipe2.ingredients = { --Each ingredient is the internal name for it & the amount needed GLOBAL.Ingredient("twigs", 1), } --No need to update the crafting menu since this change is done before the game builds the menu endend--Add a post init callback to the game when this mod is loaded.--This will tell the game to run the function above after loading the game's--main screen but before handing control over to the player.AddGamePostInit(modGamePostInit)--Callback function to change the recipe for pan flutes at SimPostInit.--Use this version if need to access hud to force an update to the crafting menu.local function modSimPostInit( maincharacter ) --Search for the recipe you want to change local recipe = GLOBAL.GetRecipe("panflute") --If find it then change it if recipe then --Set the ingredients for a recipe to a new list recipe.ingredients = { --Each ingredient is the internal name for it & the amount needed GLOBAL.Ingredient("cutgrass", 1), } --Should not be necessary, but wanted to show how to do this just in case --Get reference to crafting menu local craftmenu = maincharacter.HUD.controls.crafttabs --Tell menu to update so recipe changes appear if craftmenu then craftmenu:UpdateRecipes() end end --Search for the recipe you want to change local recipe2 = GLOBAL.GetRecipe("meatrack") --If find it then change it if recipe2 then --Set the ingredients for a recipe to a new list recipe2.ingredients = { --Each ingredient is the internal name for it & the amount needed GLOBAL.Ingredient("twigs", 1), } --Should not be necessary, but wanted to show how to do this just in case --Get reference to crafting menu local craftmenu = maincharacter.HUD.controls.crafttabs --Tell menu to update so recipe changes appear if craftmenu then craftmenu:UpdateRecipes() end endend--Add a post init callback to the game when this mod is loaded.--This will tell the game to run the function above after loading a saved game--but before handing control over to the player.--uncomment to try but comment out AddGamePostInit line above so only one or--the other method is used.--AddSimPostInit(modSimPostInit)Or there is more optimized code for it? Edited March 29, 2013 by WrathOf added spoiler tags (via Threadmins and Group Moderators) Link to comment https://forums.kleientertainment.com/forums/topic/11621-tutorial-examplestemplates-for-mods-rain-update/page/2/#findComment-126239 Share on other sites More sharing options...
WrathOf Posted March 29, 2013 Author Share Posted March 29, 2013 (edited) The modGamePostInit method is fine, you do not need to do both. I was just showing 2 contexts of accomplishing this. Just delete the modSimPostInit portion or clear it out and use the function for some other purpose.Also, you could declare the recipe variable once and use it repeatedly....local recipe = nilrecipe = GLOBAL.GetRecipe("panflute")if recipe ....recipe = GLOBAL.GetRecipe("meatrack")if recipe ....I am showing you how to change an existing recipe so that the order in the menu is kept. You could also just redefine it but then it will show up at the end of the list for a given crafting tab....--(in modmain, not inside a function, near top before these vars are used)--Declare local versions of vars used from game's global environmentRECIPETABS = GLOBAL.RECIPETABSRecipe = GLOBAL.RecipeIngredient = GLOBAL.Ingredient--in the modGamePostInit functionRecipe("panflute", { Ingredient("cutgrass", 1) }, RECIPETABS.MAGIC, 2)Recipe("meatrack", { Ingredient("twigs", 1) }, RECIPETABS.FARM, 1, "meatrack_placer")But you will need to use my alternate version of "crafting.lua" to fix a bug in the code. Hope that is not more confusing :S Edited March 29, 2013 by WrathOf adjusted code for clarity Link to comment https://forums.kleientertainment.com/forums/topic/11621-tutorial-examplestemplates-for-mods-rain-update/page/2/#findComment-126270 Share on other sites More sharing options...
xrvel Posted March 29, 2013 Share Posted March 29, 2013 (edited) The modGamePostInit method is fine, you do not need to do both. I was just showing 2 contexts of accomplishing this. Just delete the modSimPostInit portion or clear it out and use the function for some other purpose.thanks, it works now :)Here is code that i use--Callback function to change the recipe for pan flutes at SimPostInit.--Use this version if need to access hud to force an update to the crafting menu.local function modSimPostInit( maincharacter ) local xrveleasyrecipe = nil --Search for the recipe you want to change xrveleasyrecipe = GLOBAL.GetRecipe("panflute") --If find it then change it if xrveleasyrecipe then --Set the ingredients for a recipe to a new list xrveleasyrecipe.ingredients = { --Each ingredient is the internal name for it & the amount needed GLOBAL.Ingredient("cutgrass", 1), } --Should not be necessary, but wanted to show how to do this just in case --Get reference to crafting menu local craftmenu = maincharacter.HUD.controls.crafttabs --Tell menu to update so recipe changes appear if craftmenu then craftmenu:UpdateRecipes() end end --Search for the recipe you want to change xrveleasyrecipe = GLOBAL.GetRecipe("meatrack") --If find it then change it if xrveleasyrecipe then --Set the ingredients for a recipe to a new list xrveleasyrecipe.ingredients = { --Each ingredient is the internal name for it & the amount needed GLOBAL.Ingredient("rope", 1), GLOBAL.Ingredient("twigs", 1), } --Should not be necessary, but wanted to show how to do this just in case --Get reference to crafting menu local craftmenu = maincharacter.HUD.controls.crafttabs --Tell menu to update so recipe changes appear if craftmenu then craftmenu:UpdateRecipes() end endend--Add a post init callback to the game when this mod is loaded.--This will tell the game to run the function above after loading a saved game--but before handing control over to the player.--uncomment to try but comment out AddGamePostInit line above so only one or--the other method is used.AddSimPostInit(modSimPostInit) Edited March 29, 2013 by WrathOf added spoiler tags (via Threadmins and Group Moderators) Link to comment https://forums.kleientertainment.com/forums/topic/11621-tutorial-examplestemplates-for-mods-rain-update/page/2/#findComment-126291 Share on other sites More sharing options...
WrathOf Posted March 29, 2013 Author Share Posted March 29, 2013 Looks fine....you can move the update code out of the if statements to do it once at the end though....--Callback function to change the recipe for pan flutes at SimPostInit.--Use this version if need to access hud to force an update to the crafting menu.local function modSimPostInit( maincharacter ) local xrveleasyrecipe = nil --Search for the recipe you want to change xrveleasyrecipe = GLOBAL.GetRecipe("panflute") --If find it then change it if xrveleasyrecipe then --Set the ingredients for a recipe to a new list xrveleasyrecipe.ingredients = { --Each ingredient is the internal name for it & the amount needed GLOBAL.Ingredient("cutgrass", 1), } end --Search for the recipe you want to change xrveleasyrecipe = GLOBAL.GetRecipe("meatrack") --If find it then change it if xrveleasyrecipe then --Set the ingredients for a recipe to a new list xrveleasyrecipe.ingredients = { --Each ingredient is the internal name for it & the amount needed GLOBAL.Ingredient("rope", 1), GLOBAL.Ingredient("twigs", 1), } end --Should not be necessary, but wanted to show how to do this just in case --Get reference to crafting menu local craftmenu = maincharacter.HUD.controls.crafttabs --Tell menu to update so recipe changes appear if craftmenu then craftmenu:UpdateRecipes() endend--Add a post init callback to the game when this mod is loaded.--This will tell the game to run the function above after loading a saved game--but before handing control over to the player.AddSimPostInit(modSimPostInit) Link to comment https://forums.kleientertainment.com/forums/topic/11621-tutorial-examplestemplates-for-mods-rain-update/page/2/#findComment-126300 Share on other sites More sharing options...
xrvel Posted March 29, 2013 Share Posted March 29, 2013 Looks fine....you can move the update code out of the if statements to do it once at the end though....thanks, i've tried it and my code are way cleaner now Link to comment https://forums.kleientertainment.com/forums/topic/11621-tutorial-examplestemplates-for-mods-rain-update/page/2/#findComment-126314 Share on other sites More sharing options...
WrathOf Posted March 31, 2013 Author Share Posted March 31, 2013 Ok added a new example mod for adding a placer prefab to an existing prefab, marble pillars in this case.I hope to get all the existing examples updated to using the new ModLib mod tommorow for proper Doorway update support. Link to comment https://forums.kleientertainment.com/forums/topic/11621-tutorial-examplestemplates-for-mods-rain-update/page/2/#findComment-127881 Share on other sites More sharing options...
Alpaca's, Starving Posted March 31, 2013 Share Posted March 31, 2013 I'm getting crashes [MENTION=10271]WrathOf[/MENTION] saying variable ModRegisterPrefabs is not delarced but in the code it's there? Link to comment https://forums.kleientertainment.com/forums/topic/11621-tutorial-examplestemplates-for-mods-rain-update/page/2/#findComment-127944 Share on other sites More sharing options...
WrathOf Posted March 31, 2013 Author Share Posted March 31, 2013 That is the new function I put in v1.1 of ModLib which must be installed and loaded *before* the placer example mod. Link to comment https://forums.kleientertainment.com/forums/topic/11621-tutorial-examplestemplates-for-mods-rain-update/page/2/#findComment-128143 Share on other sites More sharing options...
Alpaca's, Starving Posted March 31, 2013 Share Posted March 31, 2013 Yeah it's done Link to comment https://forums.kleientertainment.com/forums/topic/11621-tutorial-examplestemplates-for-mods-rain-update/page/2/#findComment-128261 Share on other sites More sharing options...
eddieo64 Posted April 6, 2013 Share Posted April 6, 2013 I am looking forward to modding this game I have some interesting ideas. My problem is I have no clue what a stategraph , prefab or non-prefab. please where can i go or what can I download to start to learn Link to comment https://forums.kleientertainment.com/forums/topic/11621-tutorial-examplestemplates-for-mods-rain-update/page/2/#findComment-133088 Share on other sites More sharing options...
DaS Posted April 6, 2013 Share Posted April 6, 2013 (edited) [MENTION=10271]WrathOf[/MENTION], perhaps you could shed some of your limitless modding knowledge on this situation here?I've managed to create a custom prefab (thanks to your amazing mod examples, which I couldn't have done without). Functionally it works perfectly fine, and after many tedious hours of raging at a screen I manged to fix my file-path issues for my custom image file with the crafting menu (as your examples only show how to create a structure rather than an inventory item).However the item itself in the inventory (and on the ground, despite using a pre-existing .zip anim file) is invisible, and I've yet to figure out how to have it display the (or any) image.Any advice would be greatly appreciated, else I just keep trying my method of breaking the game untill I figure out how everything fits together! EDIT - I had not realized the 'modlib' shows how to do this.... *awks*It now works! Edited April 7, 2013 by DaS Link to comment https://forums.kleientertainment.com/forums/topic/11621-tutorial-examplestemplates-for-mods-rain-update/page/2/#findComment-133457 Share on other sites More sharing options...
VirtualVampire Posted April 7, 2013 Share Posted April 7, 2013 [MENTION=20527]VirtualVampire[/MENTION]Not sure what you mean? The game files are in the data/scripts folder and are text files with the .lua extension which you can edit in Notepad or whatever plain text editor you prefer.You can install one or all of my example mods to get you started with a folder structure to copy files into and then experiment with them from there. Make sure you mods uses the same scripts/prefabs or whatever folder structure the game uses for the file you are changing and the game will generally try to use your version versus the standard one.Oh I wrote mode instead mode, (-‸ლ) Im still a bit confused, I figure it out though. Thanks, quick youtube video would be nice if possible. Oh and by the way obey the Lord and Master, Foamy. Link to comment https://forums.kleientertainment.com/forums/topic/11621-tutorial-examplestemplates-for-mods-rain-update/page/2/#findComment-134533 Share on other sites More sharing options...
MyHand Posted April 18, 2013 Share Posted April 18, 2013 Thx for upload :DI will use the "recipe" example for my first mod, and i have created a function for add 1,2 or 3 ingredient ( that avoid me to repeat all time the function in your example... logic ? )So thank again Link to comment https://forums.kleientertainment.com/forums/topic/11621-tutorial-examplestemplates-for-mods-rain-update/page/2/#findComment-144116 Share on other sites More sharing options...
sadra0 Posted June 1, 2013 Share Posted June 1, 2013 Hey is there anyway to change the amount of picking items? like flints or carrots or grasses for example i want to change amount of cutgrass a grass tuft give me from 1 to 3 how can i do it? i try use lootdropper comp but i think its for things they can drop items not pickable free items on ground?im getting mad xD Link to comment https://forums.kleientertainment.com/forums/topic/11621-tutorial-examplestemplates-for-mods-rain-update/page/2/#findComment-188492 Share on other sites More sharing options...
no_signal Posted June 1, 2013 Share Posted June 1, 2013 Hey is there anyway to change the amount of picking items? like flints or carrots or grasses for example i want to change amount of cutgrass a grass tuft give me from 1 to 3 how can i do it? i try use lootdropper comp but i think its for things they can drop items not pickable free items on ground?im getting mad xDThis will make you pickup 3 grass.AddPrefabPostInit("grass", function (inst) inst.components.pickable.numtoharvest = 3 end)I can also show you how to get a random amount. Link to comment https://forums.kleientertainment.com/forums/topic/11621-tutorial-examplestemplates-for-mods-rain-update/page/2/#findComment-188638 Share on other sites More sharing options...
sadra0 Posted June 5, 2013 Share Posted June 5, 2013 thx alot it working Link to comment https://forums.kleientertainment.com/forums/topic/11621-tutorial-examplestemplates-for-mods-rain-update/page/2/#findComment-193698 Share on other sites More sharing options...
tehMugwump Posted June 8, 2013 Share Posted June 8, 2013 Note to everyone: This thread needs a massive update. The latest Cave update is changing how most of this works (and is making things easier), so keep this in mind when reading it. Also, with the next update in a few days, ModLib is no longer needed. There are example mods included with the game files in your mod directory that explain the new procedures pretty well. Ask if you have any questions. Link to comment https://forums.kleientertainment.com/forums/topic/11621-tutorial-examplestemplates-for-mods-rain-update/page/2/#findComment-196939 Share on other sites More sharing options...
dw420 Posted June 12, 2013 Share Posted June 12, 2013 (edited) Noob Question: I want my game to have 24 segment days instead of 16..why? i don't know...i just do (hello OCD)The easy part was getting the day to be 24 "hours" long---contents of modmain.lua local seg_time = 30 --seconds per segment local total_day_time = seg_time*24 --number of segments in a day --default: : 16 = 8 mins ..24 = 12mins --day phases -- settings are for summer daylocal day_segs = 12 --default: 10local dusk_segs = 8 --default: 4local night_segs = 4 --default: 2---i split those with HFs dawn mode (<3 ) in mind where dusk = evening+dawn --->i find 12day-4dusk-4night-4dawn to be a fair distribution for summer---TUNING.AUTOSAVE_INTERVAL = total_day_timeTUNING.SEG_TIME = seg_timeTUNING.TOTAL_DAY_TIME = total_day_timeTUNING.DAY_SEGS_DEFAULT = day_segsTUNING.DUSK_SEGS_DEFAULT = dusk_segsTUNING.NIGHT_SEGS_DEFAULT = night_segs---this doesn't look the most efficient way to do it, but ...monkey see, monkey do---All that remained was defining my assets (which i did) .---contents of modmain.luaAssets = { Asset("IMAGE", MODROOT.."images/clock_hand_24.tex") Asset("IMAGE", MODROOT.."images/clock_night_24.tex") Asset("IMAGE", MODROOT.."images/clock_rim_24.tex") Asset("IMAGE", MODROOT.."images/clock_wedge_24.tex")}and "asking" the game to swap the original textures with the ones i provided.Which is where i am stuck.I have taken a peak inside a few mods, but those that define new textures also come with added features that when trying to figure what is what, "if it weren't for my horse.." pops into mind and i have to stop or risk an aneurysm.So...is there a way to do this through code (prefab??) rather than having to replace the original texture files?Thanks in advance.[e] upon further investigation i found that the textures i want to replace are referenced in hud.lua, but i am still missing the function that asks for the switch [e] Edited June 12, 2013 by dw420 Link to comment https://forums.kleientertainment.com/forums/topic/11621-tutorial-examplestemplates-for-mods-rain-update/page/2/#findComment-201866 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