The Noon Fish Posted December 31, 2014 Share Posted December 31, 2014 ok so i deiced to make a mod adding two things/creatures i saw from my dream.though i had ran into an prob noob error of sorts, and i remember it from the other attempts at trying to make a functional mod.here's the error i got (even though i have a feeling it's not gonna help.)i would and do appreciate some help (if there is any) Link to comment Share on other sites More sharing options...
Blueberrys Posted December 31, 2014 Share Posted December 31, 2014 It would be helpful to see some of your code too. Additionally, be more positive. Bugs naturally occur while modding (and any sort of programming, for that matter). Don't be discouraged by them! Since it is important to know how to read errors, here's a simple explanation of that one. The following mod(s) have caused a failure:blah/blah/modname/modmain.lua:8: attempt to index local 'creature' (a nil value)This part shows you what the error is, and where it occurred. In this case, it was on line 8 of modmain.lua inside "modname".The syntax used here is:Path/To/Mod/File.lua : Line-Number : Error-Message As for the error message itself:"attempt to index local 'creature'" means the mod tried to use a local variable called "creature"."(a nil value)" explains that the variable was undefined. ("nil" means undefined in lua, think of it as "empty" for now) LUA ERROR stark traceback: blah/blah/modname/modmain.lua(8,1) =(tail call) ? =[C] in function 'xpcall' blah/blah/mods.lua(15,1) etc...This part tells you which parts of the code executed correctly until the error arose. It's useful if you want to figure out why a variable wasn't properly defined, or to find logical errors. You can usually ignore it for simple errors, if it seems daunting. Link to comment Share on other sites More sharing options...
The Noon Fish Posted December 31, 2014 Author Share Posted December 31, 2014 It would be helpful to see some of your code too. Additionally, be more positive. Bugs naturally occur while modding (and any sort of programming, for that matter). Don't be discouraged by them! Since it is important to know how to read errors, here's a simple explanation of that one. This part shows you what the error is, and where it occurred. In this case, it was on line 8 of modmain.lua inside "modname".The syntax used here is:Path/To/Mod/File.lua : Line-Number : Error-Message As for the error message itself:"attempt to index local 'creature'" means the mod tried to use a local variable called "creature"."(a nil value)" explains that the variable was undefined. ("nil" means undefined in lua, think of it as "empty" for now) This part tells you which parts of the code executed correctly until the error arose. It's useful if you want to figure out why a variable wasn't properly defined, or to find logical errors. You can usually ignore it for simple errors, if it seems daunting.ok im not sure what to send you so have the whole thing i guessalso, that was my attempt at being positive.never mind, i fixed it.ran into another problem:brain code thingyrequire "behaviours/follow"require "behaviours/wander"require "behaviours/faceentity"require "behaviours/panic" local MIN_FOLLOW_DIST = 0local MAX_FOLLOW_DIST = 12local TARGET_FOLLOW_DIST = 6 local MAX_WANDER_DIST = 3 local function GetFaceTargetFn(inst) return inst.components.follower.leaderend local function KeepFaceTargetFn(inst, target) return inst.components.follower.leader == targetend local BabyBrain = Class(Brain, function(self, inst) Brain._ctor(self, inst)end) function BabyBrain:OnStart() local root = PriorityNode({ WhileNode( function() return self.inst.components.health.takingfiredamage end, "OnFire", Panic(self.inst)), Follow(self.inst, function() return self.inst.components.follower.leader end, MIN_FOLLOW_DIST, TARGET_FOLLOW_DIST, MAX_FOLLOW_DIST), FaceEntity(self.inst, GetFaceTargetFn, KeepFaceTargetFn), Wander(self.inst, function() return self.inst.components.knownlocations:GetLocation("home") end, MAX_WANDER_DIST), }, .25) self.bt = BT(self.inst, root)end return BabyBrain nevermind, it refuses to move anywhere but to the left side of my screen Link to comment Share on other sites More sharing options...
The Noon Fish Posted January 3, 2015 Author Share Posted January 3, 2015 ok i fixed the animation error of the ears flying away from the face, but now i got an other coding errorscreenshot:brain code thingy:[codesyntax]require "behaviours/follow"local baby_brain = Class(Brain, function(self, inst)Brain._ctor(self, inst)end)local MIN_FOLLOW = 4local MAX_FOLLOW = 7local MED_FOLLOW = 6local function GetFaceTargetFn(inst)return inst.components.follower.leaderendlocal function KeepFaceTargetFn(inst, target)return inst.components.follower.leader == targetendfunction baby_brain:OnStart()local root = PriorityNode({Follow(self.inst, function() return self.inst.components.follower.leader end MIN_FOLLOW), MED_FOLLOW, MAX_FOLLOW, TRUE),--FaceEntity(self.inst, GetFaceTargetFn, KeepFaceTargetFn),}, .5)self.bt = BT(self.inst, root)endreturn baby_brain[/codesyntax] Link to comment Share on other sites More sharing options...
debugman18 Posted January 3, 2015 Share Posted January 3, 2015 ok i fixed the animation error of the ears flying away from the face, but now i got an other coding errorscreenshot:Screenshot 2015-01-03 12.41.46.pngbrain code thingy:[codesyntax]require "behaviours/follow"local baby_brain = Class(Brain, function(self, inst)Brain._ctor(self, inst)end)local MIN_FOLLOW = 4local MAX_FOLLOW = 7local MED_FOLLOW = 6local function GetFaceTargetFn(inst)return inst.components.follower.leaderendlocal function KeepFaceTargetFn(inst, target)return inst.components.follower.leader == targetendfunction baby_brain:OnStart()local root = PriorityNode({Follow(self.inst, function() return self.inst.components.follower.leader end MIN_FOLLOW), MED_FOLLOW, MAX_FOLLOW, TRUE),--FaceEntity(self.inst, GetFaceTargetFn, KeepFaceTargetFn),}, .5)self.bt = BT(self.inst, root)endreturn baby_brain[/codesyntax] Check this line out, you'll find your problem: Follow(self.inst, function() return self.inst.components.follower.leader end MIN_FOLLOW), MED_FOLLOW, MAX_FOLLOW, TRUE), Link to comment Share on other sites More sharing options...
The Noon Fish Posted January 3, 2015 Author Share Posted January 3, 2015 Check this line out, you'll find your problem:Follow(self.inst, function() return self.inst.components.follower.leader end MIN_FOLLOW), MED_FOLLOW, MAX_FOLLOW, TRUE),fixed it, but now it says that follower is a nil value. Link to comment Share on other sites More sharing options...
debugman18 Posted January 3, 2015 Share Posted January 3, 2015 fixed it, but now it says that follower is a nil value. Make sure your prefab has the "follower" component. Link to comment Share on other sites More sharing options...
The Noon Fish Posted January 3, 2015 Author Share Posted January 3, 2015 Make sure your prefab has the "follower" component.it works!now i just gotta just do a few more things with it..... Link to comment Share on other sites More sharing options...
The Noon Fish Posted January 4, 2015 Author Share Posted January 4, 2015 ok now whenever i try to spawn my creature, it kinda freezes the game (ie making the world clock thing disappear) and if i tried to make the game spawn my creature on starting the game, it crashes, saying that creature from line 8 is nil or something in modmain.-.modmain.lua code[codesyntax]PrefabFiles = {"baby",}function SpawnCreature(player)local x, y, z = player.Transform:GetWorldPosition()local creature = GLOBAL.SpawnPrefab("forest/animals/baby")creature.Transform:SetPosition( x, y, z )endAddSimPostInit(SpawnCreature)[/codesyntax] Link to comment Share on other sites More sharing options...
debugman18 Posted January 4, 2015 Share Posted January 4, 2015 @The Noon FishIf you want help, you need to start posting your log.txt file, located in Documents/klei/DoNotStarve (on Windows). It's much easier to help you if we don't have to read through all of your code blindly. Link to comment Share on other sites More sharing options...
The Noon Fish Posted January 4, 2015 Author Share Posted January 4, 2015 @The Noon FishIf you want help, you need to start posting your log.txt file, located in Documents/klei/DoNotStarve (on Windows). It's much easier to help you if we don't have to read through all of your code blindly.im sorry, i didn't know that was a thing. im such an idiotlog.txti tried 4 times already to post this Link to comment Share on other sites More sharing options...
debugman18 Posted January 4, 2015 Share Posted January 4, 2015 im sorry, i didn't know that was a thing. im such an idiotlog.txti tried 4 times already to post this No worries! I'll take a look at it. Edit:I think you're missing a letter. ...arve/data/../mods/babything/scripts/prefabs/baby.lua:48: attempt to index field 'CHARATER' (a nil value) Link to comment Share on other sites More sharing options...
The Noon Fish Posted January 4, 2015 Author Share Posted January 4, 2015 *character ........*facedesk* i can not spell a whole loti blame my medicine i fixed the character thing, but i still get the same errorlog.txt(for in case anything changed) Link to comment Share on other sites More sharing options...
The Noon Fish Posted January 4, 2015 Author Share Posted January 4, 2015 tell me there isnt a single thing wrong with thisthis happens when i try to spawn my prefab.the HUD and stuff disappear, i can't move willow, and when i open the console, can't type anything in it and can't close it.i also can't pause the game when pressing 'esc' keyif i try to make the modmain to spawn it on start, it still gives me the error, despite fixing the character error/misspelling log.txt Link to comment Share on other sites More sharing options...
debugman18 Posted January 4, 2015 Share Posted January 4, 2015 Screenshot 2015-01-04 10.29.01.pngtell me there isnt a single thing wrong with thisthis happens when i try to spawn my prefab.the HUD and stuff disappear, i can't move willow, and when i open the console, can't type anything in it and can't close it.i also can't pause the game when pressing 'esc' keyif i try to make the modmain to spawn it on start, it still gives me the error, despite fixing the character error/misspelling log.txt Firstly, still another typo: [string "spwaenprefab("baby")"]:1: variable 'spwaenprefab' is not declared Don't feel bad about it. Typos and missing things get me from time to time as well. Link to comment Share on other sites More sharing options...
The Noon Fish Posted January 4, 2015 Author Share Posted January 4, 2015 Firstly, still another typo:[string "spwaenprefab("baby")"]:1: variable 'spwaenprefab' is not declaredDon't feel bad about it. Typos and missing things get me from time to time as well.i had fixed that typo, but i got the same error. i removed the custom lines for my creature and it works.now i need to figure out where to put the custom character lines, without crashing my game edit:forgot to attach the loglog.txt Link to comment Share on other sites More sharing options...
The Noon Fish Posted January 5, 2015 Author Share Posted January 5, 2015 ok, i need help setting up how to change "examine MISSING NAME" to whatever i want to name it, but when try i get errors or my game freezes.i hope it's not because of another typolog.txt Link to comment Share on other sites More sharing options...
UnderwearApp Posted January 5, 2015 Share Posted January 5, 2015 ok, i need help setting up how to change "examine MISSING NAME" to whatever i want to name it, but when try i get errors or my game freezes.i hope it's not because of another typolog.txt So are you still freezing on creature spawn or is this something else you are trying and that is fixed? Link to comment Share on other sites More sharing options...
The Noon Fish Posted January 5, 2015 Author Share Posted January 5, 2015 So are you still freezing on creature spawn or is this something else you are trying and that is fixed?i manage to fix that, along with it saying "examine MISSING NAME" but then i got an new errorlog.txt Link to comment Share on other sites More sharing options...
The Noon Fish Posted January 6, 2015 Author Share Posted January 6, 2015 bluh i will get this mod working if it's the last thing i do.log.txt Link to comment Share on other sites More sharing options...
UnderwearApp Posted January 6, 2015 Share Posted January 6, 2015 It'd be easier to help if you posted your mod. Otherwise all we can tell you is to look at that line in that file. There are multiple possible causes for that error. Link to comment Share on other sites More sharing options...
The Noon Fish Posted January 6, 2015 Author Share Posted January 6, 2015 It'd be easier to help if you posted your mod. Otherwise all we can tell you is to look at that line in that file. There are multiple possible causes for that error.i did not know thatedit:updated .zipdream baby cat thing.zip Link to comment Share on other sites More sharing options...
The Noon Fish Posted January 9, 2015 Author Share Posted January 9, 2015 never mind i fixed italso i can't think of a name for the cat thing.-. Link to comment Share on other sites More sharing options...
The Noon Fish Posted January 10, 2015 Author Share Posted January 10, 2015 Ok, so after i got the mod to have the characters to say custom lines for the Craot(now renamed to StatiCat) the state graph kinda broke. So after fixing that, i tried to spawn StatiCat into the game using DebugSpawn command, and then it happened again. The HUD disappeared along with the crafting tabs and the inventory. I was able to move willow and collect items, but if i open the console, i would be unable to interact with it and close it. I also would not be able to pause the game.here's the mod:dream baby cat thing.zipand heres the Log:log.txt Link to comment Share on other sites More sharing options...
Blueberrys Posted January 10, 2015 Share Posted January 10, 2015 @The Noon Fish, In your log: ..\mods\babything\scripts\stategraphs/SGbaby.lua:117: ')' expected near 'end'Usually, if not always, the error message telling you the problem is written right above the "LUA ERROR stack traceback:" line in your log.txt. Look for that whenever something goes wrong, and you'll probably spot the error right away. In this case, you're missing a closing bracket somewhere before the end of line 117 in SGbaby.lua =[C] in function 'require' I can't seem to post this reply.. Gives me an error about using invalid characters?Worked now. Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.
Please be aware that the content of this thread may be outdated and no longer applicable.