Any idea why my respawns don't work? :'(

Discussions on Modding of S.T.A.L.K.E.R. SoC & Clear Sky

Any idea why my respawns don't work? :'(

Postby ket on 29 Sep 2012 00:58

Title says it all guys. I know nothing is wrong with my code... the respawns just don't seem to work :( These spawns are the last aspect of TK before I can finally give it the fabled "final build" tag so I really need to get the issue ironed out. Ok, I'll go through everything in hopes somebody will see what I'm missing. All work is being done with the all.spawn unless somebody can provide a script I can use. Apologies for the mammoth wall of incoming details :rolleyes:

My one off spawns look like this;
[935]
; cse_abstract properties
section_name = controller_tubeman
name = esc_controller_01
position = -166.770004272461,-18.3899993896484,-128.830001831055
direction = 0,0,0

; cse_alife_object properties
game_vertex_id = 115
distance = 15
level_vertex_id = 420394
object_flags = 0xffffffbf
custom_data = <<END
[smart_terrains]
esc_small_home3 = false
END

; cse_visual properties
visual_name = monsters\kontroler\kontroler

; cse_alife_creature_abstract properties
g_team = 0
g_squad = 1
g_group = 22
health = 1
dynamic_out_restrictions =
dynamic_in_restrictions =

upd:health = 1
upd:timestamp = 0
upd:creature_flags = 0
upd:position = -166.770004272461,-18.3899993896484,-128.830001831055
upd:o_model = 0
upd:o_torso = 0,0,0
upd:g_team = 0
upd:g_squad = 1
upd:g_group = 22

; cse_alife_monster_abstract properties

upd:next_game_vertex_id = 65535
upd:prev_game_vertex_id = 65535
upd:distance_from_point = 0
upd:distance_to_point = 0

; cse_ph_skeleton properties

; cse_alife_monster_base properties

; se_monster properties


These types of spawns all work fine.

My respawns;
[940]
; cse_abstract properties
section_name = respawn
name = esc_cat_01
position = -166.399993896484,-2.61999988555908,-77.0599975585938
direction = 0,0,0

; cse_alife_object properties
game_vertex_id = 115
distance = 4.90000009536743
level_vertex_id = 420394
object_flags = 0xffffff3e
custom_data = <<END
[respawn]
respawn_section = cat_weak
;max_count = 8
;min_count = 3
max_spawn = 8
idle_spawn = often
conditions = 100
END

; cse_shape properties
shapes = shape0
shape0:type = sphere
shape0:offset = 0,0,0
shape0:radius = 1

; cse_alife_space_restrictor properties
restrictor_type = 0

; se_respawn properties


For some reason, these types of spawns don't work at all :'( Strange thing is, I use that exact code in the all.spawn for respawning NPCs and it works fine.

This is what my modded general_lair.ltx looks like;
[l01_escape]
chimera = weak
cat = weak
boar = weak, normal, strong
bloodsucker = weak, normal, strong
burer = weak
controller = weak, normal, strong
dog = weak, normal, strong
flesh = weak, normal, strong
giant = weak, normal, strong
poltergeist = weak, normal, strong
pseudodog = weak, normal, strong
pseudo_gigant = normal, strong
snork = weak, normal, strong
tushkano = normal
zombie = normal, strong


Repeat that list of mutants for all levels.

This is what my respawn.ltx looks like;
[respawn]
GroupControlSection =
$spawn = "ai\respawn"
class = RE_SPAWN
script_binding = bind_respawn.bind


AFAIK nothing stopping my mutant respawns here.

This is what my smart_terrain_presets.ltx looks like;
chimera = weak
cat = weak
boar = weak, normal, strong
bloodsucker = weak, normal, strong
burer = weak
controller = weak, normal, strong
dog = weak, normal, strong
flesh = weak, normal, strong
giant = weak, normal, strong
poltergeist = weak, normal, strong
pseudodog = weak, normal, strong
pseudo_gigant = normal, strong
snork = weak, normal, strong
tushkano = normal
zombie = normal, strong


Repeat that list for all levels.

This is what monsters.ltx looks like;
#include "M_flesh.ltx"
#include "M_chimera.ltx"
#include "M_bloodsucker.ltx"
#include "M_dog.ltx"
#include "M_boar.ltx"
#include "M_pseudodog.ltx"
#include "M_burer.ltx"
#include "M_giant.ltx"
#include "M_controller.ltx"
#include "m_poltergeist.ltx"
#include "m_zombie.ltx"
#include "m_fracture.ltx"
#include "m_snork.ltx"
#include "m_cat.ltx"
#include "M_Rat.ltx"
#include "m_crow.ltx"
#include "m_tushkano.ltx"
#include "m_phantom.ltx"


AFAIK nothing wrong here.

se_monster.script;
--[[
Èçìåíåíèÿ script_version:
4 - ñîõðàíåíèå ïîëÿ job_online
5 - ñîõðàíåíèå ïîëÿ was_in_smart_terrain
]]

class "se_monster" (cse_alife_monster_base)
--------------------
function se_monster:__init (section) super (section)
self.ini = nil
self.ini_initialized = false

self.spawner_present = false

self.smart_terrain_conditions = nil
self.smart_terrain_conditions_initialized = false

self.check_distance = false
self.min_distance = 150

-- ýòîò ôëàã áåð¸òñÿ èç ðàáîòû ñìàðòà
-- true = âñåãäà â îíëàéíå
-- false = âñåãäà â îôëàéíå
-- condlist = óñëîâèå, êîòîðîå îòïðåäåëÿåò true èëè false
-- nil = ñìàðòó âñ¸ ðàâíî
self.job_online = nil
self.job_online_condlist = nil

-- ïîñåùàë ëè ñòàëêåð õîòü îäèí smart_terrain
self.was_in_smart_terrain = false
end
--------------------
function se_monster:get_ini()
if not self.ini_initialized then
self.ini = self:spawn_ini ()
self.ini_initialized = true

self.spawner_present = self.ini:section_exist ("spawner")

if self.ini ~= nil and self.spawner_present == true then
if self.ini:line_exist ("spawner", "check_distance") == true then
self.check_distance = self.ini:r_bool ("spawner", "check_distance")
if self.check_distance == nil then self.check_distance = false end
if self.ini:line_exist ("spawner", "min_distance") == true then
self.min_distance = self.ini:r_u32 ("spawner", "min_distance")
end
end

if self.min_distance == nil then
local sys = system_ini()
if sys ~= nil and sys:line_exist ("alife", "switch_distance") == true then
self.min_distance = sys:r_u32 ("alife", "switch_distance") - 50
if self.min_distance == nil then
self.min_distance = 150
else
if self.min_distance <= 50 then
abort ("SE_MONSTER - SWITCH DISTANCE IS TOO SMALL !!!")
end
end
else
self.min_distance = 150
end
end
end
end
end
--------------------
function se_monster:get_job_online()
if self.job_online_condlist == nil then
return self.job_online
else
return xr_logic.pick_section_from_condlist(db.actor_proxy, self, self.job_online) ~= nil
end
end
--------------------
function se_monster:can_switch_offline ()
if self:get_job_online() ~= nil then
return not self:get_job_online()
else
return cse_alife_monster_base.can_switch_offline (self)
end
end
--------------------
function se_monster:can_switch_online ()
if self:get_job_online() ~= nil then
return self:get_job_online()
end

--' self:get_ini()

--ñòàíäàðòíàÿ ïðîâåðêà ó ðîäèòåëÿ, åñëè íåò ñïàâíåðà èëè èãðîê ïîìåð
if self.ini == nil or self.spawner_present == false then --or (db.actor ~= nil and db.actor:alive () == false)
--if self.ini == nil or self.spawner_present == false or db.actor == nil
return cse_alife_monster_base.can_switch_online (self)
end

if self.online == false then
-- åñëè èãðîêà íåò, òî â îôôëàéí
if db.actor == nil or db.actor:alive () == false then return false end

--åñëè çàäàíà äèñòàíöèÿ ïðîâåðêè, òî ïðîâåðèì.
if self.check_distance == true then
--printf ("Check distance")
--ïîëó÷èì ïîçèöèþ.
local pos = level.vertex_position (self.m_level_vertex_id)
-- ïðîâåðèì äèñòàíöèþ äî èãðîêà. åñëè ìåíüøå òðåáóåìîé, òî îò âèíòà
if pos:distance_to (db.actor:position ()) < self.min_distance then
--printf ("Check distance 1")
return false
end
end
--âñå ïðîâåðêè ïðîøëè - ôèíàë, âûçîâ ñïàâíåðà
return xr_spawner.check_spawn (self) and cse_alife_monster_base.can_switch_online (self)
else
if db.actor == nil or db.actor:alive () == false then return true end
if xr_spawner.check_spawn (self) == true then
return true
end
if self.check_distance == true then
local pos = level.vertex_position (self.m_level_vertex_id)
-- ïðîâåðèì äèñòàíöèþ äî èãðîêà. åñëè áîëüøå òðåáóåìîé, òî îò âèíòà
if pos:distance_to (db.actor:position ()) > self.min_distance then
return false
end
end
return cse_alife_monster_base.can_switch_online (self)
end
end
--------------------
function se_monster:STATE_Write(packet)
cse_alife_monster_base.STATE_Write (self, packet)

if self.job_online == true then
packet:w_u8(0)
elseif self.job_online == false then
packet:w_u8(1)
elseif self.job_online == nil then
packet:w_u8(2)
else
packet:w_u8(3)
packet:w_stringZ(self.job_online_condlist)
end

packet:w_bool(self.was_in_smart_terrain)
end
--------------------
function se_monster:STATE_Read(packet, size)
cse_alife_monster_base.STATE_Read (self, packet, size)

if self.script_version >= 4 then
local t = packet:r_u8()

if t == 0 then
self.job_online = true
elseif t == 1 then
self.job_online = false
elseif t == 2 then
self.job_online = nil
else
self.job_online_condlist = packet:r_stringZ()

self.job_online = xr_logic.parse_condlist(nil, "se_monster:STATE_Read", "job_online", self.job_online_condlist)
end
end

if self.script_version >= 5 then
self.was_in_smart_terrain = packet:r_bool()
end
end
--------------------
function se_monster:on_before_register()
self:fill_exclusives()
end
--------------------
function se_monster:on_register()
cse_alife_monster_base.on_register( self )

--'self:fill_exclusives()

--' Âûòàëêèâàåì ìóòàíòîâ èç ìåñò, ãäå èõ íå äîëæíî áûòü.
--' Íóæíî òîëüêî äëÿ èãðû ñ ñîõðàíåíèÿ.
if self:alive() then
local sim = alife()
if sim then
local obj = sim:object(self.id)
local strn_id = obj:smart_terrain_id()
if strn_id ~= 65535 then
local strn = sim:object(strn_id)
if strn then
local strn_name = strn:name()
if string.find(self:name(), "pri_depot") and strn_name ~= "pri_depot" or
self:name() == "val_sos_bs" and strn_name ~= "val_sos" or
strn_name == "pri_monolith"
then
strn:unregister_npc(obj)
end
end
end
end
end

--' Íàðèñîâàòü ìàïñïîò ñ ñîáîé
--' if self:alive() and sim_statistic.show_monster_spot == true then
--' local community, rank = sim_statistic.getNpcType(self)
--' level.map_add_object_spot_ser(self.id, "alife_presentation_monstr", self:name().." "..community)
--' end
end
--------------------
function se_monster:on_unregister()
cse_alife_monster_base.on_unregister( self )

--' Óáðàòü ìàïñïîò ñ ñîáîé
--' if sim_statistic.show_monster_spot == true then
--' local community, rank = sim_statistic.getNpcType(self)
--' level.map_remove_object_spot(self.id, "alife_presentation_monstr")
--' end

smart_terrain.unregister_npc(self)
end
--------------------
function se_monster:on_death(killer)
cse_alife_monster_base.on_death(self, killer)

--' Óáðàòü ìàïñïîò ñ ñîáîé
if sim_statistic.show_monster_spot == true then
local community, rank = sim_statistic.getNpcType(self)
level.map_remove_object_spot(self.id, "alife_presentation_monstr")
end
end
--------------------
function se_monster:fill_exclusives()
self:get_ini()
self.smart_terrain_conditions = smart_terrain.read_smart_terrain_conditions( self )

if self.smart_terrain_conditions then
for name, condlist in pairs(self.smart_terrain_conditions) do
smart_terrain.exclusives[name] = (smart_terrain.exclusives[name] or 0) + 1
end
end
end


Maybe self.ini_initialized = false, self.spawner_present and self.smart_terrain_conditions_initialized need setting to true? Not sure if this script is vanilla or not... can't remember.

se_respawn;
local simMaxCount = {
stalker_novice = 40, stalker_regular = 70, stalker_veteran = 70, stalker_master = 50,
monolith_novice = 40, monolith_regular = 70, monolith_veteran = 70, monolith_master = 50,
military_novice = 40, military_regular = 70, military_veteran = 70, military_master = 50,
killer_novice = 40, killer_regular = 70, killer_veteran = 70, killer_master = 50,
ecolog_novice = 40, ecolog_regular = 70, ecolog_veteran = 70, ecolog_master = 50,
dolg_novice = 40, dolg_regular = 70, dolg_veteran = 70, dolg_master = 50,
freedom_novice = 40, freedom_regular = 70, freedom_veteran = 70, freedom_master = 50,
bandit_novice = 40, bandit_regular = 70, bandit_veteran = 70, bandit_master = 50,
zombied_novice = 40, zombied_regular = 70, zombied_veteran = 70, zombied_master = 50,

rat_weak = 0,
tushkano_weak = 200,
flesh_weak = 40, flesh_normal = 80, flesh_strong = 80,
boar_weak = 40, boar_normal = 80, boar_strong = 80,
dog_weak = 40, dog_normal = 150, dog_strong = 150,
pseudodog_weak = 40, pseudodog_normal = 80, pseudodog_strong = 80,
psy_dog_weak = 40, psy_dog_normal = 80, psy_dog_strong = 80,
zombie_weak = 40, zombie_normal = 80, zombie_strong = 80,
snork_weak = 40, snork_normal = 80, snork_strong = 80,
poltergeist_weak = 40,
pseudo_gigant_weak = 40,
controller_weak = 40,
burer_weak = 40,
cat_weak = 80,
bloodsucker_weak = 40, bloodsucker_normal = 80, bloodsucker_strong = 80
}

local idle_spawn_preset = {
seldom = 300*60,
medium = 240*60,
often = 180*60


Pretty sure only this part of se_respawn I edited.

Thats everything... I'm not missing anything here surely.. am I? Help someone :(
Mobo: Asrock Z77 Extreme6
CPU: Intel i5 3570k @ 4.5GHz 1.18v (actual)
RAM: 2x4GB G.Skill Ripjaws @ 2133MHz 10-11-10-25 1T
GPU: VTX3D HD7970 3GB @ 1125MHz / 6600MHz
Sound: Asus Xonar DX 7.1 PCI-E
HDD: 2TB Seagate Barracuda, Sata3 64MB Cache
Opticals: 2x Sony Optiarc DVD-RW
PSU: Corsair 850w HX
Case: Zalman Z11

TK - Singularity homepage
User avatar
ket
Senior Resident
 
Posts: 1259
Joined: 14 Sep 2008 11:57
Location: The solar system

Re: Any idea why my respawns don't work? :'(

Postby Nightwatch on 29 Sep 2012 22:42

Hey, Ket. Very long work, I can only have a look at those on Monday, visiting family this weekend. Not a good time for thinking.
Meanwhile, from top of my head as an attempt for some thinking gymnastics, are you sure that there is nothing in your mod -in other scripts, or other files- that somehow restricts the re-spawning of those certain elements in any probable way?
NEWSA.SIMBION_TWEAK 3.0
Mod Website= Features, Video, Tips & Download Link: NEWSA.SIMBION_Tweak

Watch the Trailer: http://www.youtube.com/watch?v=1Ajw_f8K ... re=channel
Please Do Not download and install any files from links other than those on the Mod's Website
User avatar
Nightwatch
Site Admin
 
Posts: 2613
Joined: 13 Apr 2007 05:42
Location: London, United Kingdom

Re: Any idea why my respawns don't work? :'(

Postby ket on 30 Sep 2012 00:53

Hi nightwatch :D As far as I can remember and have checked there shouldn't be anything restricting the respawns of the mutants I have added back into the game. The only files I haven't currently checked are the gulag files _maybe_ if theres some specific smarties the game expects to find but aren't being referenced is causing the respawns not to happen.. but even that is a long shot as all my spawns use generic or no logic depending on what I feel is more natural for that type of mutant. Eg; tushkanos have no logic and just wander where they please.. as animals like that tend to do, other mutants like zombies (well, some of them) use generic logic as a-la resident evil, zombies are typically "pack hunters".
Mobo: Asrock Z77 Extreme6
CPU: Intel i5 3570k @ 4.5GHz 1.18v (actual)
RAM: 2x4GB G.Skill Ripjaws @ 2133MHz 10-11-10-25 1T
GPU: VTX3D HD7970 3GB @ 1125MHz / 6600MHz
Sound: Asus Xonar DX 7.1 PCI-E
HDD: 2TB Seagate Barracuda, Sata3 64MB Cache
Opticals: 2x Sony Optiarc DVD-RW
PSU: Corsair 850w HX
Case: Zalman Z11

TK - Singularity homepage
User avatar
ket
Senior Resident
 
Posts: 1259
Joined: 14 Sep 2008 11:57
Location: The solar system

Re: Any idea why my respawns don't work? :'(

Postby ket on 03 Oct 2012 17:15

Anyone?...
Mobo: Asrock Z77 Extreme6
CPU: Intel i5 3570k @ 4.5GHz 1.18v (actual)
RAM: 2x4GB G.Skill Ripjaws @ 2133MHz 10-11-10-25 1T
GPU: VTX3D HD7970 3GB @ 1125MHz / 6600MHz
Sound: Asus Xonar DX 7.1 PCI-E
HDD: 2TB Seagate Barracuda, Sata3 64MB Cache
Opticals: 2x Sony Optiarc DVD-RW
PSU: Corsair 850w HX
Case: Zalman Z11

TK - Singularity homepage
User avatar
ket
Senior Resident
 
Posts: 1259
Joined: 14 Sep 2008 11:57
Location: The solar system

Re: Any idea why my respawns don't work? :'(

Postby rockingmtranch on 03 Oct 2012 23:44

ket wrote:Anyone?...

:-??
LINUX! Don't fight it. You will be assimilated!
----------------
Gulf War Vet--2nd Squadron, 2nd ACR, Fort Polk, LA
User avatar
rockingmtranch
Moderator
 
Posts: 1228
Joined: 13 Sep 2008 02:39
Location: Meadowbrook, California

Re: Any idea why my respawns don't work? :'(

Postby Nightwatch on 04 Oct 2012 15:49

Had chance to have a preliminary look at what you posted above. Before starting, noting that I'm not good at all in proof-reading at all (concentration wavers quickly) and there are really professionally good people around for it, and therefore there still may be something that I'm missing while staring, now I can tell my impressions.

First of all, your se_monster.script is "vanilla," replying your question there, and also, self.ini_initialized = false, self.spawner_present and self.smart_terrain_conditions_initialized need setting are ok, you can leave them as they are.

Apart from a few questions that I'm going to ask you, which I suspect may appear due to cut-and-paste problems, all seem to be ok, as far as the posted sections concerned.

In orderly fashion: your left indent alignment seems off-line, but this may well have caused due to cut-and-paste process. Still, checking them with notepad++ always shows better than ms notepad, but you know that of course.

Next: on your se_respawn file, the last bracket on "local idle_spawn_preset" after the "often" is missing. But, that can be a cut/paste symptom as well, of course.

-------------

As you mention that you use the same scripts to respawn NPCs and all work fine, but when it comes to creatures things don't work. From this, it may be deduced that there's something wrong about the "creatures" in some other parts of the mod, the same arrangement does not work for the creatures.

One problem though to start with, as the way it seems on the post:

=====================================================
>> First of all, in your all.spawn example of, your "respawn" sections, as in:

[940]
; cse_abstract properties
section_name = respawn
name = esc_cat_01

Now, below there, there's an entry:

conditions = 100
END


which is not correct. (100 cannot be a condition here. This is an example of conditions in all.spawn: conditions = {+agroprom_military_case_done} 80, 0 ---but please do not use it as it is, for it's just an example)

Therefore, please CANCEL OUT the "conditions" and change it to:

;conditions = 100
END



(Quite probably, this is what's been stopping your creature respawns.)

=====================================================

++++Still, let's check other options as well, while on the matter.

---Also, please check your name protocols, like in name = esc_cat_01
so that they do not conflict with other entries in the mod.


>> There may be parallel or contrasting creature entries in various files which then would stop the process.

>> Question: Have you edited your "gulag_general" and/or any of the relevant "gulag" files?

>> your switch_distance is compatible with your spawn/respawn values?


Meanwhile you may try a few lines of attempts:

a) In your se_respawn, let's try setting "local idle_spawn_preset" to vanilla values as:

local idle_spawn_preset = {
seldom = 60*60,
medium = 60*60,
often = 60*60
}

and then see if original level respawns have started working or not.


b) Only if any of the above does not respond positively, then you may try this script on your "se_monster.script " in the corresponding, replacing that part:

Code: Select all
class "se_monster" (cse_alife_monster_base)
--------------------
function se_monster:__init (section) super (section)
   self.ini = nil
   self.ini_initialized = false
   
   self.spawner_present = false
   
   self.smart_terrain_conditions = nil
   self.smart_terrain_conditions_initialized = false
   
   self.check_distance = nil
   self.min_distance = nil
   self.day_night_switch = nil
   
   self.job_online          = nil
   self.job_online_condlist = nil
   
   --/ ïîñåùàë ëè ñòàëêåð õîòü îäèí smart_terrain
   self.was_in_smart_terrain = false
   
   self.day_begin=-1
   self.day_end=-1
   
   self.state = nil
end
--------------------
function se_monster:get_ini()
   if not self.ini_initialized then
      self.ini = self:spawn_ini ()
      self.ini_initialized = true
      
      self.spawner_present = self.ini:section_exist ("spawner")
      
      if self.ini ~= nil and self.spawner_present == true then
       if self.ini:line_exist ("spawner", "check_distance") == true then
            self.check_distance = utils.cfg_get_bool(self.ini, "spawner", "check_distance", self, false, false)
         end
         if self.ini:line_exist ("spawner", "min_distance") == true then
            self.min_distance = utils.cfg_get_number(self.ini, "spawner", "min_distance", self, false, 150)
         end
         if self.ini:line_exist ("spawner", "day_night_switch") == true then
            self.day_night_switch = utils.cfg_get_bool(self.ini, "spawner", "day_night_switch", self, false, false)
         end
      end
      
      self.day_begin = utils.cfg_get_number(system_ini(), self:section_name(), "DayTime_Begin", self, false, -1)
      self.day_end = utils.cfg_get_number(system_ini(), self:section_name(), "DayTime_End", self, false, -1)
      
      if self.min_distance == nil then
         local sys = system_ini()
         if sys ~= nil and sys:line_exist ("alife", "switch_distance") == true then
            self.min_distance = sys:r_u32 ("alife", "switch_distance") - 50
            if self.min_distance < 50 then
               self.min_distance = 50
            elseif self.min_distance > 50 then
               self.min_distance = 50
            end
         else
            self.min_distance = 50
         end
      end
      
   end
end



As a last resort, as this may not work on your mod if there are any conflicting files/values with it in your mod, which of course I cannot know from here; you'd know it.

:mozilla_smile:
NEWSA.SIMBION_TWEAK 3.0
Mod Website= Features, Video, Tips & Download Link: NEWSA.SIMBION_Tweak

Watch the Trailer: http://www.youtube.com/watch?v=1Ajw_f8K ... re=channel
Please Do Not download and install any files from links other than those on the Mod's Website
User avatar
Nightwatch
Site Admin
 
Posts: 2613
Joined: 13 Apr 2007 05:42
Location: London, United Kingdom

Re: Any idea why my respawns don't work? :'(

Postby ket on 05 Oct 2012 12:38

Thanks nightwatch, I'll try replacing that section of se_moster. Now, for your questions;

Yes, those issues are a result of copy/paste.
The conditions in the spawn code, AFAIK, when replaced from a script condition to "100" tells the game the probability of the spawn. I'll comment it out though and see what happens.
gulag_general.script hasn't been changed, its in the mod, but if I recall correctly its a remnant from long ago when I was attempting to permanently stop the "stalling" x-ray has when AI goes on/offline. Heres what the gulag_general looks like though;

Code: Select all
local t
local ltx

function load_job(sj, gname, type, squad, groups, st)
   ltx = "[meet@generic_lager_guard]\n"..
        "meet_state      = 10|wait@wait\n"..
        "meet_state_wpn   = 10|backoff@threat_weap\n"..
        "victim         = 10|actor\n"..
        "victim_wpn      = 10|actor\n"..
        "use            = true\n"..
        "use_wpn         = false\n"..
        "syndata         = backoff@threat_weap\n"..
        "precond         = visibility\n"..

        "[meet@generic_lager_patrol]\n"..
        "meet_state      = 5|wait@wait\n"..
        "meet_state_wpn   = 10|backoff@threat_weap\n"..
        "victim         = 5|actor\n"..
        "victim_wpn      = 10|actor\n"..
        "use            = true\n"..
        "use_wpn         = false\n"..
        "syndata         = backoff@threat_weap\n"..
        "precond         = visibility\n"
       
   -- ÓÍÈÂÅÐÑÀËÜÍÛÉ ËÀÃÅÐÜ ÑÒÀËÊÅÐÎÂ
   if type == "general_lager" then
      -- Ïðîâåðÿåì íàëè÷èå êàìïîâ.
      local it = 1
      while level.patrol_path_exists(gname.."_kamp_"..it) do
         -- Íåîáõîäèìî âû÷èòàòü êîëè÷åñòâî ðàáîò èç íàçâàíèÿ òî÷êè ïóòè.
         local way_name = gname.."_kamp_"..it
         local ptr = patrol(way_name)
         local wp_prop = utils.parse_waypoint_data(way_name, ptr:flags(0), ptr:name(0))
         local job_count = 5
         if wp_prop.count ~= nil then
            job_count = wp_prop.count
         end

         for i = 1, job_count do
            -- äîáàâëÿåì äîëæíîñòü
            t = { section = "logic@"..way_name,
               idle = 0,
               prior = 8-i, state = {0,1}, squad = squad, group = groups[1],
               position_threshold = 50,
               in_rest = "", out_rest = ""
            }
            table.insert(sj, t)
         end

         -- äîáàâëÿåì îïèñàíèå äîëæíîñòè â ëòõ.
         local job_ltx = "[logic@"..way_name.."]\n"..
                     "active = kamp@"..way_name.."\n"..

                     "[kamp@"..way_name.."]\n"..
                     "center_point = kamp_"..it.."\n"..
                     "soundgroup = "..way_name.."\n"

         ltx = ltx..job_ltx
         it = it + 1
      end

      -- Ïðîâåðÿåì íàëè÷èå ïóòåé äëÿ ñíà.
      it = 1
      while level.patrol_path_exists(gname.."_sleep_"..it) do
         -- Íåîáõîäèìî âû÷èòàòü êîëè÷åñòâî ðàáîò èç íàçâàíèÿ òî÷êè ïóòè.
         local way_name = gname.."_sleep_"..it

         -- äîáàâëÿåì äîëæíîñòü
         t = { section = "logic@"..way_name,
            idle = 0,
            prior = 4, state = {0,1}, squad = squad, group = groups[1],
            position_threshold = 50,
            in_rest = "", out_rest = ""
         }
         table.insert(sj, t)

         -- äîáàâëÿåì îïèñàíèå äîëæíîñòè â ëòõ.
         local job_ltx = "[logic@"..way_name.."]\n"..
                     "active = sleeper@"..way_name.."\n"..

                     "[sleeper@"..way_name.."]\n"..
                     "path_main = sleep_"..it.."\n"

         ltx = ltx..job_ltx
         it = it + 1
      end


      -- Ïðîâåðÿåì íàëè÷èå ïóòåé áðîæåíèÿ âíóòðè ëàãåðÿ.
      it = 1
      while level.patrol_path_exists(gname.."_walker_"..it.."_walk") do
         -- Íåîáõîäèìî âû÷èòàòü êîëè÷åñòâî ðàáîò èç íàçâàíèÿ òî÷êè ïóòè.
         local way_name = gname.."_walker_"..it.."_walk"

         -- äîáàâëÿåì äîëæíîñòü
         t = { section = "logic@"..way_name,
            idle = math.random(40,60)*60*1000, timeout = math.random(10,20)*60*1000,
            prior = 5, state = {0,1}, squad = squad, group = groups[1],
            position_threshold = 50,
            in_rest = "", out_rest = ""
         }
         table.insert(sj, t)

         -- äîáàâëÿåì îïèñàíèå äîëæíîñòè â ëòõ.
         local job_ltx = "[logic@"..way_name.."]\n"..
                     "active = walker@"..way_name.."\n"..

                     "[walker@"..way_name.."]\n"..
                     "sound_idle = state\n"..
                     "path_walk = walker_"..it.."_walk\n"

         if level.patrol_path_exists(gname.."_walker_"..it.."_look") then
            job_ltx = job_ltx.."path_look = walker_"..it.."_look\n"
         end

         ltx = ltx..job_ltx
         it = it + 1
      end

      -- Ïðîâåðÿåì íàëè÷èå ïóòåé áðîæåíèÿ âíóòðè ëàãåðÿ(áåç òàéìàóòà).
      it = 1
      while level.patrol_path_exists(gname.."_walker2_"..it.."_walk") do
         -- Íåîáõîäèìî âû÷èòàòü êîëè÷åñòâî ðàáîò èç íàçâàíèÿ òî÷êè ïóòè.
         local way_name = gname.."_walker2_"..it.."_walk"

         -- äîáàâëÿåì äîëæíîñòü
         t = { section = "logic@"..way_name,
            idle = 0,
            prior = 5, state = {0,1}, squad = squad, group = groups[1],
            position_threshold = 50,
            in_rest = "", out_rest = ""
         }
         table.insert(sj, t)

         -- äîáàâëÿåì îïèñàíèå äîëæíîñòè â ëòõ.
         local job_ltx = "[logic@"..way_name.."]\n"..
                     "active = walker@"..way_name.."\n"..

                     "[walker@"..way_name.."]\n"..
                     "sound_idle = state\n"..
                     "path_walk = walker2_"..it.."_walk\n"

         if level.patrol_path_exists(gname.."_walker2_"..it.."_look") then
            job_ltx = job_ltx.."path_look = walker2_"..it.."_look\n"
         end

         ltx = ltx..job_ltx
         it = it + 1
      end

      -- Ïðîâåðÿåì íàëè÷èå ïàòðóëåé îáõîäà â ëàãåðå.
      it = 1
      while level.patrol_path_exists(gname.."_patrol_"..it.."_walk") do
         -- Íåîáõîäèìî âû÷èòàòü êîëè÷åñòâî ðàáîò èç íàçâàíèÿ òî÷êè ïóòè.
         local way_name = gname.."_patrol_"..it.."_walk"
         local ptr = patrol(way_name)
         local wp_prop = utils.parse_waypoint_data(way_name, ptr:flags(0), ptr:name(0))
         local job_count = 3
         if wp_prop.count ~= nil then
            job_count = wp_prop.count
         end

         for i = 1, job_count do
            -- äîáàâëÿåì äîëæíîñòü
            t = { section = "logic@"..way_name,
               idle = math.random(60,120)*60*1000,
               prior = 6, state = {0,1}, squad = squad, group = groups[1],
               position_threshold = 50,
               in_rest = "", out_rest = ""
            }
            table.insert(sj, t)
         end

         -- äîáàâëÿåì îïèñàíèå äîëæíîñòè â ëòõ.
         local job_ltx = "[logic@"..way_name.."]\n"..
                     "active = patrol@"..way_name.."\n"..

                     "[patrol@"..way_name.."]\n"..
                     "meet = meet@generic_lager_patrol\n"..
                     "formation = back\n"..
                     "path_walk = patrol_"..it.."_walk\n"..
                     "on_signal = end| %=search_gulag_job%\n"

         if level.patrol_path_exists(gname.."_patrol_"..it.."_look") then
            job_ltx = job_ltx.."path_look = patrol_"..it.."_look\n"
         end

         ltx = ltx..job_ltx
         it = it + 1
      end

      -- Ïðîâåðÿåì íàëè÷èå ÷àñîâûõ â ëàãåðå.
      it = 1
      while level.patrol_path_exists(gname.."_guard_"..it.."_walk") do
         -- Íåîáõîäèìî âû÷èòàòü êîëè÷åñòâî ðàáîò èç íàçâàíèÿ òî÷êè ïóòè.
         local way_name = gname.."_guard_"..it.."_walk"

         -- äîáàâëÿåì äîëæíîñòü
         t = { section = "logic@"..way_name,
            idle = 0,
            prior = 7, state = {0,1}, squad = squad, group = groups[1],
            position_threshold = 50,
            in_rest = "", out_rest = ""
         }
         table.insert(sj, t)

         -- äîáàâëÿåì îïèñàíèå äîëæíîñòè â ëòõ.
         local job_ltx = "[logic@"..way_name.."]\n"..
                     "active = camper@"..way_name.."\n"..

                     "[camper@"..way_name.."]\n"..
                     "meet = meet@generic_lager_guard\n"..
                     "path_walk = guard_"..it.."_walk\n"

         if level.patrol_path_exists(gname.."_guard_"..it.."_look") then
            job_ltx = job_ltx.."path_look = guard_"..it.."_look\n"
         end

         ltx = ltx..job_ltx
         it = it + 1
      end

      -- Ïðîâåðÿåì íàëè÷èå ñíàéïåðîâ â ëàãåðå.
      it = 1
      while level.patrol_path_exists(gname.."_sniper_"..it.."_walk") do
         -- Íåîáõîäèìî âû÷èòàòü êîëè÷åñòâî ðàáîò èç íàçâàíèÿ òî÷êè ïóòè.
         local way_name = gname.."_sniper_"..it.."_walk"

         -- äîáàâëÿåì äîëæíîñòü
         t = { section = "logic@"..way_name,
            idle = 0,
            prior = 10, state = {0,1}, squad = squad, group = groups[1],
            position_threshold = 50,
            in_rest = "", out_rest = "",
            predicate = function(npc_info)
                        return npc_info.is_sniper == true
                        end
         }
         table.insert(sj, t)

         -- äîáàâëÿåì îïèñàíèå äîëæíîñòè â ëòõ.
         local job_ltx = "[logic@"..way_name.."]\n"..
                     "active = camper@"..way_name.."\n"..

                     "[camper@"..way_name.."]\n"..                     
                     "path_walk = sniper_"..it.."_walk\n"..
                     "path_look = sniper_"..it.."_look\n"..
                     "sniper = true\n"

         ltx = ltx..job_ltx
         it = it + 1
      end

      -- Ïðîâåðÿåì âîçìîæíîñòü âûðóëèòü â ðåéä (íàëè÷èå ïóòåé, àëãîðèòì ïåðåêëþ÷åíèÿ)
      it = 1
      local job_count = 5
      while level.patrol_path_exists(gname.."_raid_"..it.."_walk") do
         -- Íåîáõîäèìî âû÷èòàòü êîëè÷åñòâî ðàáîò èç íàçâàíèÿ òî÷êè ïóòè.
         local way_name = gname.."_raid_"..it.."_walk"
         local ptr = patrol(way_name)
         local wp_prop = utils.parse_waypoint_data(way_name, ptr:flags(0), ptr:name(0))
         if wp_prop.count ~= nil then
            job_count = wp_prop.count
         end

         for i = 1, job_count do
            -- äîáàâëÿåì äîëæíîñòü
            t = { section = "logic@"..way_name,
               idle = 0,
               prior = 10, state = {1}, squad = squad, group = groups[1],
               fill_idle = xr_gulag.idle_once,
               position_threshold = 50,
               in_rest = "", out_rest = ""
            }
            table.insert(sj, t)
         end

         -- äîáàâëÿåì îïèñàíèå äîëæíîñòè â ëòõ.
         local job_ltx = "[logic@"..way_name.."]\n"..
                     "active = patrol@"..way_name.."\n"..

                     "[patrol@"..way_name.."]\n"..
                     "meet = meet@generic_lager_patrol\n"..
                     "formation = around\n"..
                     "path_walk = raid_"..it.."_walk\n"

         if level.patrol_path_exists(gname.."_raid_"..it.."_look") then
            job_ltx = job_ltx.."path_look = raid_"..it.."_look\n"
         end

         ltx = ltx..job_ltx
         it = it + 1
      end

   end

   -- ÓÍÈÂÅÐÑÀËÜÍÎÅ ËÎÃÎÂÎ ÌÎÍÑÒÐÎÂ
   if type == "general_lair" then
      -- Ïðîâåðÿåì íàëè÷èå ìîá_õîì.
      local it = 1
      while level.patrol_path_exists(gname.."_home_"..it) do
         -- Íåîáõîäèìî âû÷èòàòü êîëè÷åñòâî ðàáîò èç íàçâàíèÿ òî÷êè ïóòè.
         local way_name = gname.."_home_"..it
         local ptr = patrol(way_name)
         local wp_prop = utils.parse_waypoint_data(way_name, ptr:flags(0), ptr:name(0))
         local job_count = 10
         if wp_prop.count ~= nil then
            job_count = wp_prop.count
         end

         for i = 1, job_count do
            -- äîáàâëÿåì äîëæíîñòü
            t = { section = "logic@"..way_name,
               idle = 0,
               prior = 5, state = {0,1}, squad = squad, group = groups[1],
               position_threshold = 20,
               in_rest = "", out_rest = ""
            }
            table.insert(sj, t)
         end

         -- äîáàâëÿåì îïèñàíèå äîëæíîñòè â ëòõ.
         local job_ltx = "[logic@"..way_name.."]\n"..
                     "active = mob_home@"..way_name.."\n"..

                     "[mob_home@"..way_name.."]\n"..
                     "path_home = home_"..it.."\n"

         ltx = ltx..job_ltx
         it = it + 1
      end

      -- Íåîáõîäèì fake_death ñ ïàòðóëüíûì ïóòåì



      -- Íåîáõîäèìà àòàêà â ëèöå mob_home ñ agressive
      -- Ïðîâåðÿåì âîçìîæíîñòü âûðóëèòü â ðåéä (íàëè÷èå ïóòåé, àëãîðèòì ïåðåêëþ÷åíèÿ)
      it = 1
      local job_count = 5
      while level.patrol_path_exists(gname.."_raid_"..it) do
         -- Íåîáõîäèìî âû÷èòàòü êîëè÷åñòâî ðàáîò èç íàçâàíèÿ òî÷êè ïóòè.
         local way_name = gname.."_raid_"..it
         local ptr = patrol(way_name)
         local wp_prop = utils.parse_waypoint_data(way_name, ptr:flags(0), ptr:name(0))
         if wp_prop.count ~= nil then
            job_count = wp_prop.count
         end

         for i = 1, job_count do
            -- äîáàâëÿåì äîëæíîñòü
            t = { section = "logic@"..way_name,
               idle = 0,
               prior = 10, state = {1}, squad = squad, group = groups[1],
               fill_idle = xr_gulag.idle_once,
               position_threshold = 70,
               in_rest = "", out_rest = ""
            }
            table.insert(sj, t)
         end

         -- äîáàâëÿåì îïèñàíèå äîëæíîñòè â ëòõ.
         local job_ltx = "[logic@"..way_name.."]\n"..
                     "active = mob_home@"..way_name.."\n"..

                     "[mob_home@"..way_name.."]\n"..
                     "path_home = raid_"..it.."\n"..
                     "aggressive_home\n"

         ltx = ltx..job_ltx
         it = it + 1
      end


   end
end

function load_states(gname, type)
   if type == "general_lager" then
      return function(gulag)
         if gulag.state == 0 then
            if gulag.population_comed == 0 then
               return 0
            end
            if xr_logic.pick_section_from_condlist(db.actor, gulag.smrttrn, gulag.state_switch_1) ~= nil then

               --level.map_add_object_spot(gulag.smrttrn.id, "alife_presentation_smart_ready", "Ready")   
      
               return 1
            end
            return 0
         elseif gulag.state == 1 then
            -- Åñëè ãóëàã íå íà ýòîé ëîêàöèè, òî îñòàëüíîå ïðîâåðÿòü áåññìûñëåííî, òàê êàê
            -- 1) óïîìÿíóòûå â switch_0 ãóëàãè ýëåìåíòàðíî íå íàéäóòñÿ ïî èìåíè;
            -- 2) ïðèøåäøåå íàñåëåíèå ìîæåò îêàçàòüñÿ ðàâíûì íóëþ èç-çà äðóãîé ñõåìû åãî ïîäñ÷¸òà.
            if not db.zone_by_name[gulag.name] then
               return 1
            end
            if gulag.population_comed == 0 then
               return 0
            end
            if xr_logic.pick_section_from_condlist(db.actor, gulag.smrttrn, gulag.state_switch_0) ~= nil then
               
               --level.map_remove_object_spot(gulag.smrttrn.id, "alife_presentation_smart_ready")
               return 0
            end
            return 1
         end
      end
   end

   if type == "general_lair" then
      return function(gulag)
         if gulag.state == 0 then
            if gulag.population_comed == 0 then
               return 0
            end

            if xr_logic.pick_section_from_condlist(db.actor, gulag.object, gulag.state_switch_1) ~= nil then
               
               --level.map_add_object_spot(gulag.smrttrn.id, "alife_presentation_smart_ready", "Ready")   
               return 1
            end
            return 0
         elseif gulag.state == 1 then
            if gulag.population_comed == 0 then
               return 0
            end
            if xr_logic.pick_section_from_condlist(db.actor, gulag.object, gulag.state_switch_0) ~= nil then

               --level.map_remove_object_spot(gulag.smrttrn.id, "alife_presentation_smart_ready")
               return 0
            end
            return 1
         end
      end
   end
end


function checkStalker(npc_community, type, npc_rank, se_obj, preset_name)
   return type == "general_lager"
end

function checkMonster(npc_community, type, npc_rank, se_obj, preset_name)
   return type == "general_lair"
end


--------------------------------------------------------------------------
-- Dynamic ltx
--------------------------------------------------------------------------
function load_ltx(gname, type)
   if type == "general_lager" then
      return ltx
   end
   if type == "general_lair" then
      return ltx
   end
   return nil
end


Switch distance in the mod is set to 600, so there shouldn't be any problems there.
There has been some editing of gulag scripts, but if I recall correctly they were all part of bardaks BFA so there shouldn't be any issues. I'll upload copies of the gulag script files for if anyone wants to triple check them.
You do not have the required permissions to view the files attached to this post.
Mobo: Asrock Z77 Extreme6
CPU: Intel i5 3570k @ 4.5GHz 1.18v (actual)
RAM: 2x4GB G.Skill Ripjaws @ 2133MHz 10-11-10-25 1T
GPU: VTX3D HD7970 3GB @ 1125MHz / 6600MHz
Sound: Asus Xonar DX 7.1 PCI-E
HDD: 2TB Seagate Barracuda, Sata3 64MB Cache
Opticals: 2x Sony Optiarc DVD-RW
PSU: Corsair 850w HX
Case: Zalman Z11

TK - Singularity homepage
User avatar
ket
Senior Resident
 
Posts: 1259
Joined: 14 Sep 2008 11:57
Location: The solar system

Re: Any idea why my respawns don't work? :'(

Postby Nightwatch on 06 Oct 2012 01:10

I downloaded the file and copied the gulag_general. I'll try to see if I can spot anything. Can't look at anything before Sunday, though, sorry.

On another note, 600 meters switch_distance, imo, seems a bit too much to me; may cause engine to stall at times, or may not, all depends of course on the bigger picture and the hardware that handles it of course,anyway. Just a thought.
As a further comment to the "options =" reference in my above post, let me rephrase it. As everybody agrees, the all.spawn is nasty piece of work, no doubt about it. Like all nasty things, it's always better to keep hands as away as possible from it. This is my opinion that, giving specific values, i.e. spawning percentage/randomization etc in all.spawn can later clash with various randomization orders given in upper level code in the game, and may behave rather like anchors. Even info_portion based conditions in all.spawn give a lot of headaches many times. So if possible, one would be much happier by refraining from giving percentage/randomization orders in all.spawn. Having said that, nothing stops anyone doing exactly what they want, just like in life. Consequences... Well, that's another matter :mozilla_smile:
NEWSA.SIMBION_TWEAK 3.0
Mod Website= Features, Video, Tips & Download Link: NEWSA.SIMBION_Tweak

Watch the Trailer: http://www.youtube.com/watch?v=1Ajw_f8K ... re=channel
Please Do Not download and install any files from links other than those on the Mod's Website
User avatar
Nightwatch
Site Admin
 
Posts: 2613
Joined: 13 Apr 2007 05:42
Location: London, United Kingdom

Re: Any idea why my respawns don't work? :'(

Postby ket on 08 Mar 2013 18:58

Yeah I got tired of the all.spawn work, it was easy enough but such a pain to make so many new entries, so I cheated. Tied everything to blowouts via script :p
Mobo: Asrock Z77 Extreme6
CPU: Intel i5 3570k @ 4.5GHz 1.18v (actual)
RAM: 2x4GB G.Skill Ripjaws @ 2133MHz 10-11-10-25 1T
GPU: VTX3D HD7970 3GB @ 1125MHz / 6600MHz
Sound: Asus Xonar DX 7.1 PCI-E
HDD: 2TB Seagate Barracuda, Sata3 64MB Cache
Opticals: 2x Sony Optiarc DVD-RW
PSU: Corsair 850w HX
Case: Zalman Z11

TK - Singularity homepage
User avatar
ket
Senior Resident
 
Posts: 1259
Joined: 14 Sep 2008 11:57
Location: The solar system

Re: Any idea why my respawns don't work? :'(

Postby Nightwatch on 10 Mar 2013 16:03

Here you go :thumbright:
NEWSA.SIMBION_TWEAK 3.0
Mod Website= Features, Video, Tips & Download Link: NEWSA.SIMBION_Tweak

Watch the Trailer: http://www.youtube.com/watch?v=1Ajw_f8K ... re=channel
Please Do Not download and install any files from links other than those on the Mod's Website
User avatar
Nightwatch
Site Admin
 
Posts: 2613
Joined: 13 Apr 2007 05:42
Location: London, United Kingdom


Return to Modding Techniques

Who is online

Users browsing this forum: No registered users and 1 guest

cron