Jump to content

charracter mod with fishing rod


Recommended Posts

On ‎2‎/‎2‎/‎2018 at 1:08 AM, Andreasgamming said:

Post the Crash log and/or the mod itself, the People here may be able to spot the issue.

[string".../mods/Test(1)/script/prefabs/test.lua"]:70: variable #start_inv' is not declared

LUA ERROR traceback:

   =[C] in function 'error'

   script/strict.lua(23,1)

   .../mods/Test(1)/scripts/profabs/test.lua(70,1) in function 'fn'

   scripts/mainfunction.öua(149,1)

   =(tail call) ?

   script/mods.lua(158,1)

   scripts/mods.lua(598,1) in function 'RegisterPrefabs'

On ‎2‎/‎3‎/‎2018 at 3:35 AM, K1NGT1GER609 said:

Here's a directory of where you can find the error:

C:\Users\yourname\Documents\Klei\DoNotStarveTogether\client_log

Get that client log and post it here, not much to go by here.

I purchased the Don't Starve Together from Steam, and it seems I can't find the client_log 

Link to comment
Share on other sites

Have you defined start_inv at the beginning of the character prefab file? For example, the beginning of my character prefab looks like this

Spoiler

local MakePlayerCharacter = require "prefabs/player_common"


local assets = {
    Asset("SCRIPT", "scripts/prefabs/player_common.lua"),
}
local prefabs = {
	"rainbowfeather",
}

-- Custom starting items
local start_inv = {
	"rainbowfeather",
}

 

But you would put "fishingrod" instead of "rainbowfeather"

Link to comment
Share on other sites

Might it have something to do with the log saying your item is in the "profabs" folder instead of "prefabs?"

   .../mods/Test(1)/scripts/profabs/test.lua(70,1)

   scripts/mainfunction.öua

But there are a lot of strange characters in that error report. I can't tell if it was maybe just a pasting formatting error, or if Wigfrid has been editing your file names.

 

 

Link to comment
Share on other sites

5 hours ago, Ray025 said:

[string".../mods/Test(1)/script/prefabs/test.lua"]:70: variable #start_inv' is not declared

LUA ERROR traceback:

   =[C] in function 'error'

   script/strict.lua(23,1)

   .../mods/Test(1)/scripts/profabs/test.lua(70,1) in function 'fn'

   scripts/mainfunction.öua(149,1)

   =(tail call) ?

   script/mods.lua(158,1)

   scripts/mods.lua(598,1) in function 'RegisterPrefabs'

I purchased the Don't Starve Together from Steam, and it seems I can't find the client_log 

I purchased it on steam as well, and I have a client log under C:\Users\pcname\Documents\Klei\DoNotStarveTogether\client_log

Link to comment
Share on other sites

error trackback points at: missing start_inv, undeclared variables, profabs? it should be prefabs or you'll get directory errors, and the last errors are just call backs saying something is wrong with function "fn" on test.lua at line 70 so I guess some sort of syntax error.

Edited by K1NGT1GER609
Link to comment
Share on other sites

23 hours ago, Eusong said:

Have you defined start_inv at the beginning of the character prefab file? For example, the beginning of my character prefab looks like this

  Hide contents


local MakePlayerCharacter = require "prefabs/player_common"


local assets = {
    Asset("SCRIPT", "scripts/prefabs/player_common.lua"),
}
local prefabs = {
	"rainbowfeather",
}

-- Custom starting items
local start_inv = {
	"rainbowfeather",
}

 

But you would put "fishingrod" instead of "rainbowfeather"

I already did. I'm afraid my moded fishingrod might cause the problem

Link to comment
Share on other sites

I have figured out the start_inv problem and also fixed it. But my moded fishingrod still has issues. Can someone please correct my fishinrod.lua so that my char can equip it?

local assets =
{
 Asset("ANIM", "anim/fishinrod.zip"),
 Asset("ANIM", "anim/swap_fishinrod.zip"),
 Asset("ATLAS", "images/inventoryimages/fishinrod.xml"),
 Asset("IMAGE", "images/inventoryimages/fishinrod.tex"),
}
local function onequip (inst, owner)
 owner.AnimState:OverrideSymbol("swap_object", "swap_fishinrod", "swap_fishinrod")
 owner.AnimState:OverrideSymbol("fishingline", "swap_fishinrod", "fishingline"
 owner.AnimState:OverrideSymbol("FX_fishing", "swap_fishinrod", "FX_fishing")
 owner.AnimState:Show("ARM_carry")
 owner.AnimState:Hide("ARM_normal")
end
 
local function onunequip(inst, owner)
 owner.AnimState:Hide("ARM_carry")
 owner.AnimState:Show("ARM_normal")
 owner.AnimState:ClearOverrideSymbol("fishingline")
 owner.AnimState:ClearOverrideSymbol("FX_fishing")
end
 
local function fn()
    local inst = CreateEntity()
    inst.entity:AddTransform()
    inst.entity:AddAnimState()
    inst.entity:AddSoundEmitter()
    inst.entity:AddNetwork()
 
    MakeInventoryPhysics(inst)
 
    inst.AnimState:SetBank("fishinrod")--inst.AnimState:SetBank("fishinrod")
    inst.AnimState:SetBuild("fishinrod")--inst.AnimState:SetBuild("fishinrod")
    inst.AnimState:PlayAnimation("idle")
 
    inst.entity:SetPristine()
 
    if not TheWorld.ismastersim then
        return inst
    end
 
    inst:AddComponent("weapon")
    inst.components.weapon:SetDamage(TUNING.FISHINGROD_DAMAGE)
    inst.components.weapon.attackwear = 4
    -------
    inst:AddComponent("fishingrod")
    inst.components.fishingrod:SetWaitTimes(4, 40)
    inst.components.fishingrod:SetStrainTimes(0, 5)
    -------
    inst:AddComponent("inspectable")
    inst:AddComponent("inventoryitem")
    inst.components.inventoryitem.imagename = "fishinrod"
    inst.components.inventoryitem.atlasname = "images/inventoryimages/fishinrod.xml"
    -------
    inst:AddComponent("equippable")
    inst.components.equippable:SetOnEquip(OnEquip)
    inst.components.equippable:SetOnUnequip(OnUnequip)
 
    MakeHauntableLaunch(inst)
 
    return inst
end
return Prefab("common/inventory/fishinrod", fn, assets)
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...