ProjectsWhat's NewDownloadsCommunitySupportCompany
Forum Index » S.T.A.L.K.E.R.: Shadow of Chernobyl Forum » Mod discussion
Smart terrain tutorial

1 2 3 4 5
Posted by/on
Question/AnswerMake Newest Up Sort by Descending
  18:22:15  28 May 2008
profilee-mailreply Message URLTo the Top
barin
scripter
(Resident)

 

 
On forum: 09/12/2007
Messages: 702
Smart terrain tutorial

Lately some people asked me how to create and script smart terrains. To avoid responding for each single email i decided to create this little tutorial. Before i start i would like to tell you that i'm not an expert in this kind of stuff and some things are still not clear for me so i might not be able to explain it properly.
My english isn't perfect so please bear with me. Also i will use ST as Smart Terrain abbreviation. This tutorial treats about npc's STs but for mutants it's almost the same. I assume you are familiar with:

- lua programming
- all.spawn editing
- waypoints (patrols)
- ai schemes

First you have to think about your ST, where to spawn it, how many npcs/mutants will "work" for your ST, when ST should be activated/terminated, how many states your ST will have and so on. I guess the best way would be to show you how to get it working by an example. So let's say we want to spawn ST in Cordon for 3 bandits.

1. Spawning ST:


[2515]
; cse_abstract properties
section_name = smart_terrain
name = esc_bandits_smart_terrain
position = 131.02030944824,0.065616846084595,-248.9094543457
direction = 0,0,0

; cse_alife_object properties
game_vertex_id = 635
distance = 9.09999942779541
level_vertex_id = 363757
object_flags = 0xffffff3e
custom_data = <<END
[smart_terrain]
type = esc_bandits_smart_terrain
cond = {-infoportion}
capacity = 3
squad = 1
groups = 5
respawn = esc_respawn_inventory_box_0002
END

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

; cse_alife_space_restrictor properties
restrictor_type = 3

; se_smart_terrain properties



this is actually the most important stuff:


type = esc_bandits_smart_terrain
cond = {-infoportion}
capacity = 3
squad = 1
groups = 5
respawn = esc_respawn_inventory_box_0002



type is a name of our new ST (required)
cond describes conditions which have to be met (optional)
capacity ST npcs/mutants quantity i.e. how many npcs/mutants our ST can handle (required)
squad, groups no idea what they are used for, maybe they are not used at all but i might be wrong (both are optional)
respawn name of the stash (blue box) where items will be spawn when ST respawn will be called (optional)

2. Spawning npcs/mutants and assigning (binding) them to our ST: in this case for each mutant/npc we have to add to its logic:


custom_data = <<END
[b][smart_terrains]
esc_bandits_smart_terrain = true[/b]
END



3. Adding job (logic) for each npc/mutant from our ST (for each state). Let's say our ST have two states: state 0 (describes what npcs/mutants are doing during day) and state 1 (during night). We have 3 bandits, so say:

