Jump to content

none of my mods will work


Recommended Posts

I'm an artist, not a modder, therefore I don't really have any idea what I'm doing.
 
None of my mods are working right now, and only one of them seems to have an obvious reason to not work (and only one other has a possible reason)
 
two of my mods are having eof problems. I've checked and double checked the lines of code mentioned in crash reports and none of them seem to need any of the "expected" symbols in their code. And when I put expected symbols in the crash log tells me they shouldn't be there.

 

--[[

birds.lua
 
This assumes the bird already has a build, inventory icon, sounds and a feather_name prefab exists
 
]]--
 
 
local brain = require "brains/birdbrain"
 
local function ShouldSleep(inst)
    return DefaultSleepTest(inst) and not inst.sg:HasStateTag("flying")
end
 
 
 
local function OnAttacked(inst, data)
    local x,y,z = inst.Transform:GetWorldPosition()
    local ents = TheSim:FindEntities(x,y,z, 30, {'bird'})
    
    local num_friends = 0
    local maxnum = 5
    for k,v in pairs(ents) do
        if v ~= inst then
            v:PushEvent("gohome")
            num_friends = num_friends + 1
        end
        
        if num_friends > maxnum then
            
return
        end
        
    end
end
 
local function OnTrapped(inst, data)
 
    if data and data.trapper and data.trapper.settrapsymbols then
        data.trapper.settrapsymbols(inst.trappedbuild)
    end
end
 
local function OnDropped(inst)
    inst.sg:GoToState("stunned")
end
 
local function SeedSpawnTest()
    return not TheWorld.state.iswinter
end
 
local function makebird(name, soundname)
    local assets=
    {
   Asset("ANIM", "anim/crow.zip"),
   Asset("ANIM", "anim/"..name.."_build.zip"),
   Asset("SOUND", "sound/birds.fsb"),
    }
    
    local prefabs =
    {
        "seeds",
"goldnugget",
        "smallmeat",
        "cookedsmallmeat",
"feather_crow",
        --"feather_"..name,
    }
end
    
 
    local function fn()
        local inst = CreateEntity()
 
        --Core components
        inst.entity:AddTransform()
 
 
 
        inst.entity:AddPhysics()
 
        inst.entity:AddAnimState()
        inst.entity:AddDynamicShadow()
 
 
        inst.entity:AddSoundEmitter()
        inst.entity:AddNetwork()
 
        --Initialize physics
        inst.Physics:SetCollisionGroup(COLLISION.CHARACTERS)
        inst.Physics:ClearCollisionMask()
        inst.Physics:CollidesWith(COLLISION.WORLD)
        inst.Physics:SetSphere(1)
        inst.Physics:SetMass(1)
 
 
        inst:AddTag("bird")
        inst:AddTag(name)
        inst:AddTag("smallcreature")
 
 
        inst.Transform:SetTwoFaced()   
        inst.AnimState:SetBank("crow")
        inst.AnimState:SetBuild(name.."_build")
        inst.AnimState:PlayAnimation("idle")
inst.DynamicShadow:SetSize(1, .75)
        inst.DynamicShadow:Enable(false)
 
        MakeFeedablePetPristine(inst)
 
        if not TheWorld.ismastersim then
            return inst
        end
 
        inst.entity:SetPristine()
 
        inst.sounds =
        {
            takeoff = "dontstarve/birds/takeoff_"..soundname,
            chirp = "dontstarve/birds/chirp_"..soundname,
            flyin = "dontstarve/birds/flyin",
        }
        inst.trappedbuild = name.."_build"
        
        inst:AddComponent("locomotor") -- locomotor must be constructed before the stategraph
        inst.components.locomotor:EnableGroundSpeedMultiplier(false)
   inst.components.locomotor:SetTriggersCreep(false)
        inst:SetStateGraph("SGbird")
 
        inst:AddComponent("lootdropper")
        if name == "phoebe" then
            inst.components.lootdropper:AddRandomLoot("feather_crow", .5)
        elseif name == "mag" then
            inst.components.lootdropper:AddRandomLoot("feather_crow", .35)
   inst.components.lootdropper:AddRandomLoot("goldnugget", .05)
   inst.components.lootdropper:AddRandomLoot("flint", .1)
        end
        inst.components.lootdropper:AddRandomLoot("smallmeat", .5)
        inst.components.lootdropper.numrandomloot = 1
        
        inst:AddComponent("occupier")
        
        inst:AddComponent("eater")
        inst.components.eater:SetDiet({ FOODTYPE.SEEDS }, { FOODTYPE.SEEDS })
 
        
        inst:AddComponent("sleeper")
        inst.components.sleeper:SetSleepTest(ShouldSleep)
 
        inst:AddComponent("inventoryitem")
        inst.components.inventoryitem.nobounce = true
        inst.components.inventoryitem.canbepickedup = false
        
        inst.components.inventoryitem.imagename = name    
        inst.components.inventoryitem.atlasname = "images/inventoryimages/"..name..".xml"
 
        inst:AddComponent("cookable")
        inst.components.cookable.product = "cookedsmallmeat"
 
 
        inst:AddComponent("combat")
        inst.components.combat.hiteffectsymbol = "crow_body"
        --inst.components.combat.canbeattackedfn = canbeattacked
        inst:AddComponent("health")
inst.components.health:SetMaxHealth(TUNING.BIRD_HEALTH)
inst.components.health.murdersound = "dontstarve/wilson/hit_animal"
        
        inst:AddComponent("inspectable")
       
        
        inst:SetBrain(brain)
        
        MakeSmallBurnableCharacter(inst, "crow_body")
        MakeTinyFreezableCharacter(inst, "crow_body")
 
