Code: [12:44:01.939] [Error] Exception while invoking lua function 'update'. (LuaException) Error code 2, [string "/monsters/boss/dollboss/scripts/behavior.lua"]:165: attempt to get length of a nil value (field 'targets') stack traceback: [C]: in metamethod '__len' [string "/monsters/boss/dollboss/scripts/behavior.lua"]:165: in global 'trackTargets' [string "/monsters/boss/dollboss/scripts/behavior.lua"]:97: in function <[string "/monsters/boss/dollboss/scripts/behavior.lua"]:83> [0] 13f9a7153 Star::captureStack [1] 13f9a5ede Star::StarException::StarException [2] 13f97a4c1 Star::LuaEngine::handleError [3] 13fb69517 Star::LuaEngine::callFunction<float> [4] 13fb6cca5 Star::LuaFunction::invoke<Star::Variant<Star::Empty,bool,__int64,double,Star::String,Star::LuaTable,Star::LuaFunction,Star::LuaThread,Star::LuaUserData>,float> [5] 13fb6cbc0 Star::LuaBaseComponent::invoke<Star::Variant<Star::Empty,bool,__int64,double,Star::String,Star::LuaTable,Star::LuaFunction,Star::LuaThread,Star::LuaUserData>,float> [6] 13fb7394c Star::LuaUpdatableComponent<Star::LuaWorldComponent<Star::LuaBaseComponent> >::update<Star::Variant<Star::Empty,bool,__int64,double,Star::String,Star::LuaTable,Star::LuaFunction,Star::LuaThread,Star::LuaUserData>,float> [7] 13fb738bc Star::LuaActorMovementComponent<Star::LuaUpdatableComponent<Star::LuaWorldComponent<Star::LuaBaseComponent> > >::update<Star::Variant<Star::Empty,bool,__int64,double,Star::String,Star::LuaTable,Star::LuaFunction,Star::LuaThread,Star::LuaUserData>,float> [8] 13fba98ea Star::Monster::update [9] 13ff4b31e <lambda_5251ea3b435705ab973fc9e3a86aa323>::operator() [10] 13fafa5d7 Star::EntityMap::updateAllEntities [11] 13ff6e824 Star::WorldServer::update [12] 13ff74b66 Star::WorldServerThread::update [13] 13ff74558 Star::WorldServerThread::run [14] 13f9a3c5e Star::ThreadImpl::runThread [15] 76ff652d BaseThreadInitThunk [16] 7722c541 RtlUserThreadStart It appears self.targets is returning nil, and it shouldn't be. Scripts attached here. https://www.dropbox.com/s/qo49f8i27z1tz94/dollboss.zip?dl=0
That's quite odd considering you are defining self.targets in init. Nothing in THAT script (as far as I see) should make self.targets = nil, so I'm thinking maybe to do with a state machine etc? I'd think something somewhere is re-defining self. Try swapping all instances of self.targets for storage.targets etc to move it off the self table.