Modding Q&A [For Quick Questions and Answers]

Users who are viewing this thread

Status
Not open for further replies.
ZektorSK said:
Well ok, but which files are for Loading screens, and other graphic thingies ?

tutorial section has a few guides on this. One I remember explains how to edit game_variables.txt (so you can move the UI around, disable stuff like tutorial or multiplayer, etc).
 
kalarhan said:
troycall said:
I want it so that the game chooses randomly between several maps depending on the terrain rather than bots.

you can achieve this in different ways. The most basic would be something like this:

Code:
(store_random_in_range, ":random", 1, 5), #1,2,3,4 (not 5!)
(try_begin),
  (eq, ":random", 1),
    
(else_try),
  (eq, ":random", 2),
    
(else_try),
  (eq, ":random", 3),

(else_try),

(try_end),

if your scenes were created in order (one after the one) on scenes.txt you could simply add to the scene_id (number) and avoid those (else_try)

Wohoo, you have no idea how happy I am now, this works great. thanks a lot sir!

I have one more question, when I assign a map name in module_strings.py for some reason, the game dosen't register it and just calls it Unknown.
Here is an example of my module_strings
 
Code:
("coop_random_med_snow", "Snow"), # < "Snow" can be changed and it saves correctly.
    ("customfield_combat_rocky_desert_0", "Rocky Desert Large"), #< This is the map I want to have the name "Rocky desert Large" but it switches to "Unknown"..
  #Uncomment me if planning on using me as a name also change my name from desert if you do it ("coop_random_med_desert", "Desert"),
  ("coop_random_med_steppe_forest", "Steppe Forest"), # < Steppe Forest name can be changed aswell.

If I edit the coop ones and change only their name it works, but if I change the scene name to the one I want to, then the name just dosen't register.
for example I added
Code:
 ("customfield_combat_rocky_desert_0", "Rocky Desert Large"),

And the game dosen't register its name for some reason.
 
SenpaiHinds said:
Look through them. Stuff that begins with ui_ is what you should be looking for. You can look through the actual ui meshes on OpenBRF as well which is probably easier.

Where should I look for those UI stuff ? In module system or where ?
 
troycall said:
I have one more question, when I assign a map name in module_strings.py for some reason, the game dosen't register it and just calls it Unknown.

check your module_constants.py
Code:
multiplayer_troops_begin = "trp_swadian_crossbowman_multiplayer"
multiplayer_troops_end = "trp_multiplayer_end"

multiplayer_ai_troops_begin = "trp_swadian_crossbowman_multiplayer_ai"
multiplayer_ai_troops_end = multiplayer_troops_begin

multiplayer_scenes_begin = "scn_multi_scene_1"
multiplayer_scenes_end = "scn_multiplayer_maps_end"

multiplayer_scene_names_begin = "str_multi_scene_1"
multiplayer_scene_names_end = "str_multi_scene_end"

multiplayer_flag_projections_begin = "mesh_flag_project_sw"
multiplayer_flag_projections_end = "mesh_flag_projects_end"

multiplayer_flag_taken_projections_begin = "mesh_flag_project_sw_miss"
multiplayer_flag_taken_projections_end = "mesh_flag_project_misses_end"

multiplayer_game_type_names_begin = "str_multi_game_type_1"
multiplayer_game_type_names_end = "str_multi_game_types_end"

if you are not using constants then check the script that uses those strings, you may need to update the range (so it will see the new strings). Can't say more without game code.

Search for the first string "coop_random_med_snow" or similar and how the game uses it.



ZektorSK said:
Where should I look for those UI stuff ? In module system or where ?
He already answered you. OpenBRF (its a tool to handle the meshes, textures, ...) for the game (look under the tool subsection of the forge for download link)
You should read the basic tutorials on modding (sticky thread)
 
Well I looked into base textures and found main menu and inventory, currently main menu is done and Then I moved it into my module folder and textures :smile:

It is working now thanks
 
kalarhan said:
troycall said:
I have one more question, when I assign a map name in module_strings.py for some reason, the game dosen't register it and just calls it Unknown.

check your module_constants.py
Code:
multiplayer_troops_begin = "trp_swadian_crossbowman_multiplayer"
multiplayer_troops_end = "trp_multiplayer_end"

multiplayer_ai_troops_begin = "trp_swadian_crossbowman_multiplayer_ai"
multiplayer_ai_troops_end = multiplayer_troops_begin

multiplayer_scenes_begin = "scn_multi_scene_1"
multiplayer_scenes_end = "scn_multiplayer_maps_end"

multiplayer_scene_names_begin = "str_multi_scene_1"
multiplayer_scene_names_end = "str_multi_scene_end"

multiplayer_flag_projections_begin = "mesh_flag_project_sw"
multiplayer_flag_projections_end = "mesh_flag_projects_end"

multiplayer_flag_taken_projections_begin = "mesh_flag_project_sw_miss"
multiplayer_flag_taken_projections_end = "mesh_flag_project_misses_end"

multiplayer_game_type_names_begin = "str_multi_game_type_1"
multiplayer_game_type_names_end = "str_multi_game_types_end"

if you are not using constants then check the script that uses those strings, you may need to update the range (so it will see the new strings). Can't say more without game code.

Search for the first string "coop_random_med_snow" or similar and how the game uses it.



ZektorSK said:
Where should I look for those UI stuff ? In module system or where ?
He already answered you. OpenBRF (its a tool to handle the meshes, textures, ...) for the game (look under the tool subsection of the forge for download link)
You should read the basic tutorials on modding (sticky thread)


The code you gave me for the randomized scenes works, however it makes all terrain_types below it not be reached by the game, as a result all things below rt_random (which i switched to rt_desert) are forced under the rt_desert random range.

How can I make it so that the random maps are chosen by terrain_type, depending on the range, so for example rt_desert can exist with like 9 random maps
and rt_snow can also exist after it with 9 or so maps, that way, the game can reach rt_snow because right now it hangs up at rt_desert which is the line above it

Here is a code snippet, I'm not sure what im doing wrong.

Code:
         #if field battle or we did not find one
        (party_get_current_terrain, ":terrain_type", "p_main_party"),
        (assign, ":scene_to_use", "scn_coop_random_med_plain"),
        (assign, ":scene_to_use_large", "scn_coop_random_lrg_plain"),
			(store_random_in_range, ":rt_desert", 1, 4), #1,2,3,4 (not 5!)	
(try_begin),

        (try_begin),
		  (eq, ":rt_desert", 1),
             (assign, ":scene_to_use", "scn_test_combat_rocky_desert_0"),
          (assign, ":scene_to_use_large", "scn_test_combat_rocky_desert_0"),
(else_try),
  (eq, ":rt_desert", 2),
             (assign, ":scene_to_use", "scn_coop_random_med_snow"),
          (assign, ":scene_to_use_large", "scn_coop_random_med_snow"),
(else_try),
  (eq, ":rt_desert", 3),
          (assign, ":scene_to_use", "scn_multi_scene_1"),
          (assign, ":scene_to_use_large", "scn_multi_scene_1"),
		  (try_end),
		          (else_try),
			
          (eq, ":terrain_type", rt_steppe),
          (assign, ":scene_to_use", "scn_coop_random_med_steppe"),
          (assign, ":scene_to_use_large", "scn_coop_random_lrg_steppe"),
        (else_try),
          (eq, ":terrain_type", rt_plain),
          (assign, ":scene_to_use", "scn_coop_random_med_plain"),
          (assign, ":scene_to_use_large", "scn_coop_random_lrg_plain"),
        (else_try),
          (eq, ":terrain_type", rt_snow),
          (assign, ":scene_to_use", "scn_coop_random_med_snow"),
          (assign, ":scene_to_use_large", "scn_coop_random_lrg_snow"),