inst:AddComponent("hauntable")
        inst.components.hauntable:SetHauntValue(TUNING.HAUNT_TINY)
        inst:AddComponent("periodicspawner")
        inst.components.periodicspawner:SetPrefab("seeds")
        inst.components.periodicspawner:SetDensityInRange(40, 2)
        inst.components.periodicspawner:SetMinimumSpacing(7)
inst.components.periodicspawner:SetSpawnTestFn( SeedSpawnTest )
 
        
        
        inst:ListenForEvent("ontrapped", OnTrapped)
        
        
        inst:ListenForEvent("attacked", OnAttacked)
 
local birdspawner = TheWorld.components.birdspawner
        if birdspawner ~= nil then
            inst:ListenForEvent("onremove", birdspawner.StopTrackingFn)
            inst:ListenForEvent("enterlimbo", birdspawner.StopTrackingFn)
            -- inst:ListenForEvent("exitlimbo", birdspawner.StartTrackingFn)
            birdspawner:StartTracking(inst)
        end
 
        MakeFeedablePet(inst, TUNING.BIRD_PERISH_TIME, nil, OnDropped)
 
        return inst
    end
    
    return Prefab("forest/animals/"..name, fn, assets, prefabs)
end
 
 
return makebird("crow", "crow"),
  makebird("robin", "robin"),
  makebird("robin_winter", "junco"),
  makebird("magpie", "crow"),
  makebird("phoebe", "robin")

This is one of the files of code that keeps causing problems no matter what I do. The issue is somewhere in the area highlighted red, and the crash log states that it wants an eof near "end" in line 205 (highlighted blue). I know this is usually due to too many eofs or too few but I can't find any scapegoats in the code.

 

 

This bit of code also has an eof problem for some reason

 

name = "Rainbowhound"

description = "a coloful variant of death"
author = "Mf99k"
version = "1.4"
forumthread = ""
api_version = 10
icon_atlas = "phoebe.xml"
icon = "phoebe.tex"
all_clients_require_mod = true
dst_compatible = true
 

 

 

and finally

 

 

local rainbow_staff = GLOBAL.Recipe("rainbow_staff", { Ingredient("purplegem",1), Ingredient("bluegem", 1), Ingredient("greengem", 1), Ingredient("yellowgem",1), Ingredient("orangegem", 1), Ingredient("redgem", 1), Ingredient("goldnugget", 2)})RECIPETABS.MAGIC,  TECH.MAGIC_TWO

rainbow_staff.atlas = "images/inventoryimages/rainbow_staff.xml"
 

(the formatting is fine in the actual code) the game wants an "=" by rainbow_staff in the last line but there already is an = so I'm confused.

 

any help would be great

Link to comment
Share on other sites

for the birds why was this part changed?

return Prefab("forest/animals/"..name, fn, assets, prefabs)

and the 2 new birds use existing textures, which im guessing is on purpose as you're just testing to see if it works first..

 

as for the rainbow staff try this:

local rainbow_staff = GLOBAL.Recipe("rainbow_staff",        {            Ingredient("purplegem",1),            Ingredient("bluegem", 1),            Ingredient("greengem", 1),            Ingredient("yellowgem",1),            Ingredient("orangegem", 1),            Ingredient("redgem", 1),            Ingredient("goldnugget", 2)        },        RECIPETABS.MAGIC,  TECH.MAGIC_TWO) rainbow_staff.atlas = "images/inventoryimages/rainbow_staff.xml"
Edited by Aquaterion
Link to comment
Share on other sites

Comparing the first file with birds.lua shows that there is an extra end at line 68:

 

local prefabs =

{

"seeds",

"goldnugget",

"smallmeat",

"cookedsmallmeat",

"feather_crow",

--"feather_"..name,

}

--end

Link to comment
Share on other sites

 

for the birds why was this part changed?

return Prefab("forest/animals/"..name, fn, assets, prefabs)

and the 2 new birds use existing textures, which im guessing is on purpose as you're just testing to see if it works first..

 

as for the rainbow staff try this:

local rainbow_staff = GLOBAL.Recipe("rainbow_staff",        {            Ingredient("purplegem",1),            Ingredient("bluegem", 1),            Ingredient("greengem", 1),            Ingredient("yellowgem",1),            Ingredient("orangegem", 1),            Ingredient("redgem", 1),            Ingredient("goldnugget", 2)        },        RECIPETABS.MAGIC,  TECH.MAGIC_TWO) rainbow_staff.atlas = "images/inventoryimages/rainbow_staff.xml

I don't think I changed any of that line in the first one.

 

 

Comparing the first file with birds.lua shows that there is an extra end at line 68:

 

Thanks, that was probably the issue

Link to comment
Share on other sites

 

  inst:AddComponent("lootdropper")

        if name == "phoebe" then
            inst.components.lootdropper:AddRandomLoot("feather_crow", .5)
        elseif name == "mag" then
            inst.components.lootdropper:AddRandomLoot("feather_crow", .3)
   inst.components.lootdropper:AddRandomLoot("goldnugget", .1)
   inst.components.lootdropper:AddRandomLoot("flint", .1)
elseif name == "crow", "robin" then
   inst.components.lootdropper:AddRandomLoot("feather"..name..", .5) 
        inst.components.lootdropper:AddRandomLoot("smallmeat", .5)
        inst.components.lootdropper.numrandomloot = 1
        

again, formatting is correct in the actual file. Crash log says it wants "then" near the comma but I don't know why

Link to comment
Share on other sites

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
 Share

×
  • Create New...