Editing all.spawn

From Mod Wiki

Revision as of 18:08, 11 July 2008 by Gr1ph00n (Talk | contribs)
Jump to: navigation, search

all.spawn is a rather big file in the S.T.A.L.K.E.R. gamedata\spawns directory. It contains information about NPCs, monsters, objects, basically anything that is not static level geometry in STALKER. The files is loaded once at game start and it's information is stored in the save-game. That means: Editing the all.spawn requires to start a new game afterwards!

Contents


Setting up all.spawn workspace

Before you can start, you need to download a little tool - acdc.pl created by bardak - that opens the all.spawn for you. Follow these steps after you have downloaded the file:

  1. Open the downloaded archive and extract the content
  2. Rename the .pl file to acdc.pl, if it's not already the case
  3. Copy the all.spawn from gamedata\spawns into the folder with the acdc.pl
  4. Create a .txt file, open it, copy this string into it perl acdc.pl -d all.spawn then save and close it
  5. Rename the .txt to decompile.bat
  6. Create another .txt file, open it, copy this string into it perl acdc.pl -c all.ltx -o new.spawn then save and close it
  7. Rename the .txt to compile.bat
  8. Install active perl, if you use the .pl version of acdc and don't yet have perl.

Now you're ready to go.

Editing all.spawn

This section could use more info on the structure of all.spawn. If you can provide information, feel free to contribute! Atrocious and Gr1ph00n

After you have set up everything, double-click the decompile.bat and wait for the process to finish. It should take some seconds. If the window is instantly closing, you have an error. Read the troubleshooting section then.

After the files have been extracted, you can edit them like any other .ltx file. There are 2 files for each level, alife_ and way_, but the files which interest us are just the alife_ ‘s ones. They entries have numbers in brackets [ ] as section identifiers. Those identifiers must be unique over all .ltx files. A vanilla all.spawn has got [8640] sections, so when you add a new section, you must type a number bigger than the last one by one, for example if you add your first new section in all.spawn, it will have 8641 as number. In an all.spawn there are different types of sections : climable_objects, physic_objects, zone_campfire_grills, physic_destroyable_objects, lights_hanging_lamps, etc… but those are level’s objects and so we do not care about them; they only sections we could edit are : stalker or stalker_monolith or stalker_zombied smart_terrain space_restrictor ( for advanced users only ) respawn ( for advanced users only ) monsters’ section like : bloodsucker_normal, etc…

To spawn something somewhere we need some values, that are to say the position, level_vertex_id and game_vertex_id of the location where we want to spawn our entity To get them we can use some tools/mods like Zrp mod or Smart Terrain Debug and Waypoint Extractor Tool.

When we get them, we can start, This is an example to spawn a npc in escape level


[8641]
; cse_abstract properties
section_name = stalker  ;-- this is a stalker ( loner, duty, freedom, ecology, army )
name =  esc_example ;-- this is its name, the choice is up to you
position =   1.1,0.9,0.5   ;-- this is the position  
direction = 0,0,0 ;-- this is the direction, set it to 0,0,0

; cse_alife_trader_abstract properties
money = 5000    ; this is the stalker’s money ( I do not think it is used)
character_profile = esc_our_specific_profile   ;-- this is link to the specific character id in a character_desc_xxxxx.xml files in config\gameplay

; cse_alife_object properties
game_vertex_id = 61  ;-- game vertex id
distance = 9.80000019073486
level_vertex_id = 43968   ;-- level vertex id
object_flags = 0xffffffbf
; cse_visual properties
visual_name = actors\novice\green_stalker_2  ;-- this is the link of the ogf files, they are in meshes\actors, you must not add .ogf extension 

; cse_alife_creature_abstract properties
g_team = 0
g_squad = 1
g_group = 5
health = 1    ;-- npc’s health max value = 2, min value = 0
dynamic_out_restrictions = 
dynamic_in_restrictions = 

upd:health = 1
upd:timestamp = 0x617a6b75
upd:creature_flags = 0x6b
upd:position =   1.1,0.9,0.5   ;-- position
upd:o_model = 0
upd:o_torso = 0,0,0
upd:g_team = 0
upd:g_squad = 1
upd:g_group = 5

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

; cse_ph_skeleton properties

upd:start_dialog = 

; se_stalker properties


Then in gameplay\character_desc_xxxxxxxx.xml

<specific_character id=" esc_our_specific_profile" team_default = "1">
     <name>Stalker</name>   <!-- this is the name of the stalker -->
     <icon>ui_npc_u_green_stalker_4</icon> <!-- this is the icon of the stalker in ui\ui_npc_unique.xml --> 
      <bio>esc_stalker_novice_bio</bio>  <!-- this is the string id of this character in text\your_language\stable_bio_name.xml    -->

		<class>esc_stalker_novice</class>   <!-- this is the stalker’s class in npc_profile.xml -->
		<community>stalker</community> <terrain_sect>stalker_terrain</terrain_sect> <!-- stalker’s community and its terrain_sect, check m_stalker.ltx   -->

		
		<rank>268</rank>  <!-- its rank -->
		<reputation>1</reputation> <!-- its reputation --> 
		<money min="200" max="600" infinitive="0"/> <!-- npc’s money -->
		
		<snd_config>characters_voice\human_02\newbie\</snd_config> <!--- its voice, check sounds dir --->
		<crouch_type>-1</crouch_type>
		
		<visual>actors\novice\green_stalker_4</visual>   <!-- this is the link at its ogf -->
		<supplies>  <!-- this is npc’s supplies -->
			[spawn] \n
			wpn_bm16 \n
			ammo_12x70_buck \n
			device_torch \n
