Jump to content

Recommended Posts

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.)

post-250258-0-09313100-1419999916_thumb.

i would and do appreciate some help (if there is any)

 

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.

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 guess

also, that was my attempt at being positive.

never mind, i fixed it.

ran into another problem:

post-250258-0-45812900-1420087644_thumb.

brain code thingy

require "behaviours/follow"
require "behaviours/wander"
require "behaviours/faceentity"
require "behaviours/panic"
 
 
local MIN_FOLLOW_DIST = 0
local MAX_FOLLOW_DIST = 12
local TARGET_FOLLOW_DIST = 6
 
local MAX_WANDER_DIST = 3
 
 
local function GetFaceTargetFn(inst)
    return inst.components.follower.leader
end
 
local function KeepFaceTargetFn(inst, target)
    return inst.components.follower.leader == target
end
 
 
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

Edited by The Noon Fish

ok i fixed the animation error of the ears flying away from the face, but now i got an other coding error

screenshot:

post-250258-0-43969000-1420307249_thumb.

brain code thingy:

[codesyntax]require "behaviours/follow"

local baby_brain = Class(Brain, function(self, inst)
Brain._ctor(self, inst)
end)

local MIN_FOLLOW = 4
local MAX_FOLLOW = 7
local MED_FOLLOW = 6

local function GetFaceTargetFn(inst)
return inst.components.follower.leader
end

local function KeepFaceTargetFn(inst, target)
return inst.components.follower.leader == target
end

function 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)
end

return baby_brain[/codesyntax]

ok i fixed the animation error of the ears flying away from the face, but now i got an other coding error

screenshot:

attachicon.gifScreenshot 2015-01-03 12.41.46.png

brain code thingy:

[codesyntax]require "behaviours/follow"

local baby_brain = Class(Brain, function(self, inst)

Brain._ctor(self, inst)

end)

local MIN_FOLLOW = 4

local MAX_FOLLOW = 7

local MED_FOLLOW = 6

local function GetFaceTargetFn(inst)

return inst.components.follower.leader

end

local function KeepFaceTargetFn(inst, target)

return inst.components.follower.leader == target

end

function 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)

end

return 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),

 

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. :|

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 )
end
AddSimPostInit(SpawnCreature)[/codesyntax]

@The Noon Fish

If 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 idiot

log.txt

i tried 4 times already to post this

im sorry, i didn't know that was a thing. im such an idiot

attachicon.giflog.txt

i 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)
Edited by debugman18

 

*character

 

........

*facedesk*

 

i can not spell a whole lot

i blame my medicine

 

i fixed the character thing, but i still get the same error

log.txt

(for in case anything changed)

Edited by The Noon Fish

post-250258-0-06512500-1420385613_thumb.

tell me there isnt a single thing wrong with this

this 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' key

if 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

 

attachicon.gifScreenshot 2015-01-04 10.29.01.png

tell me there isnt a single thing wrong with this

this 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' key

if i try to make the modmain to spawn it on start, it still gives me the error, despite fixing the character error/misspelling 

attachicon.giflog.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.

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.

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 log

log.txt

Edited by The Noon Fish

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 typo

attachicon.giflog.txt

 

So are you still freezing on creature spawn or is this something else you are trying and that is fixed?

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 that

edit:

updated .zip

dream baby cat thing.zip

Edited by The Noon Fish

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.zip

and heres the Log:

log.txt


 

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.

Edited by Blueberrys

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
×
  • Create New...