- bandit1: walker (state 0) and kamp (state 1)
- bandit2: guard (state 0) and sleeper (state 1)
- bandit3: walker (state 0 and 1 <= he's doing the same at day and night)

There are at least 3 ways to add logic (job) for each npc/mutant, we will use the most common one, i.e. we will add logic to config\misc\gulag_escape.ltx file. It may looks like this:

;-- bandit1 (walker -> state 0, i.e. during day)
[logic@esc_bandits_smart_terrain_bandit1_walker]
active = walker@esc_bandits_smart_terrain_bandit1

[walker@esc_bandits_smart_terrain_bandit1]
path_walk = bandit1_walk
danger = danger_condition@esc_bandits_smart_terrain
def_state_moving1 = patrol
def_state_moving2 = patrol
def_state_moving3 = patrol
meet = no_meet

;-- bandit1 (kamp -> state 1, i.e. during night)
[logic@esc_bandits_smart_terrain_bandit1_kamp]
active = kamp@esc_bandits_smart_terrain_bandit1

[kamp@esc_bandits_smart_terrain_bandit1]
center_point = bandit_kamp
path_walk = bandit_kamp_task

;-- bandit2 (guard -> state 0, i.e. during day)
[logic@esc_bandits_smart_terrain_bandit2_walker]
active = walker@esc_bandits_smart_terrain_bandit2

[walker@esc_bandits_smart_terrain_bandit2]
path_walk = bandit2_walk
path_look = bandit2_look
danger = danger_condition@esc_bandits_smart_terrain

;-- bandit2 (sleeper -> state 1, i.e. during night)
[logic@esc_bandits_smart_terrain_bandit2_sleeper]
active = sleeper@esc_bandits_smart_terrain_bandit2

[sleeper@esc_bandits_smart_terrain_bandit2]
path_main = bandit2_sleep
wakeable = false

;-- bandit3 (guard -> state 0 and 1, i.e. during day/night)
[logic@esc_bandits_smart_terrain_bandit3_walker]
active = walker@esc_bandits_smart_terrain_bandit3

[walker@esc_bandits_smart_terrain_bandit3]
path_walk = bandit3_walk
path_look = bandit3_look

[danger_condition@esc_bandits_smart_terrain]
ignore_distance_corpse = 0
ignore_distance = 0

4. Now we have to script our ST. In this case we will add our code to scripts\gulag_escape.script file. There are several things we need to do here (each of this steps is required):

- load logic (jobs) for each npc/mutant, for each state -> function load_job(...)


if type == "esc_bandits_smart_terrain" then
t = {}
;-- section is a "link" to logic defined in ltx file
t.section = "logic@esc_bandits_smart_terrain_bandit1_walker"
;-- no idea, probably describes after what time
;-- npc will use this job again (?)
t.idle = 0
;-- no idea but i guess it's optional
t.timeout = 0
;-- priority
t.prior = 100
;-- npc will use this logic if ST switched to this state
;-- in this case - state 0 (day)
t.state = {0}
;-- no idea about squad and group
t.squad = squad
t.group = groups[1]
;-- no idea what means position_threshold
t.position_threshold = 100
;-- describes whether npc in this state is online or offline
;-- online = true by default
t.online = true
;-- describes restrictors (where npc can/can't go)
t.in_rest = ""
t.out_rest = ""
;-- because of the way how jobs are assigning by
;-- smart_terrain.script you never know which job
;-- will be used by which npc; if you want to ensure
;-- that certain job is used by certain npc then
;-- you have to use predicate function; in this case
;-- we want this job to be used by expert (master) bandit
t.predicate = function(obj_info) return obj_info.rank >= 900 end
table.insert(sj, t)

t = {section = "logic@esc_bandits_smart_terrain_bandit1_kamp",
idle = 0, timeout = 0, prior = 100, state = {1},squad = squad,
group = groups[1], position_threshold = 100, online = true, in_rest = "",
out_rest = "", predicate = function(obj_info) return obj_info.rank >= 900 end}
table.insert(sj, t)

;-- bandit2 -> state 0 (day)
t = {section = "logic@esc_bandits_smart_terrain_bandit2_walker",
idle = 0, prior = 5, state = {0}, squad = squad, group = groups[1],
in_rest = "", out_rest = ""}
table.insert(sj, t)

;-- bandit2 -> state 1 (night)
t = {section = "logic@esc_bandits_smart_terrain_bandit2_sleeper",
idle = 0, prior = 5, state = {1}, squad = squad, group = groups[1],
in_rest = "", out_rest = ""}
table.insert(sj, t)

;-- bandit3 -> state 0 (day) and state 1 (night)
t = {section = "logic@esc_bandits_smart_terrain_bandit3_walker",
idle = 0, prior = 5, state = {0, 1}, squad = squad, group = groups[1],
in_rest = "", out_rest = ""}
table.insert(sj, t)

end



One more thing about ST states, it's up to you how many states your ST have. The important thing is to add logic for each state. For instance your ST can have those states:

0 - npcs are offline
1 - npcs are online (day)
2 - npcs are online (night)
3 - npcs are online, they decided to assault other ST
4 - npcs are online and actor attacks them

And another thing, i'm sick when i have to fill so many tables, so i usually use this function:


[b]function[/b] fill_tbl(section, idle, prior, states, squad, group, in_rest, out_rest, online, gulag_name)
  [b]local[/b] tbl = {}
	
  tbl.section = "logic@" .. gulag_name .. "_" .. section
  tbl.idle = idle
  tbl.prior = prior	
  tbl.state = {}

  [b]for[/b] index = 1, #states [b]do[/b]
    table.insert(tbl.state, states[index])
  [b]end[/b]

  tbl.squad = squad
  tbl.group = group
  tbl.in_rest = in_rest
  tbl.out_rest = out_rest
  tbl.online = online
  [b]return[/b] tbl
[b]end[/b]



So using above function, we can load logic like this:


if type == "esc_bandits_smart_terrain" then
local t = table.insert(sj, fill_tbl("bandit1_walker", 0, 100, {0}, squad, groups[1], "", "", true, type))
t.timeout = 0
t.position_threshold = 100
t.predicate = function(obj_info) return obj_info.rank >= 900 end
table.insert(sj, t)


t = table.insert(sj, fill_tbl("bandit1_kamp", 0, 100, {1}, squad, groups[1], "", "", true, type))
t.timeout = 0
t.position_threshold = 100
t.predicate = function(obj_info) return obj_info.rank >= 900 end
table.insert(sj, t)

table.insert(sj, fill_tbl("bandit2_walker", 0, 5, {0}, squad, groups[1], "", "", true, type))
table.insert(sj, fill_tbl("bandit2_sleeper", 0, 5, {1}, squad, groups[1], "", "", true, type))
table.insert(sj, fill_tbl("bandit3_walker", 0, 5, {0, 1}, squad, groups[1], "", "", true, type))
end



- automatically change job for each npc/mutant -> function load_states(...)


[b]if type[/b] == "esc_bandits_smart_terrain" [b]then
  return function[/b](gulag)
    [b]if not[/b] db.actor [b]then
      return[/b] gulag.state
    [b]end
    if[/b] level.get_time_hours() >= 5 [b]and[/b] level.get_time_hours() <= 22 [b]then
      return[/b] 0  -- switch all mutants/npc to daily job
    [b]else
      return[/b] 1  -- switch all mutants/npc to nightly job
    [b]end
  end
end[/b]



- ensure that our ST will be used only by bandits -> function checkStalker(...)


[b]if[/b] gulag_type == "esc_bandits_smart_terrain" [b]then
  return[/b] npc_community == "bandit"
[b]end[/b]

  18:27:06  28 May 2008
profilee-mailreply Message URLTo the Top
Steelhawk92
Average Joe - Used to be Jamie1992
(Resident)

 

 
On forum: 03/16/2008
 

Message edited by:
Steelhawk92
05/28/2008 18:28:06
Messages: 5051
Wow barin this is just what i was after thanks alot man.

I think a sticky is in order
  18:29:37  28 May 2008
profilee-mailreply Message URLTo the Top
Don Reba
Bishop and Councilor of War
(Moderator)

 

 
On forum: 12/04/2002
Messages: 11661

---QUOTATION---
I think a sticky is in order
---END QUOTATION---


It is better to keep the wiki on the top, than attach every tutorial.
  18:33:45  28 May 2008
profilee-mailreply Message URLTo the Top
Steelhawk92
Average Joe - Used to be Jamie1992
(Resident)

 

 
On forum: 03/16/2008
Messages: 5051
Yeah but i cant see anything about smart terrains in the wiki.
  18:46:25  28 May 2008
profilee-mailreply Message URLTo the Top
Don Reba
Bishop and Councilor of War
(Moderator)

 

 
On forum: 12/04/2002
Messages: 11661

---QUOTATION---
Yeah but i cant see anything about smart terrains in the wiki.
---END QUOTATION---


Indeed.
  11:48:04  29 May 2008
profilee-mailreply Message URLTo the Top
FreeKiller
Senior Resident
 

 
On forum: 10/24/2007
Messages: 613
Thanks Barin,this is perfect
  12:37:19  29 May 2008
profilee-mailreply Message URLTo the Top
Claysoft'65
Modding ?... Why not !?
(Resident)

 

 
On forum: 01/31/2008
Messages: 369
Thx very much, Barin
  12:58:29  30 May 2008
profilee-mailreply Message URLTo the Top
Don Reba
Bishop and Councilor of War
(Moderator)

 

 
On forum: 12/04/2002
Messages: 11661

---QUOTATION---
Yeah but i cant see anything about smart terrains in the wiki.
Indeed.
---END QUOTATION---


Weird. You still chose not to add it.
  13:02:08  30 May 2008
profilee-mailreply Message URLTo the Top
Steelhawk92
Average Joe - Used to be Jamie1992
(Resident)

 

 
On forum: 03/16/2008
Messages: 5051
I dont know smart terrains like barin does althought i did make a thread yesterday and it told you how to make new factions taht bit was a edited version from the wiki and and also a long section on making new npc's which i made myself.

https://www.gsc-game.com/main.php?t=community&s=forums&s_game_type=xr&thm_page=1&thm_id=14721&sec_id=16

Thats my thread.
  13:16:14  30 May 2008
profilee-mailreply Message URLTo the Top
Don Reba
Bishop and Councilor of War
(Moderator)

 

 
On forum: 12/04/2002
Messages: 11661
I just find it strange that no one adds articles to the wiki, no matter what. Even Barin's post, on a topic not covered in it and apparently good enough to be a sticky. As if it was a boycott.
  12:03:44  31 May 2008
profilee-mailreply Message URLTo the Top
Steelhawk92
Average Joe - Used to be Jamie1992
(Resident)

 

 
On forum: 03/16/2008
Messages: 5051
Hmm well i dont know how to add things to wiki lol.
  16:31:58  31 May 2008
profilee-mailreply Message URLTo the Top
Don Reba
Bishop and Councilor of War
(Moderator)

 

 
On forum: 12/04/2002
Messages: 11661
The easiest way to creat a new page is to search for the title you want the page to have, then choose to "create this page".

http://img166.imageshack.us/img166/2097/createwikipageeq0.png
  17:59:39  1 July 2008
profilee-mailreply Message URLTo the Top
Don Reba
Bishop and Councilor of War
(Moderator)

 

 
On forum: 12/04/2002
Messages: 11661
http://sdk.stalker-game.com/en/index.php/Smart_Terrain_Tutorial
  18:02:37  1 July 2008
profilee-mailreply Message URLTo the Top
xRatx
Senior Resident
 

 
On forum: 06/18/2008
 

Message edited by:
xRatx
07/01/2008 18:25:33
Messages: 1592
Just asking...It's possible do it with Already Spawned NPC (Like Rookie Camp or Army Outpost in cordon , i mean with already NPC's in Game) ?
  02:27:19  2 July 2008
profilee-mailreply Message URLTo the Top
Starioshka Prokol
Tactical hedgehog of Duty
(Resident)

 

 
On forum: 02/27/2008
Messages: 511
what do that smart terrain should to do ?
sorry I've doesn't understand what it is.
really I doesn't care that scripts so much but just asking what does it means that smart terrain?
  02:37:33  2 July 2008
profilee-mailreply Message URLTo the Top
dezodor
level designer
(Resident)

 

 
On forum: 04/08/2007
Messages: 3803
its used for alife. npcs are getting tasks from smart terrains. (in the old stalker they got tasks from trader, but sometimes they ruined storyline if they reached levels faster then you)

so each smartie (npc camps mostly, fireplaces, or bases but 1 npc base can contain many more smart terrain, so npcs can switch between them, and do other things) in game has several points around it, and each has 1 task, job for npc. also each smart terrain has capacity, sometimes 3-4 or sometimes 5-10 or more place or "slot" for npcs.

some tasks like play guitar, eat, sit, or go somewhere... can be added to those wp-s. when a smart terrain is empty, mostly the respawn activates (if it has infoportion for that) and npcs appear again, and occupy the smart terrain.
  11:01:55  21 September 2010
profilee-mailreply Message URLTo the Top
atonium2027
(Senior)
 
On forum: 06/01/2009
Messages: 74
Hey Guys,
i got one question about the gulag scripts. I added some new level to the game and filled them up with monsters and smart terrains. I created the gulags (script & ltx incl. logics).
I added the gulag name to the xr_gulag.script but they are still not "gulaged". Any idea?
  14:09:38  21 September 2010
profilee-mailreply Message URLTo the Top
barin
scripter
(Resident)

 

 
On forum: 09/12/2007
Messages: 702

---QUOTATION---
Hey Guys,
i got one question about the gulag scripts. I added some new level to the game and filled them up with monsters and smart terrains. I created the gulags (script & ltx incl. logics).
I added the gulag name to the xr_gulag.script but they are still not "gulaged". Any idea?
---END QUOTATION---



Not much details, it can be pretty much anything. Make sure that you have edited scripts properly:

- xr_gulag.script -> level_gulags and level_groups
- smart_terrain.script -> level_groups
  16:49:54  21 September 2010
profilee-mailreply Message URLTo the Top
atonium2027
(Senior)
 
On forum: 06/01/2009
Messages: 74
Hm, it's still not working. With your smart terrain debug tool i see that the smarties are not used
  10:35:44  22 September 2010
profilee-mailreply Message URLTo the Top
atonium2027
(Senior)
 
On forum: 06/01/2009
Messages: 74
@ dezodor: Your are the first one who included new level with full alife and storyline. Any hint for me?
  10:56:43  23 September 2010
profilee-mailreply Message URLTo the Top
Robberbaron
Bangalore
(Resident)

 

 
On forum: 08/06/2009
 

Message edited by:
Robberbaron
09/23/2010 11:15:39
Messages: 614
@atonium
Did you included your new gulag_{newlevel}.ltx files in the gamedata\config\misc\gulag_tasks.ltx?

If you use general_lager and general_lair type smarties, in gamedata\config\misc folder:

- general_lager.ltx --> npc types for new levels
- general_lair.ltx --> monster types for new levels
- smart_terrain_presets.ltx --> npc/monster types for new levels
  09:48:13  24 September 2010
profilee-mailreply Message URLTo the Top
atonium2027
(Senior)
 
On forum: 06/01/2009
Messages: 74
Yes, i did it all and my monsters are not sticked to their smartie
When i'm back at home i have to check it all again.
  10:28:22  24 September 2010
profilee-mailreply Message URLTo the Top
Robberbaron
Bangalore
(Resident)

 

 
On forum: 08/06/2009
Messages: 614
Then it can be anything, maybe errors in your script and ltx files. Check your ltx files section names, or missed some "end" in scripts, use the LtxChecker and LuaChecker if you wanna be sure.

http://www.smart-mod-manager.org/other/LuaChecker-0.2.7z

http://www.smart-mod-manager.org/other/LtxChecker_0.6.7z
  10:12:49  27 September 2010
profilee-mailreply Message URLTo the Top
atonium2027
(Senior)
 
On forum: 06/01/2009
Messages: 74
I tested the scripts and ltx again, no error. Will upload it today for a look.
  15:53:45  3 October 2010
profilee-mailreply Message URLTo the Top
atonium2027
(Senior)
 
On forum: 06/01/2009
Messages: 74
Hey Guys, thats just my simple gulag wich crahs without log. Can anybody find the error?

local t = {}
function load_job( sj, gname, type, squad, groups )
if type == "marsh_boars1" then
t = { section = "logic@marsh_boars1",
idle = 0,
prior = 5, state = {0},
in_rest = "", out_rest = ""
}
table.insert(sj, t)
t = { section = "logic@marsh_boars1",
idle = 0,
prior = 5, state = {0},
in_rest = "", out_rest = ""
}
table.insert(sj, t)
t = { section = "logic@marsh_boars1",
idle = 0,
prior = 5, state = {0},
in_rest = "", out_rest = ""
}
table.insert(sj, t)
t = { section = "logic@marsh_boars1",
idle = 0,
prior = 5, state = {0},
in_rest = "", out_rest = ""
}
table.insert(sj, t)
t = { section = "logic@marsh_boars1",
idle = 0,
prior = 5, state = {0},
in_rest = "", out_rest = ""
}
table.insert(sj, t)
t = { section = "logic@marsh_boars1",
idle = 0,
prior = 5, state = {0},
in_rest = "", out_rest = ""
}
table.insert(sj, t)
t = { section = "logic@marsh_boars1",
idle = 0,
prior = 5, state = {0},
in_rest = "", out_rest = ""
}
table.insert(sj, t)
end

if type == "marsh_dogs1" then
t = { section = "logic@marsh_dogs1",
idle = 0,
prior = 5, state = {0},
in_rest = "", out_rest = ""
}
table.insert(sj, t)
t = { section = "logic@marsh_dogs1",
idle = 0,
prior = 5, state = {0},
in_rest = "", out_rest = ""
}
table.insert(sj, t)
t = { section = "logic@marsh_dogs1",
idle = 0,
prior = 5, state = {0},
in_rest = "", out_rest = ""
}
table.insert(sj, t)
t = { section = "logic@marsh_dogs1",
idle = 0,
prior = 5, state = {0},
in_rest = "", out_rest = ""
}
table.insert(sj, t)
t = { section = "logic@marsh_dogs1",
idle = 0,
prior = 5, state = {0},
in_rest = "", out_rest = ""
}
table.insert(sj, t)
t = { section = "logic@marsh_dogs1",
idle = 0,
prior = 5, state = {0},
in_rest = "", out_rest = ""
}
table.insert(sj, t)
t = { section = "logic@marsh_dogs1",
idle = 0,
prior = 5, state = {0},
in_rest = "", out_rest = ""
}
table.insert(sj, t)
t = { section = "logic@marsh_dogs1",
idle = 0,
prior = 5, state = {0},
in_rest = "", out_rest = ""
}
table.insert(sj, t)
t = { section = "logic@marsh_dogs1",
idle = 0,
prior = 5, state = {0},
in_rest = "", out_rest = ""
}
table.insert(sj, t)
t = { section = "logic@marsh_dogs1",
idle = 0,
prior = 5, state = {0},
in_rest = "", out_rest = ""
}
table.insert(sj, t)
t = { section = "logic@marsh_dogs1",
idle = 0,
prior = 5, state = {0},
in_rest = "", out_rest = ""
}
table.insert(sj, t)
t = { section = "logic@marsh_dogs1",
idle = 0,
prior = 5, state = {0},
in_rest = "", out_rest = ""
}
table.insert(sj, t)
end

if type == "marsh_rats1" then
t = { section = "logic@marsh_rats1",
idle = 0,
prior = 5, state = {0},
in_rest = "", out_rest = ""
}
table.insert(sj, t)
t = { section = "logic@marsh_rats1",
idle = 0,
prior = 5, state = {0},
in_rest = "", out_rest = ""
}
table.insert(sj, t)
t = { section = "logic@marsh_rats1",
idle = 0,
prior = 5, state = {0},
in_rest = "", out_rest = ""
}
table.insert(sj, t)
t = { section = "logic@marsh_rats1",
idle = 0,
prior = 5, state = {0},
in_rest = "", out_rest = ""
}
table.insert(sj, t)
t = { section = "logic@marsh_rats1",
idle = 0,
prior = 5, state = {0},
in_rest = "", out_rest = ""
}
table.insert(sj, t)
t = { section = "logic@marsh_rats1",
idle = 0,
prior = 5, state = {0},
in_rest = "", out_rest = ""
}
table.insert(sj, t)
t = { section = "logic@marsh_rats1",
idle = 0,
prior = 5, state = {0},
in_rest = "", out_rest = ""
}
table.insert(sj, t)
t = { section = "logic@marsh_rats1",
idle = 0,
prior = 5, state = {0},
in_rest = "", out_rest = ""
}
table.insert(sj, t)
t = { section = "logic@marsh_rats1",
idle = 0,
prior = 5, state = {0},
in_rest = "", out_rest = ""
}
table.insert(sj, t)
t = { section = "logic@marsh_rats1",
idle = 0,
prior = 5, state = {0},
in_rest = "", out_rest = ""
}
table.insert(sj, t)
t = { section = "logic@marsh_rats1",
idle = 0,
prior = 5, state = {0},
in_rest = "", out_rest = ""
}
table.insert(sj, t)
t = { section = "logic@marsh_rats1",
idle = 0,
prior = 5, state = {0},
in_rest = "", out_rest = ""
}
table.insert(sj, t)
t = { section = "logic@marsh_rats1",
idle = 0,
prior = 5, state = {0},
in_rest = "", out_rest = ""
}
table.insert(sj, t)
end
end

function load_states( gname, type )
if type == "marsh_boars1" then
return function(gulag)
return 0
end
end

if type == "marsh_dogs1" then
return function(gulag)
return 0
end
end

if type == "marsh_rats1" then
return function(gulag)
return 0
end
end
if type == "marsh_flesh1" then
return function(gulag)
return 0
end
end
end

--------------------------------------------------------------------------
-- Dynamic ltx
--------------------------------------------------------------------------
function load_ltx(gname, type)
return nil
end

function checkStalker(npc_community, gulag_type, npc_rank, se_obj)
end

function checkMonster(npc_community, gulag_type)
if gulag_type == "marsh_boars1" then
return npc_community == "boar" or
npc_community == "flesh" or
npc_community == "dog"
end

if gulag_type == "marsh_dogs1" then
return npc_community == "dog" or
npc_community == "flesh" or
npc_community == "boar"
end

if gulag_type == "marsh_rats1" then
return npc_community == "tushkano" or
npc_community == "flesh" or
npc_community == "dog"
end
if gulag_type == "marsh_flesh1" then
return npc_community == "flesh" or
npc_community == "tushkano" or
npc_community == "dog"
end
return false
end
  16:22:52  3 October 2010
profilee-mailreply Message URLTo the Top
barin
scripter
(Resident)

 

 
On forum: 09/12/2007
 

Message edited by:
barin
10/03/2010 16:25:22
Messages: 702
Make sure that every entity has its own job - section should be unique for every entity in the same smart terrain, otherwise several entities will try to perform the same job which can lead to CTD


function load_job(sj, gname, type, squad, groups)
  local t = {}
  if type == "marsh_boars1" then
    t = { section = "logic@marsh_boars1_1", -- 1st boar
      idle = 0, prior = 5, state = {0},
      squad = squad, group = groups[1],
      in_rest = "", out_rest = ""
    }
    table.insert(sj, t)
    t = { section = "logic@marsh_boars1_2", -- 2nd boar
      idle = 0, prior = 5, state = {0},
      squad = squad, group = groups[1],
      in_rest = "", out_rest = ""
    }
    table.insert(sj, t)

    ...

    t = { section = "logic@marsh_boars1_nth", -- nth boar
      idle = 0, prior = 5, state = {0},
      squad = squad, group = groups[1],
      in_rest = "", out_rest = ""
    }
    table.insert(sj, t)
  end
end

function checkStalker(npc_community, gulag_type, npc_rank, se_obj)
  return false -- should return boolean value
end

-- in gulag_marsh.ltx (jobs for marsh smart terrains)
-- marsh_boars1 smart terrain

[logic@marsh_boars1_1] ;-- 1st boar
active = mob_home@marsh_boars1_1

[mob_home@marsh_boars1_1] ;-- 1st boar job
...

[logic@marsh_boars1_2] ;-- 2st boar
active = mob_home@marsh_boars1_2

[mob_home@marsh_boars1_1] ;-- 2nd boar job
...

...

[logic@marsh_boars1_nth] ;-- nth boar
active = mob_home@marsh_boars1_nth

[mob_home@marsh_boars1_nth] ;-- nth boar job
...

  16:53:14  3 October 2010
profilee-mailreply Message URLTo the Top
atonium2027
(Senior)
 
On forum: 06/01/2009
Messages: 74
Kay Thank, i'll check it!
  11:02:31  6 October 2010
profilee-mailreply Message URLTo the Top
atonium2027
(Senior)
 
On forum: 06/01/2009
Messages: 74
Seems that every Monster needs its own waypoint in the smartie...
Some knows how GSC could compile their level with buggy Ai maps?
I cant compile any AI on normal settings (draft works), do i have to fix in kordon 140 invalid conencted AI patches?
  11:13:40  6 October 2010
profilee-mailreply Message URLTo the Top
Robberbaron
Bangalore
(Resident)

 

 
On forum: 08/06/2009
 

Message edited by:
Robberbaron
10/06/2010 11:29:32
Messages: 614
Nope, I checked all vanilla map, and all have valid ai map. What you see is 140 not connected neighbouring ai node, but its not so important, apart from this, the ai map is valid. You dont have to fix it. I never had problems with compiling cordon or any vanilla ai map, although I dont understand, why left GSC in the game unconnected ai nodes...

edit:
you dont have to recompile ai maps, if you just want to add some extra waypoints...
in level editor Compile --> Make game, and make a new all.spawn with xrAI, thats it
  12:43:25  6 October 2010
profilee-mailreply Message URLTo the Top
atonium2027
(Senior)
 
On forum: 06/01/2009
Messages: 74
The crashin' AI compiler and the f*cking gulags are two different problems i have. I want to build a new AI Map for Kordon cause i connected level to it. But my xrAI.exe crashs
Could u upload your version of the compiler, i wonna compare it with mine. Maybe its a buggy version i have.
  13:30:15  6 October 2010
profilee-mailreply Message URLTo the Top
Robberbaron
Bangalore
(Resident)

 

 
On forum: 08/06/2009
Messages: 614
http://stalkerin.gameru.net/modules.php?name=Downloads&d_op=getit&lid=376
  11:27:27  7 October 2010
profilee-mailreply Message URLTo the Top
atonium2027
(Senior)
 
On forum: 06/01/2009
 

Message edited by:
atonium2027
10/07/2010 11:38:18
Messages: 74
So, i got this crash log:
LUA error: ...w of chernobyl\gamedata\scripts\smart_terrain.script:752: C stack overflow

Now i really dont know how to continue
I created all necessary files and made the gulags, i made for every mutant one waypoint... Could andybody check the script pls?

Btw: All smarties i creates in kordon work fine...

My gulag script

---QUOTATION---

local t = {}
function load_job( sj, gname, type, squad, groups )
if type == "marsh_boars1" then
t = { section = "logic@marsh_boars1_1",
idle = 0,
prior = 5, state = {0},
in_rest = "", out_rest = ""
}
table.insert(sj, t)
t = { section = "logic@marsh_boars1_2",
idle = 0,
prior = 5, state = {0},
in_rest = "", out_rest = ""
}
table.insert(sj, t)
t = { section = "logic@marsh_boars1_3",
idle = 0,
prior = 5, state = {0},
in_rest = "", out_rest = ""
}
table.insert(sj, t)
t = { section = "logic@marsh_boars1_4",
idle = 0,
prior = 5, state = {0},
in_rest = "", out_rest = ""
}
table.insert(sj, t)
end

if type == "marsh_dogs1" then
t = { section = "logic@marsh_dogs1_1",
idle = 0,
prior = 5, state = {0},
in_rest = "", out_rest = ""
}
table.insert(sj, t)
t = { section = "logic@marsh_dogs1_2",
idle = 0,
prior = 5, state = {0},
in_rest = "", out_rest = ""
}
table.insert(sj, t)
t = { section = "logic@marsh_dogs1_3",
idle = 0,
prior = 5, state = {0},
in_rest = "", out_rest = ""
}
table.insert(sj, t)
t = { section = "logic@marsh_dogs1_4",
idle = 0,
prior = 5, state = {0},
in_rest = "", out_rest = ""
}
table.insert(sj, t)
t = { section = "logic@marsh_dogs1_5",
idle = 0,
prior = 5, state = {0},
in_rest = "", out_rest = ""
}
table.insert(sj, t)
t = { section = "logic@marsh_dogs1_6",
idle = 0,
prior = 5, state = {0},
in_rest = "", out_rest = ""
}
table.insert(sj, t)
end

if type == "marsh_rats1" then
t = { section = "logic@marsh_rats1_1",
idle = 0,
prior = 5, state = {0},
in_rest = "", out_rest = ""
}
table.insert(sj, t)
t = { section = "logic@marsh_rats1_2",
idle = 0,
prior = 5, state = {0},
in_rest = "", out_rest = ""
}
table.insert(sj, t)
t = { section = "logic@marsh_rats1_3",
idle = 0,
prior = 5, state = {0},
in_rest = "", out_rest = ""
}
table.insert(sj, t)
t = { section = "logic@marsh_rats1_4",
idle = 0,
prior = 5, state = {0},
in_rest = "", out_rest = ""
}
table.insert(sj, t)
t = { section = "logic@marsh_rats1_5",
idle = 0,
prior = 5, state = {0},
in_rest = "", out_rest = ""
}
table.insert(sj, t)
t = { section = "logic@marsh_rats1_6",
idle = 0,
prior = 5, state = {0},
in_rest = "", out_rest = ""
}
table.insert(sj, t)
t = { section = "logic@marsh_rats1_7",
idle = 0,
prior = 5, state = {0},
in_rest = "", out_rest = ""
}
table.insert(sj, t)
end

if type == "marsh_flesh1" then
t = { section = "logic@marsh_flesh1_1",
idle = 0,
prior = 5, state = {0},
in_rest = "", out_rest = ""
}
table.insert(sj, t)
t = { section = "logic@marsh_flesh1_2",
idle = 0,
prior = 5, state = {0},
in_rest = "", out_rest = ""
}
table.insert(sj, t)
t = { section = "logic@marsh_flesh1_3",
idle = 0,
prior = 5, state = {0},
in_rest = "", out_rest = ""
}
table.insert(sj, t)
t = { section = "logic@marsh_flesh1_4",
idle = 0,
prior = 5, state = {0},
in_rest = "", out_rest = ""
}
table.insert(sj, t)
end
end

function load_states( gname, type )
if type == "marsh_boars1" then
return function(gulag)
return 0
end
end

if type == "marsh_dogs1" then
return function(gulag)
return 0
end
end

if type == "marsh_rats1" then
return function(gulag)
return 0
end
end
if type == "marsh_flesh1" then
return function(gulag)
return 0
end
end
end

--------------------------------------------------------------------------
-- Dynamic ltx
--------------------------------------------------------------------------
function load_ltx(gname, type)
return nil
end

function checkStalker(npc_community, gulag_type, npc_rank, se_obj)
end

function checkMonster(npc_community, gulag_type)
if gulag_type == "marsh_boars1" then
return npc_community == "boar" or
npc_community == "flesh" or
npc_community == "dog"
end

if gulag_type == "marsh_dogs1" then
return npc_community == "dog" or
npc_community == "flesh" or
npc_community == "boar"
end

if gulag_type == "marsh_rats1" then
return npc_community == "tushkano" or
npc_community == "flesh" or
npc_community == "dog"
end
if gulag_type == "marsh_flesh1" then
return npc_community == "flesh" or
npc_community == "tushkano" or
npc_community == "dog"
end
return false
end

---END QUOTATION---



my gulag ltx

---QUOTATION---

;---------------------------------------------
[logic@marsh_rats1_1]
active = mob_home@marsh_rats1_1

[mob_home@marsh_rats1_1]
path_home = path1
home_min_radius = 1
home_max_radius = 4

[logic@marsh_rats1_2]
active = mob_home@marsh_rats1_2

[mob_home@marsh_rats1_2]
path_home = path2
home_min_radius = 1
home_max_radius = 4

[logic@marsh_rats1_3]
active = mob_home@marsh_rats1_3

[mob_home@marsh_rats1_3]
path_home = path3
home_min_radius = 1
home_max_radius = 4

[logic@marsh_rats1_4]
active = mob_home@marsh_rats1_4

[mob_home@marsh_rats1_4]
path_home = path4
home_min_radius = 1
home_max_radius = 4

[logic@marsh_rats1_5]
active = mob_home@marsh_rats1_5

[mob_home@marsh_rats1_5]
path_home = path5
home_min_radius = 1
home_max_radius = 4

[logic@marsh_rats1_6]
active = mob_home@marsh_rats1_6

[mob_home@marsh_rats1_6]
path_home = path6
home_min_radius = 1
home_max_radius = 4

[logic@marsh_rats1_7]
active = mob_home@marsh_rats1_7

[mob_home@marsh_rats1_7]
path_home = path7
home_min_radius = 1
home_max_radius = 4

;---------------------------------------------
[logic@marsh_boars1_1]
active = mob_home@marsh_boars1_1

[mob_home@marsh_boars1_1]
path_home = path1
home_min_radius = 2
home_max_radius = 6

[logic@marsh_boars1_2]
active = mob_home@marsh_boars1_2

[mob_home@marsh_boars1_2]
path_home = path2
home_min_radius = 2
home_max_radius = 6

[logic@marsh_boars1_3]
active = mob_home@marsh_boars1_3

[mob_home@marsh_boars1_3]
path_home = path3
home_min_radius = 2
home_max_radius = 6

[logic@marsh_boars1_4]
active = mob_home@marsh_boars1_4

[mob_home@marsh_boars1_4]
path_home = path4
home_min_radius = 2
home_max_radius = 6

;---------------------------------------------
[logic@marsh_dogs1_1]
active = mob_home@marsh_dogs1_1

[mob_home@marsh_dogs1_1]
path_home = path1
home_min_radius = 3
home_max_radius = 10

[logic@marsh_dogs1_2]
active = mob_home@marsh_dogs1_2

[mob_home@marsh_dogs1_2]
path_home = path2
home_min_radius = 3
home_max_radius = 10

[logic@marsh_dogs1_3]
active = mob_home@marsh_dogs1_3

[mob_home@marsh_dogs1_3]
path_home = path3
home_min_radius = 3
home_max_radius = 10

[logic@marsh_dogs1_4]
active = mob_home@marsh_dogs1_4

[mob_home@marsh_dogs1_4]
path_home = path4
home_min_radius = 3
home_max_radius = 10

[logic@marsh_dogs1_5]
active = mob_home@marsh_dogs1_5

[mob_home@marsh_dogs1_5]
path_home = path5
home_min_radius = 3
home_max_radius = 10

[logic@marsh_dogs1_6]
active = mob_home@marsh_dogs1_6

[mob_home@marsh_dogs1_6]
path_home = path6
home_min_radius = 3
home_max_radius = 10

;---------------------------------------------
[logic@marsh_flesh1_1]
active = mob_home@marsh_flesh1_1

[mob_home@marsh_flesh1_1]
path_home = path1
home_min_radius = 3
home_max_radius = 8

[logic@marsh_flesh1_2]
active = mob_home@marsh_flesh1_2

[mob_home@marsh_flesh1_2]
path_home = path2
home_min_radius = 3
home_max_radius = 8

[logic@marsh_flesh1_3]
active = mob_home@marsh_flesh1_3

[mob_home@marsh_flesh1_3]
path_home = path3
home_min_radius = 3
home_max_radius = 8

[logic@marsh_flesh1_4]
active = mob_home@marsh_flesh1_4

[mob_home@marsh_flesh1_4]
path_home = path4
home_min_radius = 3
home_max_radius = 8

---END QUOTATION---

  20:28:48  18 January 2011
profilee-mailreply Message URLTo the Top
crucifist
(Senior)
 
On forum: 12/14/2009
Messages: 105
Mmmh, I have a question: I havre created a smart terrain:


[9087]
; cse_abstract properties
section_name = smart_terrain
name = smart_generator_snork
position = 16.214975357056,25.985639572144,-131.96838378906
direction = 0.43683072924614,-0.102052226662636,0.237491175532341

; cse_alife_object properties
game_vertex_id = 3072
distance = 36.3999977111816
level_vertex_id = 332383
object_flags = 0xffffffbe
custom_data = <<END
[smart_terrain]
type = smart_generator_snork
capacity = 3
squad = 8
groups = 5

END

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

; cse_alife_space_restrictor properties
restrictor_type = 0

; se_smart_terrain properties



I can see it in game using the tool from dez0wave. The problem is that its state is on "not working".

I have also created snorks to spawn in (with their points in waypoint.ltx).

What is wrong?
  19:14:11  22 January 2011
profilee-mailreply Message URLTo the Top
Vintar
a bit of this and a lot of that
(Resident)

 

 
On forum: 08/08/2008
Messages: 6349
Have you added to gulag.script or gulag.ltx and added smart terrain name to mutants logic?
  19:34:22  22 January 2011
profilee-mailreply Message URLTo the Top
crucifist
(Senior)
 
On forum: 12/14/2009
 

Message edited by:
crucifist
01/22/2011 19:36:26
Messages: 105

---QUOTATION---
Have you added to gulag.script or gulag.ltx and added smart terrain name to mutants logic?
---END QUOTATION---



Mmmh, yep I have added to gulag.script and gulag.ltx. I'm not sure for smart terrain name in mutants logic. I don't have my computer for the moment.

In fact I forgot to tell something: I add smart terrain in Generator (from the OSLR wich I try to modify). In the all.spawn there are no smart terrain.

I think my problem comes from the call of the gulag script. In fact it isn't called at all.

I have done several tests with NPC, and in the log file I can see that they spawn because of the destruction of the object when I close the game.

I tried, just to see, to add my gulag script in gulag_escape.script, but it doesn't work.

I actually try to understant how new_gulag.script is called in NS to do the same. But I ask myself if I have to modify the file level.spawn. If I have to, I don't know how to proceed. I just know that I need the SDK, but I haven't find a lot of information about it.

From memory, gulag_****.script is called by only two others scripts. I can't remember wich ones.

I use agent_ransack to search in the gamedata directory, I don't know if it's a good way to proceed.

Sorry for my bad english, I know it's hard to read it ...
  19:42:29  22 January 2011
profilee-mailreply Message URLTo the Top
Vintar
a bit of this and a lot of that
(Resident)

 

 
On forum: 08/08/2008
Messages: 6349
Xr_gulag is one.
  19:51:50  22 January 2011
profilee-mailreply Message URLTo the Top
crucifist
(Senior)
 
On forum: 12/14/2009
 

Message edited by:
crucifist
01/22/2011 19:58:39
Messages: 105
Do you think to those lines:


level_groups = {l01_escape = 1, l02_garbage = 2, l03_agroprom = 3, l03u_agr_underground = 4,
                l04_darkvalley = 5, l04u_labx18 = 6, l05_bar = 7, l06_rostok = 8,
                l07_military = 9, l08_yantar = 10, l08u_brainlab = 11, l10_radar = 12,
                l10u_bunker = 13, l11_pripyat = 14, l12_stancia = 15, l12u_sarcofag = 16, 
                l12u_control_monolith = 17, l12_stancia_2 = 18, l09_deadcity = 19, 
				l10u_secret_lab = 20, l13_generators = 21, l13u_warlab = 22}



As you can see, Generators is in.

EDIT: I'm not on my computer, so I don't have my modified files.
  10:44:58  24 January 2011
profilee-mailreply Message URLTo the Top
crucifist
(Senior)
 
On forum: 12/14/2009
 

Message edited by:
crucifist
01/24/2011 12:38:56
Messages: 105
Here's my scripts and config files:

(I test with a monolith)
alife_l13_generators.ltx


[9087]
; cse_abstract properties
section_name = smart_terrain
name = smart_generators_monolith
position = 16.214975357056,25.985639572144,-131.96838378906
direction = 0.43683072924614,-0.102052226662636,0.237491175532341

; cse_alife_object properties
game_vertex_id = 3072
distance = 10.3999977111816
level_vertex_id = 332383
object_flags = 0xffffffbe
offline = false
custom_data = <<END
[smart_terrain]
type = smart_generators_monolith
capacity = 1
;squad = 8
;groups = 5

END

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

; cse_alife_space_restrictor properties
restrictor_type = 0

; se_smart_terrain properties

[9088]
; cse_abstract properties
section_name = stalker
name = gen_monolit_stalker_0
position = 15.214975357056,25.985639572144,-131.96838378906
direction = 0,0,0

; cse_alife_trader_abstract properties
money = 5000
character_profile = sim_monolith_master

; cse_alife_object properties
game_vertex_id = 3073
distance = 5
level_vertex_id = 332383
object_flags = 0xfffffffb
custom_data = <<END
[smart_terrains]
smart_generators_monolith = true


END
; cse_visual properties
visual_name = actors\monolit\stalker_mo_exo

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

upd:health = 1
upd:timestamp = 0
upd:creature_flags = 0
upd:position = 173.932769775391,30.8514213562012,-478.011291503906
upd:o_model = 0
upd:o_torso = 0,0,0
upd:g_team = 0
upd:g_squad = 0
upd:g_group = 1

; 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_alife_human_abstract properties
predicate5 = 2,2,2,1,0
predicate4 = 1,2,1,2

; cse_ph_skeleton properties

upd:start_dialog = 

; se_stalker properties



way_l13_generators.ltx


[path_monolith0]
points = p0
p0:name = wp00|sig=path_end
p0:position = 16.214975357056,25.985639572144,-131.96838378906
p0:game_vertex_id = 3076 
p0:level_vertex_id = 332383 




config/misc/gulag_generators:


[logic@smart_generators_monolith0_walker]
active = walker@smart_generators_monolith0
 
[walker@smart_generators_monolith0]
path_walk         = path_monolith0

[path_monolith0]

points = p0
p0:name = wp00|sig=path_end
p0: position = 6.214975357056,25.985639572144,-131.96838378906
on_signal = path_end | nil



scripts/gulag_generators (quite simple, but it's a test):


local t = {}

function load_job(sj, gname, type, squad, groups)
if type == "smart_generators_monolith0_walker" then

get_console():execute("starting")

	t = {}
	t.section = "logic@smart_generators_monolith0"
	t.idle = 0
	;-- no idea but i guess it's optional
	t.timeout = 0
	;-- priority
	t.prior = 100
	t.state = {0, 1, 2}
	t.squad = squad
	t.group = groups[1]
	t.position_threshold = 100
	t.online = true
	t.in_rest = ""
	t.out_rest = ""
	table.insert(sj, t)
	
 get_console():execute("end_of_function")

function load_ltx(gname, type)
		get_console():execute("loading_ltx_generator")
	return nil
end


function load_states(gname, type)
	get_console():execute("loading_state_generators")
	if type == "smart_generators_monolith0_walker" then
	get_console():execute("loading_functioon_load_jobs")
		return function(gulag)
			if not db.actor then
				return gulag.state
			end
			if level.get_time_hours() >= 5 and level.get_time_hours() <= 22 then
				return 0  -- switch all mutants/npc to daily job
			else
				return 1  -- switch all mutants/npc to nightly job
			end
		end
	end
	
function checkStalker(npc_community, gulag_type, npc_rank, se_obj)
	get_console():execute("check_stalker")
	if gulag_type == "smart_generators_monolith" then
	return npc_community == "monolith"
end
 
end





config/smart_terrain_presets.ltx:

[l13_generators]
monolith	= novice, experienced, veteran, master



config/misc/general_lager:


[l13_generators]
monolith	= novice, experienced, veteran, master



In the log, I can see:


sv reject. id_parent [17856][stalker:gen_monolit_stalker_0] id_entity [17957][bolt:bolt] [23886]
sv reject. id_parent [17856][stalker:gen_monolit_stalker_0] id_entity [17863][wpn_walther:wpn_walther17863] [23886]
sv reject. id_parent [17856][stalker:gen_monolit_stalker_0] id_entity [17862][wpn_g36:wpn_g3617862] [23886]
sv reject. id_parent [17856][stalker:gen_monolit_stalker_0] id_entity [17861][kolbasa:kolbasa17861] [23886]
sv reject. id_parent [17856][stalker:gen_monolit_stalker_0] id_entity [17860][bandage:bandage17860] [23886]
sv reject. id_parent [17856][stalker:gen_monolit_stalker_0] id_entity [17859][ammo_9x19_fmj:ammo_9x19_fmj17859] [23886]
sv reject. id_parent [17856][stalker:gen_monolit_stalker_0] id_entity [17858][ammo_5.56x45_ap:ammo_5.56x45_ap17858] [23886]
sv reject. id_parent [17856][stalker:gen_monolit_stalker_0] id_entity [17857][device_pda:device_pda17857] [23886]



My xr_gulag is like the one I have posted.
  14:29:18  24 January 2011
profilee-mailreply Message URLTo the Top
Vintar
a bit of this and a lot of that
(Resident)

 

 
On forum: 08/08/2008
Messages: 6349
Two problems I noticed straight away :

1) there are two "end" statements missing in your load_job function.

2) in your gulag.ltx file, there is no need for the section :
[path_monolith0]

