Level Changers

From Mod Wiki

Jump to: navigation, search

First you need a tool called ACDC from Bardak. There are several versions, the original acdc.pl version or the acdc.exe version. You may find them in the Tools List. This tool is required to unpack the all.spawn where you will find the level changers, and also add some. And for collecting proper coordinates and direction, you should use our point extractor tool too (you can find it at the tools list) When you found the best place, hit "esc" and "z" or "y" (eng or hun kb settings) and a window will pop up, there you will see the proper coordinates, direction, and game and level vx ids. So add a name, and save, so it will be in the log :)

Third, you should make a folder somewhere on your HDD and put the acdc.pl or .exe version there and an all.spawn file, then command line:

acdc.pl -d all.spawn

In just a minute or less, and you will see a lot of ltx files in that folder.

alife_lxx_levelname.ltx (ca. 18 files) and way_lxx_levelname for the same levels, and a section.bin and all.ltx. You should not touch that bin file, only the ltx files. For the level changers easy version you only need to edit the alife_lxx_levelname.ltx files.

Since we know that the last level in the all.spawn is the l10u_bunker, we need to edit that ltx file. So open the alife_l10u_bunker.ltx with Notepad++ or Notepad2 tool. If you open them with simple windows notepad or word-pad, you may damage the files. (we noticed that after saving the file, it became smaller, so we do not recommend the built in notepad in windows)

Check an example. Now I will paste the Pripyat to Stancia level changer here, since its real easy to make a Stancia to Pripyat one:

