simpliCaty Posted November 13, 2017 Share Posted November 13, 2017 Hi, So since the update I've been getting a series of crashes with the Wilburn character mod. I'm not sure if it's because of the update or if it would have happened before as well, but I didn't get the error before then. The host of the server doesn't crash (whether they or another person are playing Wilburn), but those connecting do. People can reconnect and play for a while before crashing again, and we're not sure why. Any help would be greatly appreciated! [string "../mods/Wilburn/scripts/brains/new_pigbrain..."]:252: attempt to index field 'health' (a nil value) LUA ERROR stack traceback: ../mods/Wilburd/scripts/brains/new_pigbrain.lua:252 in (field) fn (Lua) <252-252> scripts/behaviourtree.lua:200 in (method) Visit (Lua) <199-205> scripts/behaviourtree.lua:643 in (method) Visit (Lua) <633-664> scripts/behaviourtree.lua:578 in (method) Visit (Lua) <554-610> scripts/behaviourtree.lua:22 in (method) Update (Lua) <20-27> scripts/behaviourtree.lua:212 in (method) OnUpdate (Lua) <205-214> scripts/behaviourtree.lua:135 in (method) Update (Lua) <105-147> scripts/update.lua:222 in () ? (Lua) <149-228> This is the client log from the crash: Spoiler [00:01:18]: [string "../mods/Wilburn/scripts/brains/new_pigbrain..."]:252: attempt to index field 'health' (a nil value) LUA ERROR stack traceback: ../mods/Wilburn/scripts/brains/new_pigbrain.lua:252 in (field) fn (Lua) <252-252> scripts/behaviourtree.lua:200 in (method) Visit (Lua) <199-205> self = lastresult = READY status = READY fn = function - ../mods/Wilburn/scripts/brains/new_pigbrain.lua:252 parent = table: 34B77FB8 name = OnFire scripts/behaviourtree.lua:643 in (method) Visit (Lua) <633-664> self = name = Parallel status = READY parent = table: 57C2CB70 children = table: 34B780A8 lastresult = READY done = true any_done = false idx = 1 child = table: 34B77D10 scripts/behaviourtree.lua:578 in (method) Visit (Lua) <554-610> self = lasttime = 44.266668975353 name = Priority status = READY period = 0.5 children = table: 34B759E8 lastresult = READY time = 44.266668975353 do_eval = true oldidx = nil old_event = nil found = false idx = 2 child = table: 34B77FB8 should_test_anyway = nil scripts/behaviourtree.lua:22 in (method) Update (Lua) <20-27> self = inst = 104590 - pigman (valid:true) root = table: 57C2CB70 scripts/brain.lua:212 in (method) OnUpdate (Lua) <205-214> self = bt = Priority - READY <READY> ()>0.00 >Parallel - FAILED <READY> ()>0.00 > >PanicHaunted - FAILED <READY> ()>0.00 > >ChattyNode - READY <READY> ()>0.00 > > >Panic - READY <READY> ()>0.00 >Parallel - READY <READY> ()>0.00 > >OnFire - READY <READY> ()>0.00 > >ChattyNode - READY <READY> ()>0.00 > > >Panic - READY <READY> ()>0.00 >ChattyNode - READY <READY> ()>0.00 > >Parallel - READY <READY> ()>0.00 > > >AttackMomentarily - READY <READY> ()>0.00 > > >ChaseAndAttack - READY <READY> ()>0.00 >ChattyNode - READY <READY> ()>0.00 > >Parallel - READY <READY> ()>0.00 > > >Leader Phlegmed - READY <READY> ()>0.00 > > >Rescue Leader - READY <READY> ()>0.00 >ChattyNode - READY <READY> ()>0.00 > >Parallel - READY <READY> ()>0.00 > > >Dodge - READY <READY> ()>0.00 > > >RunAway - READY <READY> ()>0.00 >RunAway - READY <READY> ()>0.00 >ChattyNode - READY <READY> ()>0.00 > >FaceEntity - READY <READY> ()>0.00 >Parall [**truncated**] events = table: 4E07EF00 behaviourqueue = table: 4E07F040 stopped = false inst = 104590 - pigman (valid:true) scripts/brain.lua:135 in (method) Update (Lua) <105-147> self = hibernaters = table: 2BA9E8A8 updaters = table: 2BA9E858 tickwaiters = table: 2BA9E3A8 instances = table: 2BA9E330 current_tick = 1328 waiters = nil k = --brain-- sleep time: 0.00 Priority - READY <READY> ()>0.00 >Parallel - FAILED <READY> ()>0.00 > >PanicHaunted - FAILED <READY> ()>0.00 > >ChattyNode - READY <READY> ()>0.00 > > >Panic - READY <READY> ()>0.00 >Parallel - READY <READY> ()>0.00 > >OnFire - READY <READY> ()>0.00 > >ChattyNode - READY <READY> ()>0.00 > > >Panic - READY <READY> ()>0.00 >ChattyNode - READY <READY> ()>0.00 > >Parallel - READY <READY> ()>0.00 > > >AttackMomentarily - READY <READY> ()>0.00 > > >ChaseAndAttack - READY <READY> ()>0.00 >ChattyNode - READY <READY> ()>0.00 > >Parallel - READY <READY> ()>0.00 > > >Leader Phlegmed - READY <READY> ()>0.00 > > >Rescue Leader - READY <READY> ()>0.00 >ChattyNode - READY <READY> ()>0.00 > >Parallel - READY <READY> ()>0.00 > > >Dodge - READY <READY> ()>0.00 > > >RunAway - READY <READY> ()>0.00 >RunAway - READY <READY> ()>0.00 >ChattyNode - READY <READY> ()>0.00 > >FaceEntity - READY [**truncated**] v = true scripts/update.lua:222 in () ? (Lua) <149-228> dt = 0.033333335071802 tick = 1328 i = 1328 [00:01:18]: [string "../mods/Wilburn/scripts/brains/new_pigbrain..."]:252: attempt to index field 'health' (a nil value) LUA ERROR stack traceback: ../mods/Wilburn/scripts/brains/new_pigbrain.lua:252 in (field) fn (Lua) <252-252> scripts/behaviourtree.lua:200 in (method) Visit (Lua) <199-205> scripts/behaviourtree.lua:643 in (method) Visit (Lua) <633-664> scripts/behaviourtree.lua:578 in (method) Visit (Lua) <554-610> scripts/behaviourtree.lua:22 in (method) Update (Lua) <20-27> scripts/brain.lua:212 in (method) OnUpdate (Lua) <205-214> scripts/brain.lua:135 in (method) Update (Lua) <105-147> scripts/update.lua:222 in () ? (Lua) <149-228> [00:01:22]: [CRITICAL] Failed to save file: APP:Klei//DoNotStarveTogether/client_save/session/49BC44DAC1526BC1/KU_G5lYza0M_/knownfoods_data [00:01:22]: [CRITICAL] Fingerprint:hbrjimvnqldgdfflhhoqabgirgnnokeiggjlnhijherjphvnojdgkfflmkoqkbgiqfnnikeihdjlniijkdrjoivnpjdgniflpkoqjbgiofnnujeijhjltmijabrjfhvnsmdgneflmhoqgegipgnnmjeimejlkhijbdrjogvntkdgfeflnioqbcgilfnnijeimejltmijhdrjghvnvkdgdeflsioqbcgieinnokeildjlkhijbdrjflvnpjdgdeflhhoqgcgikfnnsjeiidjltmijairjlmvnomdgjgflmloqbggiphnnmleinfjljlijbirjqmvnkndgigflhkoqeggiejnnwleipgjltjijdbrjpmvnqkdgpfflohoqebgitknnqleijgjltmijpdrjehvntkdgfdflsioqdbgiefnnsjeiodjlhhijlcrjohvnnkdgcdfljioq. [00:01:22]: Serializing user: session/49BC44DAC1526BC1/A7I0BFHFCG0M/0000000001 [00:01:31]: [Physics] Error deserializing restitution for entity beefalo[104615] [00:02:12]: Connection lost to 38.189.253.80|1 <8238014979581524724> [00:02:12]: [Connect] PendingConnection::Reset(true) [00:02:12]: PushNetworkDisconnectEvent With Reason: "ID_CONNECTION_LOST", reset: true [00:02:12]: [CRITICAL] Failed to save file: APP:Klei//DoNotStarveTogether/client_save/session/49BC44DAC1526BC1/KU_G5lYza0M_/knownfoods_data [00:02:12]: [CRITICAL] Fingerprint:hbrjimvnqldgdfflhhoqabgirgnnokeiggjlnhijherjphvnojdgkfflmkoqkbgiqfnnikeihdjlniijkdrjoivnpjdgniflpkoqjbgiofnnujeijhjltmijabrjfhvnsmdgneflmhoqgegipgnnmjeimejlkhijbdrjogvntkdgfeflnioqbcgilfnnijeimejltmijhdrjghvnvkdgdeflsioqbcgieinnokeildjlkhijbdrjflvnpjdgdeflhhoqgcgikfnnsjeiidjltmijairjlmvnomdgjgflmloqbggiphnnmleinfjljlijbirjqmvnkndgigflhkoqeggiejnnwleipgjltjijdbrjpmvnqkdgpfflohoqebgitknnqleijgjltmijpdrjehvntkdgfdflsioqdbgiefnnsjeiodjlhhijlcrjohvnnkdgcdfljioq. [00:02:12]: Serializing user: session/49BC44DAC1526BC1/A7I0BFHFCG0M/0000000001 [00:02:12]: [Shard] Stopping shard mode [00:02:12]: ModWorkshop::CancelDownloads clearing all unfinished downloads [00:02:27]: Force aborting... [00:02:27]: unloading prefabs for mod MOD_workshop-396026892 [00:02:27]: unloading prefabs for mod MOD_workshop-365119238 [00:02:27]: unloading prefabs for mod MOD_workshop-375850593 [00:02:27]: unloading prefabs for mod MOD_workshop-347079953 [00:02:27]: unloading prefabs for mod MOD_workshop-1126368500 [00:02:27]: unloading prefabs for mod MOD_workshop-356435289 [00:02:27]: unloading prefabs for mod MOD_workshop-370373189 [00:02:27]: unloading prefabs for mod MOD_workshop-385006082 [00:02:27]: unloading prefabs for mod MOD_workshop-375859599 [00:02:27]: unloading prefabs for mod MOD_workshop-821143467 [00:02:27]: unloading prefabs for mod MOD_Wilburn [00:02:27]: unloading prefabs for mod MOD_workshop-714735102 [00:02:27]: unloading prefabs for mod MOD_workshop-357875628 [00:02:27]: unloading prefabs for mod MOD_workshop-362906105 [00:02:27]: unloading prefabs for mod MOD_workshop-398570591 [00:02:27]: unloading prefabs for mod MOD_workshop-699175387 [00:02:27]: unloading prefabs for mod MOD_workshop-345692228 [00:02:27]: unloading prefabs for mod MOD_workshop-787954095 [00:02:27]: unloading prefabs for mod MOD_workshop-661284815 [00:02:27]: unloading prefabs for mod MOD_workshop-458587300 [00:02:27]: unloading prefabs for mod MOD_workshop-376333686 [00:02:27]: unloading prefabs for mod MOD_workshop-623749604 [00:02:27]: unloading prefabs for mod MOD_workshop-387716835 [00:02:27]: unloading prefabs for mod MOD_workshop-409833317 [00:02:27]: unloading prefabs for mod MOD_workshop-351325790 [00:02:27]: unloading prefabs for mod MOD_workshop-378160973 [00:02:27]: unloading prefabs for mod MOD_workshop-727774324 [00:02:27]: ModWorkshop::CancelDownloads clearing all unfinished downloads [00:02:27]: Collecting garbage... [00:02:27]: lua_gc took 0.04 seconds [00:02:27]: ~ShardLuaProxy() [00:02:27]: ~ItemServerLuaProxy() [00:02:27]: ~InventoryLuaProxy() [00:02:27]: ~NetworkLuaProxy() [00:02:27]: ~SimLuaProxy() [00:02:27]: ModWorkshop::CancelDownloads clearing all unfinished downloads [00:02:27]: lua_close took 0.07 seconds [00:02:28]: ModWorkshop::CancelDownloads clearing all unfinished downloads [00:02:28]: [Steam] Auth ticket cancelled [00:02:28]: Manager - ORPHANED UNKNOWN RESOURCES: [00:02:28]: shaders/ui_yuv.ksh - 1 [00:02:28]: Orphaned unnamed resource. This resource must have used Add( resource ) to insert itself into the manager. [00:02:28]: CurlRequestManager::ClientThread::Main() complete [00:02:28]: HttpClient2 discarded 0 callbacks. [00:02:28]: Shutting down And this is the pigbrain code that is probably causing the issue somewhere: Spoiler require "behaviours/wander" require "behaviours/follow" require "behaviours/faceentity" require "behaviours/chaseandattack" require "behaviours/runaway" require "behaviours/doaction" require "behaviours/findlight" require "behaviours/panic" require "behaviours/chattynode" require "behaviours/leash" local MIN_FOLLOW_DIST = 2 local TARGET_FOLLOW_DIST = 5 local MAX_FOLLOW_DIST = 9 local MAX_WANDER_DIST = 20 local LEASH_RETURN_DIST = 10 local LEASH_MAX_DIST = 30 local START_RUN_DIST = 3 local STOP_RUN_DIST = 5 local MAX_CHASE_TIME = 10 local MAX_CHASE_DIST = 30 local SEE_LIGHT_DIST = 20 local TRADE_DIST = 20 local SEE_TREE_DIST = 15 local SEE_TARGET_DIST = 20 local SEE_FOOD_DIST = 10 local KEEP_CHOPPING_DIST = 10 local RUN_AWAY_DIST = 5 local STOP_RUN_AWAY_DIST = 8 local function SafeLightDist(inst, target) return (target:HasTag("player") or target:HasTag("playerlight") or (target.inventoryitem and target.inventoryitem:GetGrandOwner() and target.inventoryitem:GetGrandOwner():HasTag("player"))) and 4 or target.Light:GetCalculatedRadius() / 3 end local function ShouldRunAway(inst, target) return not inst.components.trader:IsTryingToTradeWithMe(target) end local function GetTraderFn(inst) local x, y, z = inst.Transform:GetWorldPosition() local players = FindPlayersInRange(x, y, z, TRADE_DIST, true) for i, v in ipairs(players) do if inst.components.trader:IsTryingToTradeWithMe(v) then return v end end end local function KeepTraderFn(inst, target) return inst.components.trader:IsTryingToTradeWithMe(target) end local function FindFoodAction(inst) local target = nil if inst.sg:HasStateTag("busy") then return end if inst.components.inventory and inst.components.eater then target = inst.components.inventory:FindItem(function(item) return inst.components.eater:CanEat(item) end) end local time_since_eat = inst.components.eater:TimeSinceLastEating() local noveggie = time_since_eat and time_since_eat < TUNING.PIG_MIN_POOP_PERIOD*4 if not target and (not time_since_eat or time_since_eat > TUNING.PIG_MIN_POOP_PERIOD*2) then target = FindEntity(inst, SEE_FOOD_DIST, function(item) if item:GetTimeAlive() < 8 then return false end if item.prefab == "mandrake" then return false end if noveggie and item.components.edible and item.components.edible.foodtype ~= FOODTYPE.MEAT then return false end if not item:IsOnValidGround() then return false end return inst.components.eater:CanEat(item) end) end if target then return BufferedAction(inst, target, ACTIONS.EAT) end if not target and (not time_since_eat or time_since_eat > TUNING.PIG_MIN_POOP_PERIOD*2) then target = FindEntity(inst, SEE_FOOD_DIST, function(item) if not item.components.shelf then return false end if not item.components.shelf.itemonshelf or not item.components.shelf.cantakeitem then return false end if noveggie and item.components.shelf.itemonshelf.components.edible and item.components.shelf.itemonshelf.components.edible.foodtype ~= FOODTYPE.MEAT then return false end if not item:IsOnValidGround() then return false end return inst.components.eater:CanEat(item.components.shelf.itemonshelf) end) end if target then return BufferedAction(inst, target, ACTIONS.TAKEITEM) end end local function KeepChoppingAction(inst) return inst.components.follower.leader and inst.components.follower.leader:GetDistanceSqToInst(inst) <= KEEP_CHOPPING_DIST*KEEP_CHOPPING_DIST end local function StartChoppingCondition(inst) return inst.components.follower.leader and inst.components.follower.leader.sg and inst.components.follower.leader.sg:HasStateTag("chopping") end local function FindTreeToChopAction(inst) local target = FindEntity(inst, SEE_TREE_DIST, function(item) return item.components.workable and item.components.workable.action == ACTIONS.CHOP end) if target then return BufferedAction(inst, target, ACTIONS.CHOP) end end local function HasValidHome(inst) return inst.components.homeseeker and inst.components.homeseeker.home and inst.components.homeseeker.home:IsValid() end local function GoHomeAction(inst) if not inst.components.follower.leader and HasValidHome(inst) and not inst.components.combat.target then return BufferedAction(inst, inst.components.homeseeker.home, ACTIONS.GOHOME) end end local function GetLeader(inst) return inst.components.follower.leader end local function GetHomePos(inst) return HasValidHome(inst) and inst.components.homeseeker:GetHomePos() end local function GetNoLeaderHomePos(inst) if GetLeader(inst) then return nil end return GetHomePos(inst) end local function RescueLeaderAction(inst) return BufferedAction(inst, GetLeader(inst), ACTIONS.UNPIN) end local function GetFaceTargetFn(inst) return inst.components.follower.leader end local function KeepFaceTargetFn(inst, target) return inst.components.follower.leader == target end local PigBrain = Class(Brain, function(self, inst) Brain._ctor(self, inst) end) -- Tests if 'Guy' has the Authority Symbol in hand. local function GuyHasWilburnScepter(guy) if guy then return guy.components.inventory and guy.components.inventory:GetEquippedItem(EQUIPSLOTS.HANDS) and guy.components.inventory:GetEquippedItem(EQUIPSLOTS.HANDS).prefab == "wilburnscepter" else return false end end -- Supposed to prevent pigs from attacking your target. It doesn't work so I'm not using it. -- (HELP NEEDED !!!) local function NoFight(inst) if inst and inst.components.combat then inst.components.combat.target = nil if inst.components.combat.retargettask ~= nil then inst.components.combat.retargettask:Cancel() inst.components.combat.retargettask = nil end else return end end function PigBrain:OnStart() --print(self.inst, "PigBrain:OnStart") local day = WhileNode( function() return TheWorld.state.isday end, "IsDay", PriorityNode{ ChattyNode(self.inst, STRINGS.PIG_TALK_FIND_MEAT, DoAction(self.inst, FindFoodAction )), IfNode(function() return StartChoppingCondition(self.inst) end, "chop", WhileNode(function() return KeepChoppingAction(self.inst) end, "keep chopping", LoopNode{ ChattyNode(self.inst, STRINGS.PIG_TALK_HELP_CHOP_WOOD, DoAction(self.inst, FindTreeToChopAction ))})), ChattyNode(self.inst, STRINGS.PIG_TALK_FOLLOWWILSON, Follow(self.inst, GetLeader, MIN_FOLLOW_DIST, TARGET_FOLLOW_DIST, MAX_FOLLOW_DIST)), IfNode(function() return GetLeader(self.inst) end, "has leader", ChattyNode(self.inst, STRINGS.PIG_TALK_FOLLOWWILSON, FaceEntity(self.inst, GetFaceTargetFn, KeepFaceTargetFn ))), Leash(self.inst, GetNoLeaderHomePos, LEASH_MAX_DIST, LEASH_RETURN_DIST), -- Added a condition to the RunAway node. It prevents pigs from running away if the player --has the Authority Symbol in hand. Note that creatures following you will still back off. ChattyNode(self.inst, STRINGS.PIG_TALK_RUNAWAY_WILSON, RunAway(self.inst, "player", START_RUN_DIST, STOP_RUN_DIST, function(guy) return not GuyHasWilburnScepter(guy) end)), ChattyNode(self.inst, STRINGS.PIG_TALK_LOOKATWILSON, FaceEntity(self.inst, GetFaceTargetFn, KeepFaceTargetFn)), Wander(self.inst, GetNoLeaderHomePos, MAX_WANDER_DIST) },.5) local night = WhileNode( function() return not TheWorld.state.isday end, "IsNight", PriorityNode{ ChattyNode(self.inst, STRINGS.PIG_TALK_RUN_FROM_SPIDER, RunAway(self.inst, "spider", 4, 8)), ChattyNode(self.inst, STRINGS.PIG_TALK_FIND_MEAT, DoAction(self.inst, FindFoodAction )), RunAway(self.inst, "player", START_RUN_DIST, STOP_RUN_DIST, function(target) return ShouldRunAway(self.inst, target) end ), -- added the IfNode for the bell that calls pigmen out of their homes. -- this prevents them from going back home instantly after they get out. IfNode(function() return self.inst.cangobackhome end, "allowed to go home", ChattyNode(self.inst, STRINGS.PIG_TALK_GO_HOME, DoAction(self.inst, GoHomeAction, "go home", true ))), ChattyNode(self.inst, STRINGS.PIG_TALK_FIND_LIGHT, FindLight(self.inst, SEE_LIGHT_DIST, SafeLightDist)), ChattyNode(self.inst, STRINGS.PIG_TALK_PANIC, Panic(self.inst)), },1) local root = PriorityNode( { WhileNode( function() return self.inst.components.hauntable and self.inst.components.hauntable.panic end, "PanicHaunted", ChattyNode(self.inst, STRINGS.PIG_TALK_PANICHAUNT, Panic(self.inst))), WhileNode(function() return self.inst.components.health.takingfiredamage end, "OnFire", ChattyNode(self.inst, STRINGS.PIG_TALK_PANICFIRE, Panic(self.inst))), ChattyNode(self.inst, STRINGS.PIG_TALK_FIGHT, WhileNode( function() return self.inst.components.combat.target == nil or not self.inst.components.combat:InCooldown() end, "AttackMomentarily", ChaseAndAttack(self.inst, MAX_CHASE_TIME, MAX_CHASE_DIST) )), ChattyNode(self.inst, STRINGS.PIG_TALK_RESCUE, WhileNode( function() return GetLeader(self.inst) and GetLeader(self.inst).components.pinnable and GetLeader(self.inst).components.pinnable:IsStuck() end, "Leader Phlegmed", DoAction(self.inst, RescueLeaderAction, "Rescue Leader", true) )), ChattyNode(self.inst, STRINGS.PIG_TALK_FIGHT, WhileNode( function() return self.inst.components.combat.target and self.inst.components.combat:InCooldown() end, "Dodge", RunAway(self.inst, function() return self.inst.components.combat.target end, RUN_AWAY_DIST, STOP_RUN_AWAY_DIST) )), RunAway(self.inst, function(guy) return guy:HasTag("pig") and guy.components.combat and guy.components.combat.target == self.inst end, RUN_AWAY_DIST, STOP_RUN_AWAY_DIST ), ChattyNode(self.inst, STRINGS.PIG_TALK_ATTEMPT_TRADE, FaceEntity(self.inst, GetTraderFn, KeepTraderFn)), day, night }, .5) self.bt = BT(self.inst, root) end return PigBrain Thanks! Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now