What I intend to work is, each one of those terrain_types to have a set amount of pre-determined maps and randomly choose between them (which we managed to get working with rt_desert) but when I set rt_desert the game never moves on to the next thing, for example "rt_plain" if the terrain_type ingame is rt_plain, it still chooses rt_desert.
 
troycall said:
Here is a code snippet, I'm not sure what im doing wrong.
Indentation. You're definitely not doing it right.
Here's how your code should look:
Code:
		# if field battle or we did not find one
		(party_get_current_terrain, ":terrain_type", "p_main_party"),
		(assign, ":scene_to_use", "scn_coop_random_med_plain"),
		(assign, ":scene_to_use_large", "scn_coop_random_lrg_plain"),
		(store_random_in_range, ":rt_desert", 1, 4), #1,2,3,4 (not 5!)	
		(try_begin),
			(try_begin),
				(eq, ":rt_desert", 1),
				(assign, ":scene_to_use", "scn_test_combat_rocky_desert_0"),
				(assign, ":scene_to_use_large", "scn_test_combat_rocky_desert_0"),
			(else_try),
				(eq, ":rt_desert", 2),
				(assign, ":scene_to_use", "scn_coop_random_med_snow"),
				(assign, ":scene_to_use_large", "scn_coop_random_med_snow"),
			(else_try),
				(eq, ":rt_desert", 3),
				(assign, ":scene_to_use", "scn_multi_scene_1"),
				(assign, ":scene_to_use_large", "scn_multi_scene_1"),
			(try_end),
		(else_try),
			(eq, ":terrain_type", rt_steppe),
			(assign, ":scene_to_use", "scn_coop_random_med_steppe"),
			(assign, ":scene_to_use_large", "scn_coop_random_lrg_steppe"),
		(else_try),
			(eq, ":terrain_type", rt_plain),
			(assign, ":scene_to_use", "scn_coop_random_med_plain"),
			(assign, ":scene_to_use_large", "scn_coop_random_lrg_plain"),
		(else_try),
			(eq, ":terrain_type", rt_snow),
			(assign, ":scene_to_use", "scn_coop_random_med_snow"),
			(assign, ":scene_to_use_large", "scn_coop_random_lrg_snow"),
See the issue now?
You're not checking whether
Code:
":terrain_type"
is rt_desert initially. The first block always evaluates, as there is no condition to stop it.

Also, variable names. Never, for the love of God and cute kittens, name a variable ":rt_desert". That's just stupid.
Code:
(store_random_in_range, ":rand", 1, 4),
instead. Do note that these will only give you values from 1 to 3 inclusive, not "1, 2, 3, 4" as your comment suggests.

And after you've added the correct check for whether the current terrain type is a desert, you'll need to copy-paste your code for each possible terrain type and adjust it accordingly.
But that'll make it look like absolute arse. Not good enough.