; cse_abstract properties
section_name = level_changer
name = exit_to_stancia_01 (add custom name, which you will recognise easily)
position = 30.9278087615967,-0.681343078613281,456.90966796875
(Position is important since you need to know where to place that level changer, so you should collect coordinates in game with rs_stats 1, or ZRP tools where you will see the level vertex and game vertex ids too or use our point extractor tool)
direction = 3.66738345292106e-006,-2.78026516739582e-013,7.5810604016624e-008
(you can rotate your character, if you will arrive to a flat terrain, then its usually 0,0,0 ...
while "y" value might change, depends on if you need to rotate your character or not)
; cse_alife_object properties
game_vertex_id = 2158 
distance = 16.1000003814697
level_vertex_id = 141177
object_flags = 0xffffff3e
custom_data = <<END
path = pri_path_if_reject 
story_id = 832 (story id is needed, but its easy to add, will explain it later)
(path = pri_path_if_reject means: name for the waypoint [which you either added in level editor, or you will add with acdc tool to the level's way section], which has way_move and way_look part. it is only needed if you not use silent mode, otherwise useless, since you cant reject the level changing!)
; cse_shape properties (you can edit the shape of the lc point, make it bigger or smaller)
shapes = shape0
shape0:type = box
shape0:axis_x = 164.583786010742,0,0
shape0:axis_y = 0,20,0
shape0:axis_z = 0,0,50
shape0:offset = 0,0,0
(if you added level changer in level editor, you will need to attach shape for it, which allows you to transform it's size, so players cant cheat it)
; cse_alife_space_restrictor properties
restrictor_type = 3
; cse_alife_level_changer properties
dest_game_vertex_id = 2401 (the destination’s game vx id is needed)
dest_level_vertex_id = 404957 (destination’s level vx id is needed)
dest_position = 919.089599609375,0.000268459320068359,-292.599273681641 
dest_direction = -2.02234588186911e-007,-1.08743614427812e-015,-5.37710276304892e-009
dest_level_name = L12_Stancia (destination level's name, pick correct names from game_levels.ltx)
dest_graph_point = start_actor_01 (graph point name from the destination level)
silent_mode = 1 (0 - the game will ask you if you want to enter next level)
(silent_mode: you may add 1, so the game won't ask you if you want to enter the next area, it will drop you as soon as you reached the level changer. If you did not add waypoints for rejecting, then recommended to use silent mode)

So now you see this level changer. It will look like:

[8641] (The last note is 8640 in the "vanilla" aka unmodded all.spawn at alife_l10u_bunker.ltx but you can add any bigger custom number such as 423423423)
; cse_abstract properties
section_name = level_changer
name = exit_to_pripyat_03 (added a custom name, defined at the game_story_ids.ltx and level_tasks.script and in xml files for each languages) 
position = 918.27001953125,0.920000016689301,-400.839996337891 (collected a new position at stancia1 level for the level changer)
direction = 0,0,0 (your direction when you arrive to the level, you can rotate yourself with "y" value)
; cse_alife_object properties
game_vertex_id = 2401 (this is the starting game vx id from stancia1 level, it's easy to pick these id’s with zrp tools or our point extractor tools)
cse_alife_object__unk1_f32 = 30.7999992370605
level_vertex_id = 404957 (this is the starting level vx id from stancia1 level, it's easy to pick these id’s with zrp tools or our point extractor tools)
object_flags = 0xffffff3e
custom_data = <<END
path = st1_way_if_reject_to_pri
story_id = 119812 (needs a custom, not used story id, the most important thing, it should be unused, so write big numbers for sure)
; cse_shape properties
shapes = shape0
shape0:type = sphere
shape0:offset = 0,0,0
shape0:radius = 3.36159992218018 (you can set the radius if you want to)
; cse_alife_space_restrictor properties
restrictor_type = 3
; cse_alife_level_changer properties
dest_game_vertex_id = 2158 (these id’s can be collected either with zrp or our tools)
dest_level_vertex_id = 141177 (these id’s can be collected either with zrp or our tools)
dest_position = 69.4100036621094,3.09999990463257,422.070007324219 (your arriving position to the level, it should be different from the level changer's position, because otherwise you will be asked all the time to move back to the other level, or if you use silent mode, you make infinite loop :D)
dest_direction = 0,0,0 (rotate yourself if needed)
dest_level_name = L11_Pripyat (where would you like to go… grab correct names from game_levels.ltx)
dest_graph_point = start_actor_02 (graph point name on the level where you want to jump to. you can dump graph points with bardak's aiwrapper tool, or simply pick a name from the level.graph files from the needed level's folder)
silent_mode = 1

Now you have the new [8641] level changer in your alife_l10u_bunker.ltx file. You will need a level changer at least from stancia2 to stancia1, or the longer way during the sarcofag, to make the game real open ended as in free play story mod.

And finally, about the story id-s: It is not necessary, but you can add custom story id for your level changer. (gsc used custom story id for each level changer)

So open the game_story_ids.ltx file, and add new IDs for your new level changers. You should add not used numbers as id-s otherwise the game will crash with this log „story id is already in the alife story registry” or something like that. Your id number can be anything like "2342323234" just to be unique.

After you added new story id-s for all of your new level changers, you should add the new story id-s to the alife_l10u_bunker.ltx to your level changers, as you see in the example above. Now you can recompile your all.spawn.

acdc.pl -c all.ltx [-o all.spawn]

Now you will get a all.spawn_new or something like that, so move it to your gamedata\spawns folder and rename it to all.spawn. Then you also need to add the level changer circles to your PDA map, since you wont see them. So open the level_tasks.script, and add each of the new level changers to the file. You will see how they work, since you will find the other lc-s there, but here is an example from free play story mod (stancia-pripyat levelchanger):

-- aes
local obj = sim:story_object(119812) (this is your unique story ID)
if obj then
	level.map_add_object_spot(obj.id, "level_changer", "to_pripyat" )

If you add non existing id, such as "level_pripyat" instead of "to_pripyat" then you will need to add this new id to the string_table_level_tips.xml file, otherwise you will see in game "level_pripyat" when you move your mouse over the blue level changer circle, instead of "Pripyat".

Now if you start a new game, you will see these blue circles on the map, and also if you reach them, they will drop you to the next map, or that map you added to them.

In some cases, if you don't know or you are too lazy to get the level vx and game vx id-s, you may use the destination level’s game and level vx ids as the starting game vx and level vx id at an other level like in the case of pripyat-stancia or stancia-pripyat level changer. Since you arrive to the same spot, or almost the same, but haven't tested if it works in every situation.



Personal tools