points = p0
p0:name = wp00|sig=path_end
p0: position = 6.214975357056,25.985639572144,-131.96838378906
on_signal = path_end | nil



Just add the line "on_signal = path_end | nil" to the [walker@smart_generators_monolith0] section under "path_walk" line.

and the statment on_signal = path_end| nil does nothing anyway and is probably not needed as when the NPC reaches the end of the path, he will just stand there anyhow.
  14:58:32  24 January 2011
profilee-mailreply Message URLTo the Top
crucifist
(Senior)
 
On forum: 12/14/2009
 

Message edited by:
crucifist
01/24/2011 15:06:00
Messages: 105
Thanks, once again you solve my problem. I should build a statue of you and pray it everyday :-\
  15:04:19  24 January 2011
profilee-mailreply Message URLTo the Top
Vintar
a bit of this and a lot of that
(Resident)

 

 
On forum: 08/08/2008
Messages: 6349

---QUOTATION---
Thanks, once again you solve my problem. I should build a statue of you and pray it every day :-\
---END QUOTATION---



No problem, it is what we are all here for

I have recently discovered that it is so much easier done via SDK, but I`m sure Barin wouldnt agree there
  15:16:17  24 January 2011
profilee-mailreply Message URLTo the Top
Lijenstina
Doom metal in the shade of the flying radiators
(Resident)

 

 
On forum: 07/23/2005
 

Message edited by:
Lijenstina
01/24/2011 15:20:54
Messages: 1902
First of all read this :

http://sdk.stalker-game.com/en/index.php?title=Logic

If you are making a gulag then in the walk and look path sections of the all.spawn need to be called with a name of the gulag first on which the name in the ltx is concatenated later.

http://sdk.stalker-game.com/en/index.php?title=Logic#Gulags

Here settings correspond to regular stalker custom data, with the following difference:
  paths should be specified without a prefix. 
THat is, if the zone was called gar_maniac, a path on the level might be called 
gar_maniac_walk1, 
but gamedata\config\misc\gulag_<level name>.ltx should be specified as simply walk1.



Should be :
way_l13_generators.ltx

[smart_generators_monolith_path_monolith0]
points = p0
p0:name = wp00|sig=path_end
p0:position = 16.214975357056,25.985639572144,-131.96838378906
p0:game_vertex_id = 3076 
p0:level_vertex_id = 332383 



Also before making a logic that will be used in a gulag take a look on the logic tutorial on the wiki and by examining gulag.ltx-ses from vanilla. That part was wrong too like Vintar has already pointed it out.

The part in the ltx .
on_signal = path_end | nil will release the npc from the current logic.
  15:27:57  24 January 2011
profilee-mailreply Message URLTo the Top
Vintar
a bit of this and a lot of that
(Resident)

 

 
On forum: 08/08/2008
Messages: 6349

---QUOTATION---
Should be :
way_l13_generators.ltx

[smart_generators_monolith_path_monolith0]
points = p0
p0:name = wp00|sig=path_end
p0:position = 16.214975357056,25.985639572144,-131.96838378906
p0:game_vertex_id = 3076 
p0:level_vertex_id = 332383 


---END QUOTATION---


Nice catch, I missed that.


---QUOTATION---
The part in the ltx .
on_signal = path_end | nil will release the npc from the current logic.
---END QUOTATION---


We learn something new each day
  15:35:28  24 January 2011
profilee-mailreply Message URLTo the Top
crucifist
(Senior)
 
On forum: 12/14/2009
 

Message edited by:
crucifist
01/24/2011 16:06:48
Messages: 105
@Lijenstinaj: In fact I have already read the logic tutorial. I have done some tests without gulags. But when I mix gulags/logic/spawn I'm quickly lost.

I'm going to correct my errors following your concils
  19:45:02  25 January 2011
profilee-mailreply Message URLTo the Top
crucifist
(Senior)
 
On forum: 12/14/2009
 

Message edited by:
crucifist
01/25/2011 19:56:26
Messages: 105
(let me know if I disturb the forum "upping" this topic)

More and more problems ....


Well, know my function load_job() is correctly executed, like load_ltx(), checkStalker(), checkMonster().

But, the function load_state isn't executed at all. Here it is:


function load_states(gname, type)
	get_console():execute("load_state_starting")
	if type == "smart_generators_monolith" then
		get_console():execute("load_state_condition")
		return function(gulag)
			if not db.actor then
				return gulag.state
			end
			if level.get_time_hours() >= 5 and level.get_time_hours() <= 22 then
				get_console():execute("state_0")
				return 
			else
				get_console():execute("state_1")
				return 1 		
			end	
		end
	end	
end



I have checked the script with luachecker, nothing seems wrong about the syntax.

to Lijenstina :I haven't changed my logic becauce I didn't understand what you mean by :


"If you are making a gulag then in the walk and look path sections of the all.spawn need to be called with a name of the gulag first on which the name in the ltx is concatenated later."



You mean that the name of the gulag is concatenated wtih the logic?

I have changed my waypoint.ltx as you mentionned.

The problem could come from my logic I guess?

I have to add that the game craches during the blowout (I suppose it's due to a changement of state related to the blowout). The error is:


FATAL ERROR
 
[error]Expression    : fatal error
[error]Function      : CScriptEngine::lua_error
[error]File          : E:\stalker\sources\trunk\xr_3da\xrGame\script_engine.cpp
[error]Line          : 73
[error]Description   : <no expression>
[error]Arguments     : LUA error: ...hadow of chernobyl\gamedata\scripts\state_mgr.script:145: C stack overflow
 

stack trace:

Scheduler tried to update object gen_monolit_stalker_0000
 
FATAL ERROR
 
[error]Expression    : fatal error
[error]Function      : CScriptEngine::lua_error
[error]File          : E:\stalker\sources\trunk\xr_3da\xrGame\script_engine.cpp
[error]Line          : 73
[error]Description   : <no expression>
[error]Arguments     : LUA error: ...ow of chernobyl\gamedata\scripts\xr_motivator.script:221: C stack overflow
 

stack trace:

Scheduler tried to update object gen_monolit_stalker_0001
 
FATAL ERROR
 
[error]Expression    : fatal error
[error]Function      : CScriptEngine::lua_error
[error]File          : E:\stalker\sources\trunk\xr_3da\xrGame\script_engine.cpp
[error]Line          : 73
[error]Description   : <no expression>
[error]Arguments     : LUA error: ...ow of chernobyl\gamedata\scripts\bind_stalker.script:237: C stack overflow
 

stack trace:



If you need to see the others scripts, let me know I will update my post.

Once again, let me know if you think that I "spam" the forum, and I won't do it anymore.

EDIT: without smart terrain, blowouts work fine.
EDIT2: Vintar, the SDK generates "dirty code"?
  20:13:54  25 January 2011
profilee-mailreply Message URLTo the Top
gannebamm
has abondened XRay and uses Unity3D now
(Resident)

 

 
On forum: 05/02/2007
Messages: 1077
"C STACK OVERFLOW"
gives you the hint that some condition or check is repeatedly called so your memory gets overflowed.

I would try the gulag with simpliest logic and conditions first to check if the static stuff is working correctly (smart, waypoints, file assignements, ...).
If this is working try to get all jobs for state 1 running flawlessly.
If that is working try to implement the second state.
  20:27:22  25 January 2011
profilee-mailreply Message URLTo the Top
crucifist
(Senior)
 
On forum: 12/14/2009
 

Message edited by:
crucifist
01/25/2011 20:47:35
Messages: 105

---QUOTATION---
"C STACK OVERFLOW"
gives you the hint that some condition or check is repeatedly called so your memory gets overflowed.

I would try the gulag with simpliest logic and conditions first to check if the static stuff is working correctly (smart, waypoints, file assignements, ...).
If this is working try to get all jobs for state 1 running flawlessly.
If that is working try to implement the second state.
---END QUOTATION---



The last functiont executed is checkStalker(). In fact checkStalker and checkMonster are called many times.

I'm going to simplify my scripts and logics.
  08:49:39  26 January 2011
profilee-mailreply Message URLTo the Top
Vintar
a bit of this and a lot of that
(Resident)

 

 
On forum: 08/08/2008
Messages: 6349
In load states you never wrote " return 0" instead you wrote just "return" this will cause problems.
As for the confusing concatenation stuff, let me try explain more.
If your smart terrain is called "test_terrain" then in your way_***.ltx (and SDK for that matter) you will enter your path names which must start with your smart terrain name eg: "test_terrain_bandit_one"
however, in the gulag_***.ltx when you write : "path_walk =" here you will simply write the path name without the smart terrain name ie: "bandit_one"
  12:35:58  26 January 2011
profilee-mailreply Message URLTo the Top
crucifist
(Senior)
 
On forum: 12/14/2009
Messages: 105

---QUOTATION---
In load states you never wrote " return 0" instead you wrote just "return" this will cause problems.
As for the confusing concatenation stuff, let me try explain more.
If your smart terrain is called "test_terrain" then in your way_***.ltx (and SDK for that matter) you will enter your path names which must start with your smart terrain name eg: "test_terrain_bandit_one"
however, in the gulag_***.ltx when you write : "path_walk =" here you will simply write the path name without the smart terrain name ie: "bandit_one"
---END QUOTATION---



The problem was the name of the path ... Once again, thanks everyone.
My NPC isn't spawned but the smart terrain is working!
  00:27:25  4 April 2013
profilee-mailreply Message URLTo the Top
insanelazarez
Yeah, Good Luck With That...
(Resident)

 

 
On forum: 01/31/2009
Messages: 1070

---QUOTATION---
And another thing, i'm sick when i have to fill so many tables, so i usually use this function:


function fill_tbl(section, idle, prior, states, squad, group, in_rest, out_rest, online, gulag_name)
local tbl = {}

tbl.section = "logic@" .. gulag_name .. "_" .. section
tbl.idle = idle
tbl.prior = prior
tbl.state = {}

for index = 1, #states do
table.insert(tbl.state, states[index])
end

tbl.squad = squad
tbl.group = group
tbl.in_rest = in_rest
tbl.out_rest = out_rest
tbl.online = online
return tbl
end
---END QUOTATION---




Ok, this seems cool... wait, but this specific code is added where? This one confuses me. Please Master Barin, show me your magic...

Thank you in advance.
 
Each word should be at least 3 characters long.
Search:    
Search conditions:    - spaces as AND    - spaces as OR   
 
Forum Index » S.T.A.L.K.E.R.: Shadow of Chernobyl Forum » Mod discussion
 

All short dates are in Month-Day-Year format.


 

Copyright © 1995-2020 GSC Game World. All rights reserved.
This site is best viewed in Internet Explorer 4.xx and up and Javascript enabled. Webmaster.
Opera Software products are not supported.
If any problem concerning the site functioning under Opera Software appears apply
to Opera Software technical support service.