#include "gameplay\character_items.xml" \n
#include "gameplay\character_food.xml"
		</supplies>
		
#include "gameplay\character_criticals_3.xml"
			
		<start_dialog>hello_dialog</start_dialog>   <!--- add here dialogs -->
#include "gameplay\character_dialogs.xml"
	</specific_character>


Now, using this code, npcs will run away because he hasn’t got a smart_terrain, so we should give it. How ? There are 2 ways : give it an already existed smart_terrain create a new smart_terrain and then give it

[8641]
; cse_abstract properties
section_name = stalker  ;-- this is a stalker ( loner, duty, freedom, ecology, army )
name =  esc_example ;-- this is its name, the chooise is up to you
position =   1.1,0.9,0.5   ;-- this is the position  
direction = 0,0,0 ;-- this is the direction, set it to 0,0,0

; cse_alife_trader_abstract properties
money = 5000    ; this is the stalker’s money ( i do not think it is used)
character_profile = esc_our_specific_profile   ;-- this is link to the specific character id in a character_desc_xxxxx.xml files in config\gameplay

; cse_alife_object properties
game_vertex_id = 61  ;-- game vertex id
distance = 9.80000019073486
level_vertex_id = 43968   ;-- level vertex id
object_flags = 0xffffffbf
custom_data = <<END
[smart_terrains]
esc_lager = true
END
; cse_visual properties
visual_name = actors\novice\green_stalker_2  ;-- this is the link of the ogf files, they are in meshes\actors, you must not add .ogf extension 

; cse_alife_creature_abstract properties
g_team = 0
g_squad = 1
g_group = 5
health = 1    ;-- npc’s health max value = 2, min value = 0
dynamic_out_restrictions = 
dynamic_in_restrictions = 

upd:health = 1
upd:timestamp = 0x617a6b75
upd:creature_flags = 0x6b
upd:position =   1.1,0.9,0.5   ;-- position
upd:o_model = 0
upd:o_torso = 0,0,0
upd:g_team = 0
upd:g_squad = 1
upd:g_group = 5

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

; cse_ph_skeleton properties

upd:start_dialog = 

; se_stalker properties


Then we have to find that smart_terrain and increase its capacity by one, like that



[101]
; cse_abstract properties
section_name = smart_terrain
name = esc_lager
position = -208.551208496094,-20.0917911529541,-141.64958190918
direction = 0.062321275472641,0.00316426996141672,0.0140644172206521

; cse_alife_object properties
game_vertex_id = 61
distance = 4.19999980926514
level_vertex_id = 44622
object_flags = 0xffffffbe
custom_data = <<END
[smart_terrain]
type = esc_lager
capacity = 14 ;-- capacity increased by one
squad = 1
groups = 5
respawn = esc_respawn_inventory_box_0000
END

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

; cse_alife_space_restrictor properties
restrictor_type = 3

; se_smart_terrain properties

Using custom_data field we can give it some proprieties like

[spawner]
cond = {+info_portion} ;-- if we have that info_portion, then it ll spawn

[spawner]
cond = {-info_portion} ;-- if we have not that info_portion, then it ll spawn

We can add logic too, calling an AI scheme, but we will talk about that in another tutorial.

When you are finished, double-click compile.bat and wait until the new.spawn is finished. Copy the new.spawn into your STALKER gamedata\spawns directory, make a backup of the existing spawn file and rename the new.spawn to all.spawn.

Troubleshooting

If the decompiling breaks, it is most probably because your acdc.pl does not work with the all.spawn you use. Use the correct version for your STALKER patch version and use a suitable version if you try to decompile mods. If you can't get the correct version for the mod or version, you have to create it by yourself, like written below.

Important: Before you even start working on a spawn file from another mod, ask the creators of the mod if you are allowed to alter their work. At least do it if you plan to release your changes as new mod. That should go without saying!

How to alter the acdc.pl:

  • Open a dos box (cmd.exe) and make your way through the directories into the recently created all.spawn workspace
  • Once you are there, type decompile and hit enter
  • It will again attempt to decompile but it will fail. Now you should have an error message like:
unknown tushkano_strong at acdc.pl line 2256.

Your acdc.pl doesn't know tushkano_strong. Time to change that:

  • Right-click on acdc.pl and chose edit.
  • Scroll down until you find lines like these:
stalker => 'se_stalker',
stalker_monolith => 'se_stalker',
stalker_zombied => 'se_stalker',
stalker_trader => 'se_stalker',
stalker_sakharov => 'se_stalker',
m_barman => 'se_stalker',
m_osoznanie => 'se_stalker',

They are under section_to_class. Now you can add new items that have been added to the all.spawn in the same manner. Just make sure to point the new items to the right classes. The above example is for NPCs, but there are also examples for monsters and different items. The section from the error message is a new monster, so we have to add it as such:

tushkano_strong => 'se_monster',

Then save and close acdc.pl and try to decompile again. If it fails again (almost certain), check for the next unknown item and add it like the first.

Personal tools