Jump to content

Recommended Posts

I'm having some trouble...

A lot of people are crashing with my mod, and I know it has something to do with my character not being able to be hit by tallbirds.

Here's what someone sent me:

The following mod(s) have caused a failure: Crestonia
[string "../mods/workshop-450068153/modmain.lua"]:62:attempt to index field 'combat' (a nil value)
LUA ERROR stack traceback:
    ../mods/workshop-450068153/modmain.lua(62,1)
     =(tail call)?
     =[C] in function 'xpcall'
     scripts/mods/lua(144,1) in function 'mod'
     scripts/mainfunctions.lua(155,1)
Does anyone know how to fix it?

modmain.lua

crestonia.lua

Edited by Crestonia
Link to comment
https://forums.kleientertainment.com/forums/topic/55756-mod-issues/
Share on other sites

@Crestonia, you're not checking to see if the code is running on client or the server. Components are not ran on clients.

if not TheWorld.ismastersim then    return instend
AddPrefabPostInit("tallbird", function(inst)    local old_sfn = inst.components.combat.SuggestTarget    inst.components.combat.SuggestTarget = function(self, target)        if target and target:HasTag("tallbird") then            if target.components.combat.target ~= self.inst then                return            end        end        return old_sfn(self, target)    endend)
Edited by Kzisor

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