Crestonia Posted February 28, 2015 Share Posted February 28, 2015 I have a hat mod and I was wondering how I put a sanity gain it. Also I was wondering how to add it to a character mod I was making. Does anyone have any advice? Link to comment Share on other sites More sharing options...
ELEMENTALCRAFTER009 Posted February 28, 2015 Share Posted February 28, 2015 inst:AddComponent("dapperness")inst.components.dapperness.dapperness = TUNING.DAPPERNESS_TINYfor a sanity gain Link to comment Share on other sites More sharing options...
Crestonia Posted February 28, 2015 Author Share Posted February 28, 2015 Thanks for the advice But does anyone know how to transfer a hat to a character mod to make it a part of it? Link to comment Share on other sites More sharing options...
rezecib Posted March 1, 2015 Share Posted March 1, 2015 (edited) transfer a hat to a character mod to make it a part of it?I'm not sure what you mean. Do you want it to be something only that character can craft, a unique item they start, with, or what? You can use add the prefab file for the hat to your mod's scripts/prefabs folder, which is where your character should be. You'll also have to add it to the PrefabFiles table in the modmain. There are several character mods that add custom items (with both of the approaches I suggested above), so you can check how those do it. Edited March 1, 2015 by rezecib Link to comment Share on other sites More sharing options...
Crestonia Posted March 1, 2015 Author Share Posted March 1, 2015 @rezecib I'm sorry! I meant a unique item when they start Link to comment Share on other sites More sharing options...
Crestonia Posted March 1, 2015 Author Share Posted March 1, 2015 inst:AddComponent("dapperness")inst.components.dapperness.dapperness = TUNING.DAPPERNESS_TINYfor a sanity gain Idk what's going on, but whenever I give myself the item, it doesn't raise my sanity. I was wondering where to I paste it into the prefab (just in case I'm doing it wrong.) Link to comment Share on other sites More sharing options...
rezecib Posted March 1, 2015 Share Posted March 1, 2015 @Crestonia, show us your current version of the prefab file? It should be in the fn() (the function that gets passed to the Prefab(...) constructor, usually called simply "fn"), after the part where it says "if not TheWorld.ismastersim then return inst end" To make it a unique item that they start with, just add it to their starter_inv (it should be a list in your character's prefab, empty by default). Link to comment Share on other sites More sharing options...
Crestonia Posted March 1, 2015 Author Share Posted March 1, 2015 @rezecib Here's the prefabhat_bee_bw.lua Link to comment Share on other sites More sharing options...
ELEMENTALCRAFTER009 Posted March 1, 2015 Share Posted March 1, 2015 (edited) Idk what's going on, but whenever I give myself the item, it doesn't raise my sanity. I was wondering where to I paste it into the prefab (just in case I'm doing it wrong.)You put in the local function fn() anywhere below the inst.entity:SetPristine() Edited March 1, 2015 by ELEMENTALCRAFTER009 Link to comment Share on other sites More sharing options...
Crestonia Posted March 1, 2015 Author Share Posted March 1, 2015 Thank you guys a lot the sanity is going up now >w< Link to comment Share on other sites More sharing options...
Crestonia Posted March 1, 2015 Author Share Posted March 1, 2015 I ran into an error... I tried to basically paste the hat mod into a character mod and it sayshttp://steamcommunity.com/sharedfiles/filedetails/?id=400866265oh and also here's the file. I don't know how to solve the issue about the modmain, I looked at a mod on steam and used it as a reference, and I don't know what I did wrong. I hope someone can help.Character.zip Link to comment Share on other sites More sharing options...
rezecib Posted March 1, 2015 Share Posted March 1, 2015 @Crestonia, You're missing the comma after "esctemplate" Link to comment Share on other sites More sharing options...
Crestonia Posted March 1, 2015 Author Share Posted March 1, 2015 @rezecib It didn't crash, but the hat did not start in the character's inventory either. Do you know how to fix this? Link to comment Share on other sites More sharing options...
rezecib Posted March 1, 2015 Share Posted March 1, 2015 @Crestonia, You never added it to the starter inventory in your character's prefab... this part:local start_inv = { -- Custom starting items } Link to comment Share on other sites More sharing options...
Crestonia Posted March 1, 2015 Author Share Posted March 1, 2015 Thank you 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