Anyhow, if player try to chat with leader of such squad and ask them where they going, it will produce CTD with this error:
[error]Expression : !m_error_code
[error]Function : raii_guard::~raii_guard
[error]File : D:\prog_repository\sources\trunk\xrServerEntities\script_storage.cpp
[error]Line : 748
[error]Description : ...f pripyat\gamedata\scripts\simulation_objects.script:73: attempt to index local 'obj1' (a nil value)
I have changed relevant lines in simulation_objects.script so it no longer cause CTD and seems that there is no other big issues too. New function looks like this:
Code: Select all
function sim_dist_to(obj1 , obj2)
-- preventing CTD if some of argument is nil. Can happen sometimes in rare situations
if obj1 == nil or obj2 == nil then
local pos1,lv1,gv1 = obj1:get_location()
local pos2,lv2,gv2 = obj2:get_location()
return utils.graph_distance(gv1, gv2)
Anyhow, is there a way to force squad target, trough new function execution or something?
If it can be done, than instead of returning zero as distance, I would like to reassign their task. Or call that new command after loading game or some other more suitable spot in scripts.
Not a big deal, as CTDs were prevented, but I would like to improve this if it is possible. Thanks.