MoisiAlt Posted January 7, 2014 Share Posted January 7, 2014 Hello everyone! I'm new to modding but have some coding experience, and I came across an issue I don't understand.I am trying to add a component to several prefabs but it inexplicably seems to work with some but not with others. So in modmain.lua I put :local function MakePrefabFixedSpring( prefab )prefab:AddComponent( "spring" )prefab.components.spring.springsound = "dontstarve/pig/PigKingHappy"endAddPrefabPostInit( "sapling", MakePrefabFixedSpring )and I know this works, as I have an action that tests the presence of the component spring.However, when I try local function MakePrefabFixedSpring( prefab )prefab:AddComponent( "spring" )prefab.components.spring.springsound = "dontstarve/pig/PigKingHappy"endAddPrefabPostInit( "pond", MakePrefabFixedSpring )my action is absolutely ignored. So where is my mistake?Is simply pond the wrong name? if so, where can I find where all the right names are?Can the pond not be target of a custom action? (I doubt that)Am I missing something else entirely? Thanks for any help Link to comment https://forums.kleientertainment.com/forums/topic/30786-adding-component-to-pond/ Share on other sites More sharing options...
s1m13 Posted January 8, 2014 Share Posted January 8, 2014 It seems as if "pond" IS the wrong name. Usually this prefabpostinit needs the x in x.lua which has to be a file in scripts/prefabs so x is the 1. parameter in the function. When im searching for prefab names, i usually use the dont-starve wiki. http://dont-starve-game.wikia.com/wiki/Pond Theres the value "DebugSpawn", which you probably should know. DebugSpawn console command uses the prefab name, just like all lua scripts do. Link to comment https://forums.kleientertainment.com/forums/topic/30786-adding-component-to-pond/#findComment-401219 Share on other sites More sharing options...
MoisiAlt Posted January 8, 2014 Author Share Posted January 8, 2014 Well, that was it!I wasn't aware there were multiple types of ponds, and kept trying on a pond_mos.So I just have to put all three in there.Thanks for the input! Link to comment https://forums.kleientertainment.com/forums/topic/30786-adding-component-to-pond/#findComment-401356 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