Code: Select all
local obj = alife():object(target) --target is an id
local relation = obj:relation(db.actor)
This code crashes with the following error:
FATAL ERROR
[error]Expression : <no expression>
[error]Function : CScriptEngine::lua_pcall_failed
[error]File : ..\xrServerEntities\script_engine.cpp
[error]Line : 204
[error]Description : fatal error
[error]Arguments : LUA error: ...ll of pripyat_coc15\gamedata\scripts\task_objects.script:497: attempt to call method 'relation' (a nil value)
stack trace:
0023:0056269C xrCore.dll, xrDebug::fatal()
0023:6E8D266D lua51.dll
Strangely, methods, like object:alive() are working, as expected, BUT method object:id() fails. Instead, if I use object.id, it does not crash.
What could be the problem?
I saw calling npc:relation(db.actor) a lot.
The object I received with alife():object() is not the correct "class"? How could I receive the correct "object", to be able to call relation() ?