The ModSys treats everything like a list, and we can take advantage of that. First, what are the terrain types?
Code:
rt_water = 0
rt_mountain = 1
rt_steppe = 2
rt_plain = 3
rt_snow = 4
rt_desert = 5
rt_bridge = 7
rt_river  = 8
rt_mountain_forest = 9
rt_steppe_forest = 10
rt_forest = 11
rt_snow_forest = 12
rt_desert_forest = 13
Easy peasy lemon's queasy. Now, you'll naturally want to NOT have scenes for some of them. But imagine that you want five scenes per each terrain type.
What you need to do is define the scenes in order. Proper order. Something like this:
Code:
  ("battle_plains_1",sf_flags_and_a_bunch_of_things_I'm_skipping,"0xTerraincodehere", [],[], "outer_terrain_plain"),
  ("battle_plains_2",sf_flags_and_a_bunch_of_things_I'm_skipping,"0xTerraincodehere", [],[], "outer_terrain_plain"),
  ("battle_plains_3",sf_flags_and_a_bunch_of_things_I'm_skipping,"0xTerraincodehere", [],[], "outer_terrain_plain"),
  ("battle_plains_4",sf_flags_and_a_bunch_of_things_I'm_skipping,"0xTerraincodehere", [],[], "outer_terrain_plain"),
  ("battle_plains_5",sf_flags_and_a_bunch_of_things_I'm_skipping,"0xTerraincodehere", [],[], "outer_terrain_plain"),

  ("battle_steppe_1",sf_flags_and_a_bunch_of_things_I'm_skipping,"0xTerraincodehere", [],[], "outer_terrain_steppe"),
  ("battle_steppe_2",sf_flags_and_a_bunch_of_things_I'm_skipping,"0xTerraincodehere", [],[], "outer_terrain_steppe"),
  ("battle_steppe_3",sf_flags_and_a_bunch_of_things_I'm_skipping,"0xTerraincodehere", [],[], "outer_terrain_steppe"),
  ("battle_steppe_4",sf_flags_and_a_bunch_of_things_I'm_skipping,"0xTerraincodehere", [],[], "outer_terrain_steppe"),
  ("battle_steppe_5",sf_flags_and_a_bunch_of_things_I'm_skipping,"0xTerraincodehere", [],[], "outer_terrain_steppe"),

  ("battle_snow_1",sf_flags_and_a_bunch_of_things_I'm_skipping,"0xTerraincodehere", [],[], "outer_terrain_snow"),
   # ... "It goes on and on and on and on" -- Blind Guardian, "Precious Jerusalem"
You catch my drift. (If you don't, too bad for you.) Now, just modify the scene selection code so it gets an index instead, and increment the scene to use by that specific index. In the given example, we'll need some manual assignment; with more shenanigans that could probably be avoided.
Example:
Code:
		# if field battle or we did not find one
		(party_get_current_terrain, ":terrain_type", "p_main_party"),
		(assign, ":scene_to_use", "scn_battle_plains_1"), # Safeguard
		(store_random_in_range, ":offset", 0, 5), # Actual index of the random scene (returns 0-4)
		(try_begin),
			(eq, ":terrain_type", rt_desert),
			(assign, ":scene_to_use", "scn_battle_desert_1"),
		(else_try),
			(eq, ":terrain_type", rt_steppe),
			(assign, ":scene_to_use", "scn_battle_steppe_1"),
			# ... "And on and on and on..." -- Blind Guardian, "Precious Jerusalem"
			# In other words, repeat these for all terrain types you've got covered.
		(try_end),
		(val_add, ":scene_to_use", ":offset"),
		# READY SET GO
Why does it work? Because the scenes were defined in order. Since you're selecting two scenes every time but with the same offset, just double the amount of scenes you've got in ordered "lists" (to accommodate for the "large" variants, apparently), and store two values instead. Done and done.

And indent your code properly, for ****'s sake. It's always people with messy code that make me go on rants like these.


(Sorry, I think I might be in a slightly abrasive mood today. It happens sometimes. Please don't give a **** about that.)
 
Lumos said:
And indent your code properly, for ****'s sake. It's always people with messy code that make me go on rants like these.

:smile:

Lumos is right. And you have a tool for that. Check the file "process_line_correction.py".

It will auto indent your module_scripts.py. You can extend it for other files (like triggers, mission templates, etc). No need to do it manually. And you can wrap it on a file.bat as well.

(you can see a extended example on the Viking Conquest DLC source files)
 
kalarhan said:
Lumos said:
And indent your code properly, for ****'s sake. It's always people with messy code that make me go on rants like these.

:smile:

Lumos is right. And you have a tool for that. Check the file "process_line_correction.py".

It will auto indent your module_scripts.py. You can extend it for other files (like triggers, mission templates, etc). No need to do it manually. And you can wrap it on a file.bat as well.

(you can see a extended example on the Viking Conquest DLC source files)

Thanks a lot for the help both of you, I've figured out how to add random maps properly now thanks to you both.

I do have one more question, I believe this might be my last question for a while, but can't be sure about that just yet.

Anyway the question is, in SP I can get the textures to generate rocks etc, however in MP its completly plain ground.

Here is the code I use to generate the stuff in SP:

Code:
	("setup_random_scene",
		[
			(party_get_current_terrain, ":current_terrain_main_party", "p_main_party"),
			(assign, ":value", "scn_random_scene"),
			(call_script, "script_get_closest_center", "p_main_party"),
			(party_get_slot, ":reg0_center_original_faction", reg0, slot_center_original_faction),
			(try_begin),
				(eq, ":current_terrain_main_party", 2),
				(assign, ":value", "scn_random_scene_steppe"),
			(else_try),
				(eq, ":current_terrain_main_party", 3),
				(assign, ":value", "scn_random_scene_plain"),
			(else_try),
				(eq, ":current_terrain_main_party", 4),
				(assign, ":value", "scn_random_scene_snow"),
			(else_try),
				(eq, ":current_terrain_main_party", 5),
				(assign, ":value", "scn_random_scene_desert"),
			(else_try),
				(eq, ":current_terrain_main_party", 10),
				(assign, ":value", "scn_random_scene_steppe_forest"),
			(else_try),
				(eq, ":current_terrain_main_party", 11),
				(assign, ":value", "scn_random_scene_plain_forest"),
			(else_try),
				(eq, ":current_terrain_main_party", 12),
				(assign, ":value", "scn_random_scene_snow_forest"),
			(else_try),
				(eq, ":current_terrain_main_party", 13),
				(assign, ":value", "scn_random_scene_desert_forest"),
			(else_try),
				(eq, ":current_terrain_main_party", 0),
				(assign, ":value", "scn_water"),
			(else_try),
				(eq, ":current_terrain_main_party", 7),
				(assign, ":value", "scn_scene_sea"),
			(try_end),
			(try_begin),
				(assign, "$tom_generate_swamp", 0),
				(assign, "$tom_generate_desert", 0),
				(assign, "$tom_generate_desertv2", 0),
				(assign, "$tom_generate_desertv3", 0),
				(assign, "$tom_generate_iberian", 0),
				(assign, "$tom_generate_iberian2", 0),
				(assign, "$tom_generate_snow", 0),
				(eq, "$tom_use_battlefields", 1),
				(try_begin),
					(eq, ":current_terrain_main_party", 11),
					(store_random_in_range, ":random_in_range_0_101", 0, 101),
					(ge, ":random_in_range_0_101", 60),
					(store_random_in_range, ":value", "scn_test_combat_swamp_0", "scn_test_combat_rocky_desert_0"),
					(assign, "$tom_generate_swamp", 1),
				(try_end),
				(try_begin),
					(eq, ":current_terrain_main_party", 4),
					(store_random_in_range, ":random_in_range_0_101", 0, 101),
					(ge, ":random_in_range_0_101", 20),
					(assign, "$tom_generate_snow", 1),
					(store_random_in_range, ":value", "scn_test_combat_snow_0", "scn_manor"),
				(try_end),
				(try_begin),
					(eq, ":current_terrain_main_party", 12),
					(store_random_in_range, ":random_in_range_0_101", 0, 101),
					(ge, ":random_in_range_0_101", 20),
					(assign, "$tom_generate_snow", 2),
					(store_random_in_range, ":value", "scn_test_combat_snow_0", "scn_manor"),
				(try_end),
				(try_begin),
					(eq, ":current_terrain_main_party", 3),
					(store_random_in_range, ":random_in_range_0_101", 0, 101),
					(ge, ":random_in_range_0_101", 80),
					(store_random_in_range, ":value", "scn_test_combat_euro_0", "scn_test_combat_iberian_hillside_0"),
				(try_end),
				(try_begin),
					(this_or_next|eq, ":current_terrain_main_party", 5),
					(eq, ":current_terrain_main_party", 13),
					(store_random_in_range, ":random_in_range_0_101", 0, 101),
					(try_begin),
						(ge, ":random_in_range_0_101", 80),
						(assign, "$tom_generate_desert", 1),
						(assign, ":value", "scn_test_combat_rocky_desert_0"),
					(else_try),
						(ge, ":random_in_range_0_101", 30),
						(assign, "$tom_generate_desertv2", 1),
						(assign, ":value", "scn_test_combat_rocky_desert_0"),
					(try_end),
				(try_end),
				(try_begin),
					(this_or_next|eq, ":current_terrain_main_party", 10),
					(eq, ":current_terrain_main_party", 2),
					(try_begin),
						(this_or_next|eq, ":reg0_center_original_faction", "fac_kingdom_3"),
						(this_or_next|eq, ":reg0_center_original_faction", "fac_kingdom_5"),
						(eq, ":reg0_center_original_faction", "fac_kingdom_15"),
						(store_random_in_range, ":value", "scn_test_combat_steppe_0", "scn_test_combat_euro_0"),
					(else_try),
						(eq, ":current_terrain_main_party", 10),
						(assign, "$tom_generate_iberian2", 1),
						(assign, ":value", "scn_test_combat_iberian_0"),
					(else_try),
						(assign, "$tom_generate_iberian", 1),
						(assign, ":value", "scn_test_combat_iberian_0"),
					(try_end),
				(try_end),
				(set_fixed_point_multiplier, 100),
				(party_get_position, 15, "p_main_party"),
				(position_get_x, ":position_x_15", 15),
				(position_get_y, ":position_y_15", 15),
				(try_begin),
					(assign, ":value_2", 0),
					(try_begin),
						(lt, ":position_x_15", 18036),
						(lt, ":position_y_15", -20834),
						(gt, ":position_x_15", 15890),
						(gt, ":position_y_15", -25502),
						(assign, ":value_2", 1),
					(else_try),
						(lt, ":position_x_15", 22720),
						(lt, ":position_y_15", -18627),
						(gt, ":position_x_15", 21597),
						(gt, ":position_y_15", -20013),
						(assign, ":value_2", 1),
					(try_end),
					(eq, ":value_2", 1),
					(store_random_in_range, ":value", "scn_sitd_battle_nile_1", "scn_test_combat_snow_0"),
					(assign, "$tom_generate_desertv3", 1),
				(else_try),
					(lt, ":position_x_15", -18195),
					(lt, ":position_y_15", 13475),
					(gt, ":position_x_15", -19389),
					(gt, ":position_y_15", 10326),
					(store_random_in_range, ":value", "scn_test_combat_euro_hillside_0", "scn_test_combat_euro_hillside_4"),
					(assign, "$tom_generate_euro_hillside", 1),
					(assign, "$tom_generate_iberian2", 0),
					(assign, "$tom_generate_iberian", 0),
					(assign, "$tom_generate_swamp", 0),
				(else_try),
					(lt, ":position_x_15", 21714),
					(lt, ":position_y_15", -13331),
					(gt, ":position_x_15", 14265),
					(gt, ":position_y_15", -14667),
					(store_random_in_range, ":value", "scn_test_combat_mountain_0", "scn_test_combat_river_0"),
					(assign, "$tom_generate_iberian2", 0),
					(assign, "$tom_generate_iberian", 0),
					(assign, "$tom_generate_swamp", 0),
				(else_try),
					(lt, ":position_x_15", 27256),
					(lt, ":position_y_15", -7255),
					(gt, ":position_x_15", 4818),
					(gt, ":position_y_15", -14562),
					(store_random_in_range, ":value", "scn_test_combat_iberian_hillside_0", "scn_test_combat_euro_hillside_0"),
					(try_begin),
						(this_or_next|eq, ":current_terrain_main_party", 10),
						(eq, ":current_terrain_main_party", 11),
						(assign, "$tom_generate_iberian2", 1),
						(assign, "$tom_generate_iberian", 0),
						(assign, "$tom_generate_swamp", 0),
					(else_try),
						(assign, "$tom_generate_iberian", 1),
						(assign, "$tom_generate_iberian2", 0),
						(assign, "$tom_generate_swamp", 0),
					(try_end),
				(else_try),
					(lt, ":position_x_15", -1149),
					(lt, ":position_y_15", -2543),
					(gt, ":position_x_15", -5458),
					(gt, ":position_y_15", -5934),
					(store_random_in_range, ":value", "scn_test_combat_iberian_hillside_0", "scn_test_combat_euro_hillside_0"),
					(try_begin),
						(this_or_next|eq, ":current_terrain_main_party", 10),
						(eq, ":current_terrain_main_party", 11),
						(assign, "$tom_generate_iberian2", 1),
						(assign, "$tom_generate_iberian", 0),
						(assign, "$tom_generate_swamp", 0),
					(else_try),
						(assign, "$tom_generate_iberian", 1),
						(assign, "$tom_generate_iberian2", 0),
						(assign, "$tom_generate_swamp", 0),
					(try_end),
				(else_try),
					(lt, ":position_x_15", 1953),
					(lt, ":position_y_15", 405),
					(gt, ":position_x_15", -8779),
					(gt, ":position_y_15", -6290),
					(store_random_in_range, ":value", "scn_test_combat_mountain_0", "scn_test_combat_river_0"),
					(assign, "$tom_generate_iberian2", 0),
					(assign, "$tom_generate_iberian", 0),
					(assign, "$tom_generate_swamp", 0),
				(else_try),
					(lt, ":position_x_15", -9696),
					(lt, ":position_y_15", -2732),
					(gt, ":position_x_15", -11853),
					(gt, ":position_y_15", -4263),
					(store_random_in_range, ":value", "scn_test_combat_mountain_0", "scn_test_combat_river_0"),
					(assign, "$tom_generate_iberian2", 0),
					(assign, "$tom_generate_iberian", 0),
					(assign, "$tom_generate_swamp", 0),
				(else_try),
					(lt, ":position_x_15", -11549),
					(lt, ":position_y_15", -5660),
					(gt, ":position_x_15", -16034),
					(gt, ":position_y_15", -6883),
					(store_random_in_range, ":value", "scn_test_combat_mountain_0", "scn_test_combat_river_0"),
					(assign, "$tom_generate_iberian2", 0),
					(assign, "$tom_generate_iberian", 0),
					(assign, "$tom_generate_swamp", 0),
				(else_try),
					(lt, ":position_x_15", 10894),
					(lt, ":position_y_15", 2023),
					(gt, ":position_x_15", 4719),
					(gt, ":position_y_15", 450),
					(store_random_in_range, ":value", "scn_test_combat_mountain_0", "scn_test_combat_river_0"),
					(assign, "$tom_generate_iberian2", 0),
					(assign, "$tom_generate_iberian", 0),
					(assign, "$tom_generate_swamp", 0),
				(else_try),
					(lt, ":position_x_15", 11784),
					(lt, ":position_y_15", 253),
					(gt, ":position_x_15", 8089),
					(gt, ":position_y_15", -3882),
					(store_random_in_range, ":value", "scn_test_combat_mountain_3", "scn_test_combat_mountain_4"),
					(assign, "$tom_generate_iberian2", 0),
					(assign, "$tom_generate_iberian", 0),
					(assign, "$tom_generate_swamp", 0),
				(else_try),
					(lt, ":position_x_15", -17860),
					(lt, ":position_y_15", -5638),
					(gt, ":position_x_15", -21620),
					(gt, ":position_y_15", -7779),
					(store_random_in_range, ":value", "scn_test_combat_iberian_hillside_0", "scn_test_combat_euro_hillside_0"),
					(try_begin),
						(this_or_next|eq, ":current_terrain_main_party", 10),
						(eq, ":current_terrain_main_party", 11),
						(assign, "$tom_generate_iberian2", 1),
						(assign, "$tom_generate_iberian", 0),
						(assign, "$tom_generate_swamp", 0),
					(else_try),
						(assign, "$tom_generate_iberian", 1),
						(assign, "$tom_generate_iberian2", 0),
						(assign, "$tom_generate_swamp", 0),
					(try_end),
				(else_try),
					(lt, ":position_x_15", -4636),
					(lt, ":position_y_15", -6318),
					(gt, ":position_x_15", -5807),
					(gt, ":position_y_15", -8170),
					(store_random_in_range, ":value", "scn_test_combat_iberian_hillside_0", "scn_test_combat_euro_hillside_0"),
					(try_begin),
						(this_or_next|eq, ":current_terrain_main_party", 10),
						(eq, ":current_terrain_main_party", 11),
						(assign, "$tom_generate_iberian2", 1),
						(assign, "$tom_generate_iberian", 0),
						(assign, "$tom_generate_swamp", 0),
					(else_try),
						(assign, "$tom_generate_iberian", 1),
						(assign, "$tom_generate_iberian2", 0),
						(assign, "$tom_generate_swamp", 0),
					(try_end),
				(else_try),
					(lt, ":position_x_15", 439),
					(lt, ":position_y_15", -5315),
					(gt, ":position_x_15", -1729),
					(gt, ":position_y_15", -8618),
					(store_random_in_range, ":value", "scn_test_combat_iberian_hillside_0", "scn_test_combat_euro_hillside_0"),
					(try_begin),
						(this_or_next|eq, ":current_terrain_main_party", 10),
						(eq, ":current_terrain_main_party", 11),
						(assign, "$tom_generate_iberian2", 1),
					(else_try),
						(assign, "$tom_generate_iberian", 1),
					(try_end),
				(else_try),
					(lt, ":position_x_15", 2532),
					(lt, ":position_y_15", -8630),
					(gt, ":position_x_15", 1002),
					(gt, ":position_y_15", -11365),
					(store_random_in_range, ":value", "scn_test_combat_iberian_hillside_0", "scn_test_combat_euro_hillside_0"),
					(try_begin),
						(this_or_next|eq, ":current_terrain_main_party", 10),
						(eq, ":current_terrain_main_party", 11),
						(assign, "$tom_generate_iberian2", 1),
						(assign, "$tom_generate_iberian", 0),
						(assign, "$tom_generate_swamp", 0),
					(else_try),
						(assign, "$tom_generate_iberian", 1),
						(assign, "$tom_generate_iberian2", 0),
						(assign, "$tom_generate_swamp", 0),
					(try_end),
				(else_try),
					(lt, ":position_x_15", 954),
					(lt, ":position_y_15", -12249),
					(gt, ":position_x_15", -537),
					(gt, ":position_y_15", -13150),
					(store_random_in_range, ":value", "scn_test_combat_iberian_hillside_0", "scn_test_combat_euro_hillside_0"),
					(try_begin),
						(this_or_next|eq, ":current_terrain_main_party", 10),
						(eq, ":current_terrain_main_party", 11),
						(assign, "$tom_generate_iberian2", 1),
					(else_try),
						(assign, "$tom_generate_iberian", 1),
					(try_end),
				(try_end),
			(try_end),
			(jump_to_scene, ":value")
		]),
^ The code above is in module_scripts
I want the generated rocks, swamps, etc to also exist under MP generate.
We are currently working under module_coop_scripts.

Take note at the bottom of the code is cut off if needed I can add it, anyway you can see the field battles are reached towards the end
I've tried to copy it over and make it like this, but this dosen't seem to be the right approach since the additions (rocks, swamps, etc) don't apply

Code:
	("setup_random_scene",
		[
			(party_get_current_terrain, ":current_terrain_main_party", "p_main_party"),
			(assign, ":value", "scn_random_scene"),
			(call_script, "script_get_closest_center", "p_main_party"),
			(party_get_slot, ":reg0_center_original_faction", reg0, slot_center_original_faction),
			(try_begin),
				(eq, ":current_terrain_main_party", 2),
				(assign, ":value", "scn_random_scene_steppe"),
			(else_try),
				(eq, ":current_terrain_main_party", 3),
				(assign, ":value", "scn_random_scene_plain"),
			(else_try),
				(eq, ":current_terrain_main_party", 4),
				(assign, ":value", "scn_random_scene_snow"),
			(else_try),
				(eq, ":current_terrain_main_party", 5),
				(assign, ":value", "scn_random_scene_desert"),
			(else_try),
				(eq, ":current_terrain_main_party", 10),
				(assign, ":value", "scn_random_scene_steppe_forest"),
			(else_try),
				(eq, ":current_terrain_main_party", 11),
				(assign, ":value", "scn_random_scene_plain_forest"),
			(else_try),
				(eq, ":current_terrain_main_party", 12),
				(assign, ":value", "scn_random_scene_snow_forest"),
			(else_try),
				(eq, ":current_terrain_main_party", 13),
				(assign, ":value", "scn_random_scene_desert_forest"),
			(else_try),
				(eq, ":current_terrain_main_party", 0),
				(assign, ":value", "scn_water"),
			(else_try),
				(eq, ":current_terrain_main_party", 7),
				(assign, ":value", "scn_scene_sea"),
			(try_end),
			(try_begin),
				(assign, "$tom_generate_swamp", 0),
				(assign, "$tom_generate_desert", 0),
				(assign, "$tom_generate_desertv2", 0),
				(assign, "$tom_generate_desertv3", 0),
				(assign, "$tom_generate_iberian", 0),
				(assign, "$tom_generate_iberian2", 0),
				(assign, "$tom_generate_snow", 0),
				(eq, "$tom_use_battlefields", 1),
				(try_begin),
					(eq, ":current_terrain_main_party", 11),
					(store_random_in_range, ":random_in_range_0_101", 0, 101),
					(ge, ":random_in_range_0_101", 60),
					(store_random_in_range, ":value", "scn_test_combat_swamp_0", "scn_test_combat_rocky_desert_0"),
					(assign, "$tom_generate_swamp", 1),
				(try_end),
				(try_begin),
					(eq, ":current_terrain_main_party", 4),
					(store_random_in_range, ":random_in_range_0_101", 0, 101),
					(ge, ":random_in_range_0_101", 20),
					(assign, "$tom_generate_snow", 1),
					(store_random_in_range, ":value", "scn_test_combat_snow_0", "scn_manor"),
				(try_end),
				(try_begin),
					(eq, ":current_terrain_main_party", 12),
					(store_random_in_range, ":random_in_range_0_101", 0, 101),
					(ge, ":random_in_range_0_101", 20),
					(assign, "$tom_generate_snow", 2),
					(store_random_in_range, ":value", "scn_test_combat_snow_0", "scn_manor"),
				(try_end),
				(try_begin),
					(eq, ":current_terrain_main_party", 3),
					(store_random_in_range, ":random_in_range_0_101", 0, 101),
					(ge, ":random_in_range_0_101", 80),
					(store_random_in_range, ":value", "scn_test_combat_euro_0", "scn_test_combat_iberian_hillside_0"),
				(try_end),
				(try_begin),
					(this_or_next|eq, ":current_terrain_main_party", 5),
					(eq, ":current_terrain_main_party", 13),
					(store_random_in_range, ":random_in_range_0_101", 0, 101),
					(try_begin),
						(ge, ":random_in_range_0_101", 80),
						(assign, "$tom_generate_desert", 1),
						(assign, ":value", "scn_test_combat_rocky_desert_0"),
					(else_try),
						(ge, ":random_in_range_0_101", 30),
						(assign, "$tom_generate_desertv2", 1),
						(assign, ":value", "scn_test_combat_rocky_desert_0"),
					(try_end),
				(try_end),
				(try_begin),
					(this_or_next|eq, ":current_terrain_main_party", 10),
					(eq, ":current_terrain_main_party", 2),
					(try_begin),
						(this_or_next|eq, ":reg0_center_original_faction", "fac_kingdom_3"),
						(this_or_next|eq, ":reg0_center_original_faction", "fac_kingdom_5"),
						(eq, ":reg0_center_original_faction", "fac_kingdom_15"),
						(store_random_in_range, ":value", "scn_test_combat_steppe_0", "scn_test_combat_euro_0"),
					(else_try),
						(eq, ":current_terrain_main_party", 10),
						(assign, "$tom_generate_iberian2", 1),
						(assign, ":value", "scn_test_combat_iberian_0"),
					(else_try),
						(assign, "$tom_generate_iberian", 1),
						(assign, ":value", "scn_test_combat_iberian_0"),
					(try_end),
				(try_end),
				(set_fixed_point_multiplier, 100),
				(party_get_position, 15, "p_main_party"),
				(position_get_x, ":position_x_15", 15),
				(position_get_y, ":position_y_15", 15),
				(try_begin),
					(assign, ":value_2", 0),
					(try_begin),
						(lt, ":position_x_15", 18036),
						(lt, ":position_y_15", -20834),
						(gt, ":position_x_15", 15890),
						(gt, ":position_y_15", -25502),
						(assign, ":value_2", 1),
					(else_try),
						(lt, ":position_x_15", 22720),
						(lt, ":position_y_15", -18627),
						(gt, ":position_x_15", 21597),
						(gt, ":position_y_15", -20013),
						(assign, ":value_2", 1),
					(try_end),
					(eq, ":value_2", 1),
					(store_random_in_range, ":value", "scn_sitd_battle_nile_1", "scn_test_combat_snow_0"),
					(assign, "$tom_generate_desertv3", 1),
				(else_try),
					(lt, ":position_x_15", -18195),
					(lt, ":position_y_15", 13475),
					(gt, ":position_x_15", -19389),
					(gt, ":position_y_15", 10326),
					(store_random_in_range, ":value", "scn_test_combat_euro_hillside_0", "scn_test_combat_euro_hillside_4"),
					(assign, "$tom_generate_euro_hillside", 1),
					(assign, "$tom_generate_iberian2", 0),
					(assign, "$tom_generate_iberian", 0),
					(assign, "$tom_generate_swamp", 0),
				(else_try),
					(lt, ":position_x_15", 21714),
					(lt, ":position_y_15", -13331),
					(gt, ":position_x_15", 14265),
					(gt, ":position_y_15", -14667),
					(store_random_in_range, ":value", "scn_test_combat_mountain_0", "scn_test_combat_river_0"),
					(assign, "$tom_generate_iberian2", 0),
					(assign, "$tom_generate_iberian", 0),
					(assign, "$tom_generate_swamp", 0),
				(else_try),
					(lt, ":position_x_15", 27256),
					(lt, ":position_y_15", -7255),
					(gt, ":position_x_15", 4818),
					(gt, ":position_y_15", -14562),
					(store_random_in_range, ":value", "scn_test_combat_iberian_hillside_0", "scn_test_combat_euro_hillside_0"),
					(try_begin),
						(this_or_next|eq, ":current_terrain_main_party", 10),
						(eq, ":current_terrain_main_party", 11),
						(assign, "$tom_generate_iberian2", 1),
						(assign, "$tom_generate_iberian", 0),
						(assign, "$tom_generate_swamp", 0),
					(else_try),
						(assign, "$tom_generate_iberian", 1),
						(assign, "$tom_generate_iberian2", 0),
						(assign, "$tom_generate_swamp", 0),
					(try_end),
				(else_try),
					(lt, ":position_x_15", -1149),
					(lt, ":position_y_15", -2543),
					(gt, ":position_x_15", -5458),
					(gt, ":position_y_15", -5934),
					(store_random_in_range, ":value", "scn_test_combat_iberian_hillside_0", "scn_test_combat_euro_hillside_0"),
					(try_begin),
						(this_or_next|eq, ":current_terrain_main_party", 10),
						(eq, ":current_terrain_main_party", 11),
						(assign, "$tom_generate_iberian2", 1),
						(assign, "$tom_generate_iberian", 0),
						(assign, "$tom_generate_swamp", 0),
					(else_try),
						(assign, "$tom_generate_iberian", 1),
						(assign, "$tom_generate_iberian2", 0),
						(assign, "$tom_generate_swamp", 0),
					(try_end),
				(else_try),
					(lt, ":position_x_15", 1953),
					(lt, ":position_y_15", 405),
					(gt, ":position_x_15", -8779),
					(gt, ":position_y_15", -6290),
					(store_random_in_range, ":value", "scn_test_combat_mountain_0", "scn_test_combat_river_0"),
					(assign, "$tom_generate_iberian2", 0),
					(assign, "$tom_generate_iberian", 0),
					(assign, "$tom_generate_swamp", 0),
				(else_try),
					(lt, ":position_x_15", -9696),
					(lt, ":position_y_15", -2732),
					(gt, ":position_x_15", -11853),
					(gt, ":position_y_15", -4263),
					(store_random_in_range, ":value", "scn_test_combat_mountain_0", "scn_test_combat_river_0"),
					(assign, "$tom_generate_iberian2", 0),
					(assign, "$tom_generate_iberian", 0),
					(assign, "$tom_generate_swamp", 0),
				(else_try),
					(lt, ":position_x_15", -11549),
					(lt, ":position_y_15", -5660),
					(gt, ":position_x_15", -16034),
					(gt, ":position_y_15", -6883),
					(store_random_in_range, ":value", "scn_test_combat_mountain_0", "scn_test_combat_river_0"),
					(assign, "$tom_generate_iberian2", 0),
					(assign, "$tom_generate_iberian", 0),
					(assign, "$tom_generate_swamp", 0),
				(else_try),
					(lt, ":position_x_15", 10894),
					(lt, ":position_y_15", 2023),
					(gt, ":position_x_15", 4719),
					(gt, ":position_y_15", 450),
					(store_random_in_range, ":value", "scn_test_combat_mountain_0", "scn_test_combat_river_0"),
					(assign, "$tom_generate_iberian2", 0),
					(assign, "$tom_generate_iberian", 0),
					(assign, "$tom_generate_swamp", 0),
				(else_try),
					(lt, ":position_x_15", 11784),
					(lt, ":position_y_15", 253),
					(gt, ":position_x_15", 8089),
					(gt, ":position_y_15", -3882),
					(store_random_in_range, ":value", "scn_test_combat_mountain_3", "scn_test_combat_mountain_4"),
					(assign, "$tom_generate_iberian2", 0),
					(assign, "$tom_generate_iberian", 0),
					(assign, "$tom_generate_swamp", 0),
				(else_try),
					(lt, ":position_x_15", -17860),
					(lt, ":position_y_15", -5638),
					(gt, ":position_x_15", -21620),
					(gt, ":position_y_15", -7779),
					(store_random_in_range, ":value", "scn_test_combat_iberian_hillside_0", "scn_test_combat_euro_hillside_0"),
					(try_begin),
						(this_or_next|eq, ":current_terrain_main_party", 10),
						(eq, ":current_terrain_main_party", 11),
						(assign, "$tom_generate_iberian2", 1),
						(assign, "$tom_generate_iberian", 0),
						(assign, "$tom_generate_swamp", 0),
					(else_try),
						(assign, "$tom_generate_iberian", 1),
						(assign, "$tom_generate_iberian2", 0),
						(assign, "$tom_generate_swamp", 0),
					(try_end),
				(else_try),
					(lt, ":position_x_15", -4636),
					(lt, ":position_y_15", -6318),
					(gt, ":position_x_15", -5807),
					(gt, ":position_y_15", -8170),
					(store_random_in_range, ":value", "scn_test_combat_iberian_hillside_0", "scn_test_combat_euro_hillside_0"),
					(try_begin),
						(this_or_next|eq, ":current_terrain_main_party", 10),
						(eq, ":current_terrain_main_party", 11),
						(assign, "$tom_generate_iberian2", 1),
						(assign, "$tom_generate_iberian", 0),
						(assign, "$tom_generate_swamp", 0),
					(else_try),
						(assign, "$tom_generate_iberian", 1),
						(assign, "$tom_generate_iberian2", 0),
						(assign, "$tom_generate_swamp", 0),
					(try_end),
				(else_try),
					(lt, ":position_x_15", 439),
					(lt, ":position_y_15", -5315),
					(gt, ":position_x_15", -1729),
					(gt, ":position_y_15", -8618),
					(store_random_in_range, ":value", "scn_test_combat_iberian_hillside_0", "scn_test_combat_euro_hillside_0"),
					(try_begin),
						(this_or_next|eq, ":current_terrain_main_party", 10),
						(eq, ":current_terrain_main_party", 11),
						(assign, "$tom_generate_iberian2", 1),
					(else_try),
						(assign, "$tom_generate_iberian", 1),
					(try_end),
				(else_try),
					(lt, ":position_x_15", 2532),
					(lt, ":position_y_15", -8630),
					(gt, ":position_x_15", 1002),
					(gt, ":position_y_15", -11365),
					(store_random_in_range, ":value", "scn_test_combat_iberian_hillside_0", "scn_test_combat_euro_hillside_0"),
					(try_begin),
						(this_or_next|eq, ":current_terrain_main_party", 10),
						(eq, ":current_terrain_main_party", 11),
						(assign, "$tom_generate_iberian2", 1),
						(assign, "$tom_generate_iberian", 0),
						(assign, "$tom_generate_swamp", 0),
					(else_try),
						(assign, "$tom_generate_iberian", 1),
						(assign, "$tom_generate_iberian2", 0),
						(assign, "$tom_generate_swamp", 0),
					(try_end),
				(else_try),
					(lt, ":position_x_15", 954),
					(lt, ":position_y_15", -12249),
					(gt, ":position_x_15", -537),
					(gt, ":position_y_15", -13150),
					(store_random_in_range, ":value", "scn_test_combat_iberian_hillside_0", "scn_test_combat_euro_hillside_0"),
					(try_begin),
						(this_or_next|eq, ":current_terrain_main_party", 10),
						(eq, ":current_terrain_main_party", 11),
						(assign, "$tom_generate_iberian2", 1),
					(else_try),
						(assign, "$tom_generate_iberian", 1),
					(try_end),
				(try_end),
			(try_end),
			(jump_to_scene, ":value")
		]),

###### DATA SCRIPTS ##########################################################################################################

   # 
  # used to copy parties from SP to registers and temp casualty parties from MP to registers 
  # script_coop_copy_parties_to_file_sp
  # Input: arg1 = party_no
  ("coop_copy_parties_to_file_sp",
   [
    (try_begin), 
      (neg|is_vanilla_warband),
        (dict_create, "$coop_dict"),
        (dict_save, "$coop_dict", "@coop_battle"), #clear battle file

        (dict_set_int, "$coop_dict", "@battle_state", coop_battle_state_setup_sp),

        (call_script, "script_coop_copy_settings_to_file"),	#copy game settings here

#SP ONLY MISC DATA

      #store scene
      (assign, ":scene_to_use", 0),
      (assign, ":scene_castle", 0),
      (assign, ":scene_street", 0),
      (assign, ":scene_party", 0),
      (assign, ":encountered_party", "$g_encountered_party"),

      (try_begin),
        (this_or_next|eq, "$coop_battle_type", coop_battle_type_siege_player_defend),
        (eq, "$coop_battle_type", coop_battle_type_siege_player_attack),
        (try_begin),
          (party_slot_eq, ":encountered_party", slot_party_type, spt_town),
          (party_get_slot, ":scene_to_use", ":encountered_party", slot_town_walls),
          (party_get_slot, ":scene_castle", ":encountered_party", slot_town_castle),
          (party_get_slot, ":scene_street", ":encountered_party", slot_town_center),
          (assign, ":scene_party", ":encountered_party"),
        (else_try),
          (party_slot_eq, ":encountered_party", slot_party_type, spt_castle),
          (party_get_slot, ":scene_to_use", ":encountered_party", slot_castle_exterior),
          (party_get_slot, ":scene_castle", ":encountered_party", slot_town_castle),
          (assign, ":scene_party", ":encountered_party"),
        (try_end),

      (else_try),
        (this_or_next|eq, "$coop_battle_type", coop_battle_type_village_player_attack),
        (eq, "$coop_battle_type", coop_battle_type_village_player_defend),
        (try_begin),
          (party_slot_eq, ":encountered_party", slot_party_type, spt_village),
          (party_get_slot, ":scene_to_use", ":encountered_party", slot_castle_exterior),
          (assign, ":scene_party", ":encountered_party"),
        (else_try),
          (assign, ":encountered_party", "$g_encounter_is_in_village"),
          (party_get_slot, ":scene_to_use", ":encountered_party", slot_castle_exterior),
          (assign, ":scene_party", ":encountered_party"),
        (try_end),

      (else_try),
        (eq, "$coop_battle_type", coop_battle_type_bandit_lair),
        (party_slot_eq, ":encountered_party", slot_party_type, spt_bandit_lair),
        (party_stack_get_troop_id, ":bandit_type", "$g_encountered_party", 0),
        (try_begin),
          (eq, ":bandit_type", "trp_desert_bandit"),
          (assign, ":scene_to_use", "scn_lair_desert_bandits"),
        (else_try),
          (eq, ":bandit_type", "trp_mountain_bandit"),
          (assign, ":scene_to_use", "scn_lair_mountain_bandits"),
        (else_try),
          (eq, ":bandit_type", "trp_forest_bandit"),
          (assign, ":scene_to_use", "scn_lair_forest_bandits"),
        (else_try),
          (eq, ":bandit_type", "trp_taiga_bandit"),
          (assign, ":scene_to_use", "scn_lair_taiga_bandits"),
        (else_try),
          (eq, ":bandit_type", "trp_steppe_bandit"),
          (assign, ":scene_to_use", "scn_lair_steppe_bandits"),
        (else_try),
          (eq, ":bandit_type", "trp_sea_raider"),
          (assign, ":scene_to_use", "scn_lair_sea_raiders"),
        (try_end),

      (else_try),
		# if field battle or we did not find one
		(party_get_current_terrain, ":current_terrain_main_party", "p_main_party"),
		#(assign, ":scene_to_use", "scn_coop_random_med_plain"), # Safeguard
	    (store_random_in_range, ":offset", 0, 2), # Actual index of the random scene (returns 0-9) (0 Counts as well
		(assign, ":scene_to_use_large", "scn_test_combat_rocky_desert_0"), # Safeguard does not require terrain type.
		(val_add, ":scene_to_use_large", ":offset"), 
		
		    (store_random_in_range, ":offset", 0, 2), # Actual index of the random scene (returns 0-9) (0 Counts as well)
		    (try_begin),
			(eq, ":current_terrain_main_party", rt_desert),
		    #(assign, ":scene_to_use", "scn_test_combat_rocky_desert_0"),
			(assign, ":scene_to_use_large", "scn_test_combat_rocky_desert_0"),
			(val_add, ":scene_to_use_large", ":offset"), 
			(else_try),
			
			#Add multiple scenes by  editing  
			# 		(assign, ":scene_to_use_large)", "scn_coop_random_lrg_plain"), # Safeguard
		    #           (store_random_in_range, ":offsetsnow", 0, 10), # Actual index of the random scene (returns 0-9) (0 Counts as well)
			#       (val_add, ":scene_to_use_large", ":offset"),
			# If you got 9 scenes, then use 0, 10 if you got 6 scenes then use 0, 7 always one number is spare.


			(eq, ":current_terrain_main_party", rt_steppe),
			#(assign, ":scene_to_use", "scn_coop_random_lrg_steppe"),
			(assign, ":scene_to_use_large", "scn_coop_random_lrg_steppe"),
			# ... "And on and on and on..." -- Blind Guardian, "Precious Jerusalem"
			# In other words, repeat these for all terrain types you've got covered.
		# READY SET GO
		(else_try),
			(eq, ":current_terrain_main_party", rt_plain),
			(assign, ":scene_to_use", "scn_coop_random_med_plain"),
			(assign, ":scene_to_use_large", "scn_coop_random_lrg_plain"),
		(else_try),
			(eq, ":current_terrain_main_party", rt_snow),
			(assign, ":scene_to_use", "scn_coop_random_med_snow"),
			(assign, ":scene_to_use_large", "scn_coop_random_lrg_snow"),

Note: I changed current_terrain to current_terrain_main_party in this copy paste because I was testing to see if that's the issue.
 
I have an odd problem I've been trying to track down for 5 hours.
All the mercenaries and companions now greet the player with this line: "Any orders, sir?"
I verified that the dialog is the same as working versions of Brytenwalda all the back to 2013.
Here is the dialog:
Code:
[anyone, "start", [
                     (eq, "$talk_context", tc_tavern_talk),
           (neg|troop_is_hero, "$g_talk_troop"),
                     (neg|is_between, "$g_talk_troop", "trp_briton_merchant", "trp_startup_merchants_end"),
                     (party_get_slot, ":mercenary_troop", "$g_encountered_party", slot_center_mercenary_troop_type),
                     (party_get_slot, ":mercenary_amount", "$g_encountered_party", slot_center_mercenary_troop_amount),
                     (gt, ":mercenary_amount", 0),
                     (store_sub, reg3, ":mercenary_amount", 1),
                     (store_sub, reg4, reg3, 1),
                     (call_script, "script_game_get_join_cost", ":mercenary_troop"),
                     (assign, ":join_cost", reg0),
                     (store_mul, reg5, ":mercenary_amount", reg0),
                     (party_get_free_companions_capacity, ":free_capacity", "p_main_party"),
                     (val_min, ":mercenary_amount", ":free_capacity"),
                     (store_troop_gold, ":cur_gold", "trp_player"),
                     (try_begin),
                       (gt, ":join_cost", 0),
                       (val_div, ":cur_gold", ":join_cost"),
                       (val_min, ":mercenary_amount", ":cur_gold"),
                     (try_end),
                     (assign, "$temp", ":mercenary_amount"),
                     ],
   "Do you have a need for mercenaries, {sir/madam}?\
 {reg3?Me and {reg4?{reg3} of my mates:one of my mates} are:I am} looking for a master.\
 We'll join you for {reg5} scillingas.", "mercenary_tavern_talk", []],

  [anyone, "start", [
  (eq, "$talk_context", tc_tavern_talk),
  ],
   "Any orders, {sir/madam}?", "mercenary_after_recruited", []],

  [anyone|plyr, "mercenary_after_recruited", [],
   "Make your preparations. We'll be moving at dawn.", "mercenary_after_recruited_2", []],
  [anyone|plyr, "mercenary_after_recruited", [],
   "Take your time. We'll be staying in this town for a while.", "mercenary_after_recruited_2", []],

  [anyone, "mercenary_after_recruited_2", [], "Yes {sir/madam}. We'll be ready when you tell us to leave.", "close_window", []],

  [anyone|plyr, "mercenary_tavern_talk", [(party_get_slot, ":mercenary_amount", "$g_encountered_party", slot_center_mercenary_troop_amount),
                                          (eq, ":mercenary_amount", "$temp"),
                                          (party_get_slot, ":mercenary_troop", "$g_encountered_party", slot_center_mercenary_troop_type),
                                          (call_script, "script_game_get_join_cost", ":mercenary_troop"),
                                          (store_mul, reg5, "$temp", reg0),                                          
                                          ],
   "All right. I will hire all of you. Here is {reg5} scillingas.", "mercenary_tavern_talk_hire", []],

Alot of things have changed in the mod.
The only dependencies I can see that would affect mercs (but not companions) is:
slot_center_mercenary_troop_type.
Much has moved around in module_constants where the slots are numbered, but I configured the slots numbers to be exactly the same as when this was working right.
It's a strange one as the numbers 90 and 91 repeat:
Code:
slot_center_npc_volunteer_troop_type   = 90  
slot_center_npc_volunteer_troop_amount = 91
slot_center_mercenary_troop_type  = 90
slot_center_mercenary_troop_amount= 91
slot_center_volunteer_troop_type  = 92
slot_center_volunteer_troop_amount= 93

Why is it skipping the first "anyone, "start" for both new companions and mercenaries in taverns?
What other areas can I test or look into?
Do other mods use a flag to prevent the troops for defaulting to the 2nd "anyone start"?

Note: When the player replies at "mercenary_after_recruited", the mercenary or companion does NOT join the party.
Essentially, there's no way to get anyone to join the player party because of this bug.
 
gdwitt said:
Why is it skipping the first "anyone, "start" for both new companions and mercenaries in taverns?

dialogs have two blocks: condition and consequence. If any of the conditions fail (like a eq test), that dialog won't be used.

It also reads from top-bottom, so it will select the first where all conditions are true (or all of them if its the player turn to choose a option).

How to figure this out? Add some (display_message) in there, debug your variables and find which line is false/failing. Then investigate why (missing slot, bug, etc)
 
Hello There !

I would want to change the photo that is showed in my module, how do I change it ?

7oGheWF.png
 
How to figure this out? Add some (display_message) in there, debug your variables and find which line is false/failing. Then investigate why (missing slot, bug, etc)

How would I add debugs to a set of parameters that aren't being called?
Let's say it's a module constant. How could I tell if that caused the rejection? It's not as if it runs through a script when it calls constants.
What if I put it just before party_get_slot, ":mercenary_troop", "$g_encountered_party", slot_center_mercenary_troop_type?

Right now I'm recomparing the new module_constants with another old version looking at mercs and companions.
What I don't get is why the companions suddenly stopped being recruited.
I never touched their script while I reverted the mercenary hire script to an old one, which caused this.
But bringing back the newer script causes them to tell players "Surrender or die!" in taverns.
 
Do you see this in the Dialog check condition block?  (neg|troop_is_hero, "$g_talk_troop")
This is the only variable I can't seem to check.
Where is it set up? I only see it as a define in headeroperations not module_constants.
My theory is that somehow all the normal mercenaries have been assigned as heroes.

Thank you for the dialog thread. I'll read it.
NEW updated post:
[anyone, "start", [
                  (try_begin),
                  (ge, "$cheat_mode", 1),
                  # (assign,"$debugflag1",1),
                  (display_message, "@{!}DEBUG: testing mercenary talk start line 2"),
                (try_end),
                    (eq, "$talk_context", tc_tavern_talk),
                  (neg|troop_is_hero, "$g_talk_troop"),
                (try_begin),
                  (ge, "$cheat_mode", 1),
                  (display_message, "@{!}DEBUG: testing mercenaryhire after troop is hero"),
                (try_end),
                    (neg|is_between, "$g_talk_troop", "trp_briton_merchant", "trp_startup_merchants_end"),
                    (party_get_slot, ":mercenary_troop", "$g_encountered_party", slot_center_mercenary_troop_type),
                    (party_get_slot, ":mercenary_amount", "$g_encountered_party", slot_center_mercenary_troop_amount),
                      (try_begin),
                        (ge, "$cheat_mode", 1),
                        (display_message, "@{!}DEBUG: testing mercenary talk after slot check"),
                      (try_end),
                    (gt, ":mercenary_amount", 0),
                    (store_sub, reg3, ":mercenary_amount", 1),
                    (store_sub, reg4, reg3, 1),
                    (call_script, "script_game_get_join_cost", ":mercenary_troop"),
                    (assign, ":join_cost", reg0),
                    (store_mul, reg5, ":mercenary_amount", reg0),
                      (try_begin),
                        (ge, "$cheat_mode", 1),
                        (display_message, "@{!}DEBUG: testing mercs after scriptjoin"),
                      (try_end),
                    (party_get_free_companions_capacity, ":free_capacity", "p_main_party"),
                    (val_min, ":mercenary_amount", ":free_capacity"),
                    (store_troop_gold, ":cur_gold", "trp_player"),
                    (try_begin),
                      (gt, ":join_cost", 0),
                      (val_div, ":cur_gold", ":join_cost"),
                      (val_min, ":mercenary_amount", ":cur_gold"),
                    (try_end),
                    (assign, "$temp", ":mercenary_amount"),
                    (try_begin),
                        (ge, "$cheat_mode", 1),
                        (display_message, "@{!}DEBUG: testing mercs end of check block"),
                      (try_end),
                    ],
I think the problem is (party_get_slot, ":mercenary_amount", "$g_encountered_party", slot_center_mercenary_troop_amount), is failing.
the debug messages below (gt, ":mercenary_amount", 0), are failing.
The slot is ok in module constants. Who sets up the amount of mercs in the tavern? Why are they standing there at value 0?

********Update: The mercenary troop amount is set up in game_menus in the "mead hall" section when troop goes in that door.
The script there is ok. However, what sets up how many mercs there are in the town in the first place?
I looked at "update_mercenaries" from game_start and it is the same as usual.
Is there a slot that needs to be initialized at game start that I'm missing?

********Update:  I think I found the problem. I reintroduced old scripts into the mod, but the slots were not formatted correctly for Lord Golias' new compiler (that I'm bound to due to the mod structure). If a slot is not in quotes, it is not recognized, but it doesn't give an error either.
 
Hello, guys, one question. I am getting this error when I compile:
Code:
ERROR: Usage of unassigned local variable: :town_merchant
But this is already declared in module constants quite clearly, like this: slot_town_merchant      = 23

So, any ideas or help? Thank you very much!
 
Status
Not open for further replies.
Back
Top Bottom