How to force new task for NPC squad ?

Posts: 10
Joined: 11 Oct 2015, 12:41

How to force new task for NPC squad ?

Postby kcs123 » 07 Mar 2017, 17:09

Trough longer game play session task manager fail to assign smart terrain as target for some squads. I don't know true reason behind this, I suspect that almost all S_T is occupied or something, so x_ray can't give them any target.

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

Return to “General Discussion”

Who is online

Users browsing this forum: No registered users and 1 guest