DragonAvenger24 Posted January 16, 2016 Share Posted January 16, 2016 I created a character mod, and am now trying to add a custom weapon, but I must be doing SOMETHING wrong, because the game crashes when I try to activate it. It was originally going to go with my character mod, but I had to separate the two in order to try and figure out what the problem was. I've tried everything I can think of, but it's still having issues. I've even copied and pasted code and used templates for making it, but something is still amiss. I'm pretty sure it's not the coding but I'll include it here. Any help would be appreciated! modmain.lua modinfo.lua kurikara.lua Link to comment https://forums.kleientertainment.com/forums/topic/62549-need-help-with-custom-item-mod/ Share on other sites More sharing options...
Mobbstar Posted January 16, 2016 Share Posted January 16, 2016 First, what is this for (modmain)? local function load() --can be removed IMO local kurikara = GLOBAL.Recipe( "kurikara", {Ingredient("flint", 1)}, RECIPETABS.WAR, {SCIENCE=1} ) kurikara.atlas = "images/inventoryimages/kurikara.xml" TheSim:LoadPrefabs({"kurikara"})--can be removed IMO local kurikara = GLOBAL.GetRecipe("kurikara")--can be removed IMO end--can be removed IMO AddGamePostInit(load)--can be removed IMO Use the log to find the issue. Link to comment https://forums.kleientertainment.com/forums/topic/62549-need-help-with-custom-item-mod/#findComment-709932 Share on other sites More sharing options...
DragonAvenger24 Posted January 16, 2016 Author Share Posted January 16, 2016 1 hour ago, Mobbstar said: First, what is this for (modmain)? local function load() --can be removed IMO local kurikara = GLOBAL.Recipe( "kurikara", {Ingredient("flint", 1)}, RECIPETABS.WAR, {SCIENCE=1} ) kurikara.atlas = "images/inventoryimages/kurikara.xml" TheSim:LoadPrefabs({"kurikara"})--can be removed IMO local kurikara = GLOBAL.GetRecipe("kurikara")--can be removed IMO end--can be removed IMO AddGamePostInit(load)--can be removed IMO Use the log to find the issue. This was part of another mod I copy and pasted from, it allows the item to be crafted, since I couldn't figure out how to make my character start with it. I actually solved the issue a little while ago, after almost a week of trying. It turned out there was something wrong with the build files, so the only issue I'm having now is trying to get the item to not be invisible when I equip it. Link to comment https://forums.kleientertainment.com/forums/topic/62549-need-help-with-custom-item-mod/#findComment-709961 Share on other sites More sharing options...
Mobbstar Posted January 16, 2016 Share Posted January 16, 2016 5 minutes ago, DragonAvenger24 said: This was part of another mod I copy and pasted from, it allows the item to be crafted, since I couldn't figure out how to make my character start with it. I actually solved the issue a little while ago, after almost a week of trying. It turned out there was something wrong with the build files, so the only issue I'm having now is trying to get the item to not be invisible when I equip it. Maybe this helps: link Link to comment https://forums.kleientertainment.com/forums/topic/62549-need-help-with-custom-item-mod/#findComment-709964 Share on other sites More sharing options...
DragonAvenger24 Posted January 17, 2016 Author Share Posted January 17, 2016 17 hours ago, Mobbstar said: Maybe this helps: link I checked it out, but I think I don't quite know where to put everything (Spriter files, images, etc.). Do you have an example of this I could go off of? I'm still super new to this. Kurikara.zip Link to comment https://forums.kleientertainment.com/forums/topic/62549-need-help-with-custom-item-mod/#findComment-710269 Share on other sites More sharing options...
pickleplayer Posted January 18, 2016 Share Posted January 18, 2016 (edited) Maybe this will help? (Edit: wait here's a better one) Edited January 18, 2016 by pickleplayer Link to comment https://forums.kleientertainment.com/forums/topic/62549-need-help-with-custom-item-mod/#findComment-711097 Share on other sites More sharing options...
DragonAvenger24 Posted January 19, 2016 Author Share Posted January 19, 2016 9 hours ago, pickleplayer said: Maybe this will help? (Edit: wait here's a better one) This did help me out quite a bit, I followed the sample download at the beginning and put all my files where they were in the example. I changed up a bunch of things, but it's still invisible in my hand, and I'm really not sure why. I even made sure it wasn't a size issue and scaled it up in the image file, but to no avail. I have a newer version of it here: Kurikara.zip Link to comment https://forums.kleientertainment.com/forums/topic/62549-need-help-with-custom-item-mod/#findComment-711341 Share on other sites More sharing options...
MidrealmDM Posted January 19, 2016 Share Posted January 19, 2016 36 minutes ago, DragonAvenger24 said: This did help me out quite a bit, I followed the sample download at the beginning and put all my files where they were in the example. I changed up a bunch of things, but it's still invisible in my hand, and I'm really not sure why. I even made sure it wasn't a size issue and scaled it up in the image file, but to no avail. I have a newer version of it here: Kurikara.zip usually if it is invisible when equipped it is because of a problem with the anim files. Having not worked with a weapon/item myself I can't offer anything more than that. Link to comment https://forums.kleientertainment.com/forums/topic/62549-need-help-with-custom-item-mod/#findComment-711346 Share on other sites More sharing options...
Arkathorn Posted January 20, 2016 Share Posted January 20, 2016 Sometimes there may be an error in the log, for example if the texture is not loaded by the code. Have you checked there? Also, I suggest you use the Autocompiler from the Don't Starve Mod Tools on Steam to compile the images and animations. This removes a potential issue with image clipping, and is done automatically upon game launch. Firstly, the assets in 'modmain.lua' are not loaded correctly. Try this: Assets = { Asset("ATLAS", "images/inventoryimages/kurikara.xml"), Asset("IMAGE", "images/inventoryimages/kurikara.tex") } Second, there is no need to encase the recipe in a 'load' function, and 'AddGamePostInit' it. The code can be run directly from 'modmain.lua'. Third, it is good form to use the global reference tables provided in 'constants.lua', 'strings.lua', and 'tuning.lua' (eg. 'GLOBAL.TECH.NONE' instead of '{SCIENCE = 0}'). Fourth, there is no need to manually call 'TheSim:LoadPrefabs'. The prefab will be automatically loaded by having it's file in the 'PrefabFiles' list. There is also no reason to assign the recipe to a local variable again, as you already have it assigned to the same variable, and you only need that so you can set the atlas. Fifth, the 'torchfire.lua' file will override the default one, altering all torch fires. Is this your intention? Finally, the final line of 'kurikara.lua' should include the 'prefabs' table, to insure that 'torchfire.lua' is loaded before the Kurikara. Because this is a mod, this is unnecessary, but that is why the 'prefabs' table exists. Link to comment https://forums.kleientertainment.com/forums/topic/62549-need-help-with-custom-item-mod/#findComment-711671 Share on other sites More sharing options...
DragonAvenger24 Posted January 22, 2016 Author Share Posted January 22, 2016 (edited) On 1/20/2016 at 3:57 AM, Arkathorn said: Sometimes there may be an error in the log, for example if the texture is not loaded by the code. Have you checked there? Also, I suggest you use the Autocompiler from the Don't Starve Mod Tools on Steam to compile the images and animations. This removes a potential issue with image clipping, and is done automatically upon game launch. Firstly, the assets in 'modmain.lua' are not loaded correctly. Try this: Assets = { Asset("ATLAS", "images/inventoryimages/kurikara.xml"), Asset("IMAGE", "images/inventoryimages/kurikara.tex") } Second, there is no need to encase the recipe in a 'load' function, and 'AddGamePostInit' it. The code can be run directly from 'modmain.lua'. Third, it is good form to use the global reference tables provided in 'constants.lua', 'strings.lua', and 'tuning.lua' (eg. 'GLOBAL.TECH.NONE' instead of '{SCIENCE = 0}'). Fourth, there is no need to manually call 'TheSim:LoadPrefabs'. The prefab will be automatically loaded by having it's file in the 'PrefabFiles' list. There is also no reason to assign the recipe to a local variable again, as you already have it assigned to the same variable, and you only need that so you can set the atlas. Fifth, the 'torchfire.lua' file will override the default one, altering all torch fires. Is this your intention? Finally, the final line of 'kurikara.lua' should include the 'prefabs' table, to insure that 'torchfire.lua' is loaded before the Kurikara. Because this is a mod, this is unnecessary, but that is why the 'prefabs' table exists. Alright, well I fixed a couple things and checked the log like you asked. I DID find an error which seems to be linked to the swap animations, "Could not find anim build swap_kurikara". But I'm not entirely sure what needs to be done to fix this issue, since I seem to have all the files for it and followed the guide very closely. Edit: I found out what the problem was, I guess I had a copy of the swap_kurikara.anim in another mod I was working on and that was causing conflicts with the updated version I had created. Thanks everybody for all your help! Edited February 1, 2016 by DragonAvenger24 Fixed It! Link to comment https://forums.kleientertainment.com/forums/topic/62549-need-help-with-custom-item-mod/#findComment-712437 Share on other sites More sharing options...
DragonAvenger24 Posted February 6, 2016 Author Share Posted February 6, 2016 On 1/20/2016 at 3:57 AM, Arkathorn said: Sometimes there may be an error in the log, for example if the texture is not loaded by the code. Have you checked there? Also, I suggest you use the Autocompiler from the Don't Starve Mod Tools on Steam to compile the images and animations. This removes a potential issue with image clipping, and is done automatically upon game launch. Firstly, the assets in 'modmain.lua' are not loaded correctly. Try this: Assets = { Asset("ATLAS", "images/inventoryimages/kurikara.xml"), Asset("IMAGE", "images/inventoryimages/kurikara.tex") } Second, there is no need to encase the recipe in a 'load' function, and 'AddGamePostInit' it. The code can be run directly from 'modmain.lua'. Third, it is good form to use the global reference tables provided in 'constants.lua', 'strings.lua', and 'tuning.lua' (eg. 'GLOBAL.TECH.NONE' instead of '{SCIENCE = 0}'). Fourth, there is no need to manually call 'TheSim:LoadPrefabs'. The prefab will be automatically loaded by having it's file in the 'PrefabFiles' list. There is also no reason to assign the recipe to a local variable again, as you already have it assigned to the same variable, and you only need that so you can set the atlas. Fifth, the 'torchfire.lua' file will override the default one, altering all torch fires. Is this your intention? Finally, the final line of 'kurikara.lua' should include the 'prefabs' table, to insure that 'torchfire.lua' is loaded before the Kurikara. Because this is a mod, this is unnecessary, but that is why the 'prefabs' table exists. Do you know how I could apply this affect to my weapon? I want it to have a flame on it that's blue but I can't get it to be a separate prefab without it changing all the torches in the game. Link to comment https://forums.kleientertainment.com/forums/topic/62549-need-help-with-custom-item-mod/#findComment-718342 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