Jump to content

error with game


Recommended Posts

:04:18]: [string "scripts/stategraphs/SGhound.lua"]:231: attempt to index field 'sounds' (a nil value)
LUA ERROR stack traceback:
    scripts/stategraphs/SGhound.lua:231 in (field) fn (Lua) <231-231>
    scripts/stategraph.lua:568 in (method) UpdateState (Lua) <536-580>
    scripts/stategraph.lua:607 in (method) Update (Lua) <599-627>
    scripts/stategraph.lua:125 in (method) Update (Lua) <109-148>
    scripts/update.lua:218 in () ? (Lua) <149-228>

 

i was using a mod and the above happend, any ideas?

Link to comment
Share on other sites

It seems to be an oversight on the modder's side. They didn't include the sounds-variable on the instances of their necrohound prefab, yet they use the SGhound stategraph which utilizes the sounds-variable in question. You can see where Klei adds this variable on lines 46-56 and line 388 in the original hound.lua (prefab). Pretty straight-forward fix.

You can write to the author and link to this post, and see if they want to fix it. They haven't answered for almost a year, so I doubt they'll fix it, so if you want to play with this character online, you'll have to fix it yourself and upload a new version of the mod. Do try asking them first, though.

Edited by Ultroman
Link to comment
Share on other sites

Yes. This line:

inst.sounds = tag == "clay" and sounds_clay or sounds

says: If the variable 'tag' holds the value "clay", then it should set 'inst.sounds' to refer to the 'sounds_clay' variable, otherwise it should set it to refer to the 'sounds' variable.

You can probably just copy lines 46-56 from hound.lua in at the top of the necrohound.lua (roughly the same place that they're placed in hound.lua), and then put in this line (below) where hound.lua has that other line (the one above):

inst.sounds = sounds

since I'm pretty sure the necrohounds are supposed to use the regular hound-sounds and not the clay_hound-sounds.

Edited for clarity.

Edited for more clarity.

Edited by Ultroman
Link to comment
Share on other sites

ok so using that line worked like a charm, another problem arose but it was easy to fix, the OA disabled the follower component but deleting the two lines "--" fixes it, and again, thank you for the HUGE help. idk why i spent 3 hours trying to fix it lmao

Link to comment
Share on other sites

ok, so I spawned another regular hound (not a necromound hound) and it says

[string "../mods/workshop-78170850/scripts/stategra..."]:130: attenpt to index field 'sounds' (a nil value)

so by fixing the necro hound mound we broke the regular hound, so im wondering, do I add the tag "clay"? sadly thats all i could think of as everything you/we fixed , fixed the first problem that was exactly the same thing lmao

 

State{
        name = "taunt",
        tags = { "busy" },

        onenter = function(inst, norepeat)
            if inst:HasTag("clay") then
                inst.sg:GoToState("howl", norepeat and -1 or 0)
            else
                inst.Physics:Stop()
                inst.AnimState:PlayAnimation("taunt")
                inst.sg.statemem.norepeat = norepeat
            end
        end,

        timeline =
        {
            TimeEvent(13 * FRAMES, function(inst) inst.SoundEmitter:PlaySound(inst.sounds.bark) end),
            TimeEvent(24 * FRAMES, function(inst) inst.SoundEmitter:PlaySound(inst.sounds.bark) end),
        },

        events =
        {
            EventHandler("animover", function(inst)
                if not inst.sg.statemem.norepeat and math.random() < .333 then
                    inst.sg:GoToState("taunt", inst.components.follower.leader ~= nil and inst.components.follower.leader:HasTag("player"))
                else
                    inst.sg:GoToState("idle")
                end
            end),
        },
    },

this is the line of code that is crashing the game, ill try my best to figure it out

Link to comment
Share on other sites

perhaps i touched something else and didnt realize it/didnt undo

it was something dumb i did, not sure what, but i uninstalled and reinstalled the mod and made the correct changes to add the sound that you said to do and now both of the good boys are working

 

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