Editing the randomly generated SP maps in WFaS...

正在查看此主题的用户

DJK83

Sergeant
I was originally using MB Tweak to increase the size of the SP maps, but the problem was that they all got way too hilly at large sizes. So, I did a bit of research, and discovered that you can actually turn on editing mode and then load up single player and use the terrain editor to modify the map "codes" (located in the scenes.txt).

That's what I've been trying to do, but I've run into several problems: the first one was that, in the beginning, only changes to the size would take effect, and nothing else. (I confirmed it my making a map that was much longer than it was wide, and that change worked). I did a bit more research and found that there are files associated with each map that are located in the SceneObj folder, so I deleted them. Now, it seems that changes I make have some effect, but I have to load the map up twice in order to see those changes. What I mean is that, in cheat mode, the first time I click "walk around", nothing has changed, but when I click Tab, and then immediately click "walk around" again, the map is suddenly much flatter like I want it to be.  So, does anyone have any ideas?
 
I'm not certain if deleting the .sco files is useful or a good idea in this case.

You might want to check Scene .SCO Toolset - heightmap converters, object placers, and texture importers! Oh my! and the various things linked within. Swyter somewhere has a web-based program to generate the hex codes for the scene.txt file. You could use it to generate a code with no hills/ruggedness, for instance, but note that as the scenes are randomly generated, it just takes those values as a starting point and then generates from there (if it uses them at all--I'm not convinced it does if the random flag is used).
 
I think you're right, because I found that web-based program and set the hills to 0, but it didn't make any difference. So I guess the question is, is there any way to stop it from randomizing the hill height? I really want to play with bigger maps, but terrain this hilly just isn't gonna work...
 
I'm not aware of one, at least not while still using randomized scenes. I messed around with this for a good while six months ago or so but came up empty while the randomize flag was active. But, I'm by far not the most versed in how scene generation goes with the engine, so hopefully someone else can chime in.
 
AFAIK random flag means that scene heightmap will be randomly generated with ruggedness matching current player's position on the map. So the only things affected by sco file in this case are ground/tree textures.
 
Well then, two questions: First, is there any way to limit just how high it makes the hills? Second, when you remove the random flag, and force it to load the exact terrain you've made (which is what I've resorted to at the moment), is it possible to make it choose between several different terrain codes that you've pre-made for it?
 
DJK83 说:
Well then, two questions: First, is there any way to limit just how high it makes the hills?
No, that's hardcoded. You can try to hack this behavior by teleporting player's party to another spot on the global map before moving him to battle, but that's untested and quite tricky even if it's possible.

DJK83 说:
Second, when you remove the random flag, and force it to load the exact terrain you've made (which is what I've resorted to at the moment), is it possible to make it choose between several different terrain codes that you've pre-made for it?
Perfectly possible. Find the script which picks the random battleground and change it to your heart's content. :smile:
 
Lav 说:
DJK83 说:
Second, when you remove the random flag, and force it to load the exact terrain you've made (which is what I've resorted to at the moment), is it possible to make it choose between several different terrain codes that you've pre-made for it?
Perfectly possible. Find the script which picks the random battleground and change it to your heart's content. :smile:

Oh, good. Do you have any idea where that is? Or, wait, do you mean in the scenes file itself, towards the top where the map codes for the battlegrounds are? Because I did actually try adding a comma, and then another map code, but I got a ton of errors while trying to build the modules. Basically, this is what I tried to do, which failed:

插入代码块:
[],[], "outer_terrain_steppe"),
  ("random_scene_plain",sf_generate|sf_auto_entry_points,"none", "none", (0,0),(240,240),-0.5,"0x0000000229602800000691a400003efe00004b34000059be", "0x00000003ac0042800007d9f7000005cf00004b34000059be"
 
Alright, how exactly do I give it several terrain codes to choose from? What I've tried so far hasn't worked. First I copied one of the entries in the scenes file, and then changed the name of it, so it looked like this:

New entry in blue.

 
("random_scene_steppe",sf_generate|sf_randomize|sf_auto_entry_points,"none", "none", (0,0),(240,240),-0.5,"0x0000000229602800000691a400003efe00004b34000059be",
    [],[], "outer_terrain_steppe"),
  ("random_scene_plain",sf_generate|sf_auto_entry_points,"none", "none", (0,0),(240,240),-0.5,"0x000000013520440000096258000057d700004b3400005f25",
    [],[], "outer_terrain_steppe"),
  ("random_scene_plain_b",sf_generate|sf_auto_entry_points,"none", "none", (0,0),(240,240),-0.5,"0x00000003ac0042800007d9f7000005cf00004b34000059be",

    [],[], "outer_terrain_plain"),
  ("random_scene_snow",sf_generate|sf_randomize|sf_auto_entry_points,"none", "none", (0,0),(240,240),-0.5,"0x0000000229602800000691a400003efe00004b34000059be",
    [],[], "outer_terrain_snow"),
  ("random_scene_desert",sf_generate|sf_randomize|sf_auto_entry_points,"none", "none", (0,0),(240,240),-0.5,"0x0000000229602800000691a400003efe00004b34000059be",
    [],[], "outer_terrain_desert_b"),
  ("random_scene_steppe_forest",sf_generate|sf_randomize|sf_auto_entry_points,"none", "none", (0,0),(240,240),-0.5,"0x300028000003e8fa0000034e00004b34000059be",
    [],[], "outer_terrain_plain"),
  ("random_scene_plain_forest",sf_generate|sf_randomize|sf_auto_entry_points,"none", "none", (0,0),(240,240),-0.5,"0x300028000003e8fa0000034e00004b34000059be",
    [],[], "outer_terrain_plain"),
  ("random_scene_snow_forest",sf_generate|sf_randomize|sf_auto_entry_points,"none", "none", (0,0),(240,240),-0.5,"0x300028000003e8fa0000034e00004b34000059be",
    [],[], "outer_terrain_snow"),
  ("random_scene_desert_forest",sf_generate|sf_randomize|sf_auto_entry_points,"none", "none", (0,0),(240,240),-0.5,"0x300028000003e8fa0000034e00004b34000059be",
    [],[], "outer_terrain_desert"),

Then I tried to add the name of my new entry to the scripts file, so that it could choose from the original "scn_random_scene_plain" or my new "scn_random_scene_plain_b". Here's what I did:

New entry in red.

       
(eq, ":terrain_type", rt_plain),
        (assign, ":scene_to_use", "scn_random_scene_plain", "scn_random_scene_plain_b"),
      (else_try),

It had no problem building the module, but no matter how many times I loaded the map in-game, it only loaded the first one. What am I doing wrong?
 
"outer_terrain_steppe" is the identifier of a scene. It is referenced in the script as "scn_outer_terrain_steppe". Scene identifiers must be unique.

You have two scenes with identical identifiers - therefore, the second is ignored.

What you need is to make two entries with different names, like "outer_terrain_steppe_a" and "outer_terrain_steppe_b" for example. Then in the script, instead of selecting a specific steppe scene, you need to generate a random number and pick one of the available scenes depending on this random value.
 
Your other alternative to setting up multiple scenes would be try to use the Warband Script Enhancer, as it adds operations that allow you to manipulate the hex code of a single scene in-game.

插入代码块:
scene_set_flags         = 4500 #(scene_set_flags, <scene_no>, <flags>), #Sets <scene_no>'s flags to <flags>
scene_set_water_level   = 4501 #(scene_set_water_level, <scene_no>, <water_level_fixed_point>), #Sets <scene_no>'s water level to <water_level_fixed_point>
scene_set_bounds        = 4502 #(scene_set_bounds, <scene_no>, <min_x_fixed_point>, <min_y_fixed_point>, <max_x_fixed_point>, <max_y_fixed_point>), #Sets <scene_no>'s bounds to (<min_x_fixed_point>, <min_y_fixed_point>) and (<max_x_fixed_point>, <max_y_fixed_point>)
scene_set_outer_terrain = 4503 #(scene_set_outer_terrain, <scene_no>, <outer_terrain_mesh_name>), #Sets <scene_no>'s outer terrain to <outer_terrain_mesh_name>
scene_set_terrain_seed  = 4504 #(scene_set_terrain_seed, <scene_no>, <value>), #Sets <scene_no>'s terrain generator terrain seed to <value>
scene_set_river_seed    = 4505 #(scene_set_river_seed, <scene_no>, <value>), #Sets <scene_no>'s terrain generator river seed to <value>
scene_set_flora_seed    = 4506 #(scene_set_flora_seed, <scene_no>, <value>), #Sets <scene_no>'s terrain generator flora seed to <value>
scene_set_deep_water    = 4507 #(scene_set_deep_water, <scene_no>, <value>), #Enables or disables terrain generator deep water for <scene_no>
scene_set_place_river   = 4508 #(scene_set_place_river, <scene_no>, <value>), #Enables or disables terrain generator river placement for <scene_no>
scene_set_disable_grass = 4509 #(scene_set_disable_grass, <scene_no>, <value>), #Enables or disables terrain generator grass placement for <scene_no>
scene_set_valley_size   = 4510 #(scene_set_valley_size, <scene_no>, <value>), #Sets <scene_no>'s terrain generator valley size to <value> (0-127)
scene_set_hill_height   = 4511 #(scene_set_hill_height, <scene_no>, <value>), #Sets <scene_no>'s terrain generator hill height to <value> (0-127)
scene_set_ruggedness    = 4512 #(scene_set_ruggedness, <scene_no>, <value>), #Sets <scene_no>'s terrain generator ruggedness to <value> (0-127)
scene_set_vegetation    = 4513 #(scene_set_vegetation, <scene_no>, <value>), #Sets <scene_no>'s terrain generator vegetation to <value> (0-127)
scene_set_size          = 4514 #(scene_set_size, <scene_no>, <x>, <y>), #Sets <scene_no>'s terrain generator map size to (<x>, <y>) (0-1023)
scene_set_region_type   = 4515 #(scene_set_region_type, <scene_no>, <value>), #Sets <scene_no>'s terrain generator region type to <value> (0-15)
scene_set_region_detail = 4516 #(scene_set_region_detail, <scene_no>, <value>), #Sets <scene_no>'s terrain generator region detail to <value> (0-3)
 
Lav 说:
"outer_terrain_steppe" is the identifier of a scene. It is referenced in the script as "scn_outer_terrain_steppe". Scene identifiers must be unique.

You have two scenes with identical identifiers - therefore, the second is ignored.

What you need is to make two entries with different names, like "outer_terrain_steppe_a" and "outer_terrain_steppe_b" for example. Then in the script, instead of selecting a specific steppe scene, you need to generate a random number and pick one of the available scenes depending on this random value.

Wow, I'm confused. I can't find "scn_outer_terrain_steppe" in the script file. I only see it in the scenes file. What I see in the script file is "scn_random_scene_plain". Am I looking in the wrong place? Also, what exactly do you mean by generate a random number? How do I do that?

Caba`drin 说:
Your other alternative to setting up multiple scenes would be try to use the Warband Script Enhancer, as it adds operations that allow you to manipulate the hex code of a single scene in-game.

插入代码块:
scene_set_flags         = 4500 #(scene_set_flags, <scene_no>, <flags>), #Sets <scene_no>'s flags to <flags>
scene_set_water_level   = 4501 #(scene_set_water_level, <scene_no>, <water_level_fixed_point>), #Sets <scene_no>'s water level to <water_level_fixed_point>
scene_set_bounds        = 4502 #(scene_set_bounds, <scene_no>, <min_x_fixed_point>, <min_y_fixed_point>, <max_x_fixed_point>, <max_y_fixed_point>), #Sets <scene_no>'s bounds to (<min_x_fixed_point>, <min_y_fixed_point>) and (<max_x_fixed_point>, <max_y_fixed_point>)
scene_set_outer_terrain = 4503 #(scene_set_outer_terrain, <scene_no>, <outer_terrain_mesh_name>), #Sets <scene_no>'s outer terrain to <outer_terrain_mesh_name>
scene_set_terrain_seed  = 4504 #(scene_set_terrain_seed, <scene_no>, <value>), #Sets <scene_no>'s terrain generator terrain seed to <value>
scene_set_river_seed    = 4505 #(scene_set_river_seed, <scene_no>, <value>), #Sets <scene_no>'s terrain generator river seed to <value>
scene_set_flora_seed    = 4506 #(scene_set_flora_seed, <scene_no>, <value>), #Sets <scene_no>'s terrain generator flora seed to <value>
scene_set_deep_water    = 4507 #(scene_set_deep_water, <scene_no>, <value>), #Enables or disables terrain generator deep water for <scene_no>
scene_set_place_river   = 4508 #(scene_set_place_river, <scene_no>, <value>), #Enables or disables terrain generator river placement for <scene_no>
scene_set_disable_grass = 4509 #(scene_set_disable_grass, <scene_no>, <value>), #Enables or disables terrain generator grass placement for <scene_no>
scene_set_valley_size   = 4510 #(scene_set_valley_size, <scene_no>, <value>), #Sets <scene_no>'s terrain generator valley size to <value> (0-127)
scene_set_hill_height   = 4511 #(scene_set_hill_height, <scene_no>, <value>), #Sets <scene_no>'s terrain generator hill height to <value> (0-127)
scene_set_ruggedness    = 4512 #(scene_set_ruggedness, <scene_no>, <value>), #Sets <scene_no>'s terrain generator ruggedness to <value> (0-127)
scene_set_vegetation    = 4513 #(scene_set_vegetation, <scene_no>, <value>), #Sets <scene_no>'s terrain generator vegetation to <value> (0-127)
scene_set_size          = 4514 #(scene_set_size, <scene_no>, <x>, <y>), #Sets <scene_no>'s terrain generator map size to (<x>, <y>) (0-1023)
scene_set_region_type   = 4515 #(scene_set_region_type, <scene_no>, <value>), #Sets <scene_no>'s terrain generator region type to <value> (0-15)
scene_set_region_detail = 4516 #(scene_set_region_detail, <scene_no>, <value>), #Sets <scene_no>'s terrain generator region detail to <value> (0-3)

Oh boy, I don't even know anything about the Warband Script Enhancer. I just found it on the forums, and it doesn't say anything about supporting WFaS. Although, I watched a few videos on the author's YouTube channel, and saw a few really cool things, like horses tripping over other horses. So now I'm really curious as to whether it supports WFaS. But assuming it does, how exactly would I use the code you posted there? Forgive me, but my Mount & Blade modding experience is rather limited.
 
Oh, so it doesn't support WFaS. That sucks. Well then, hopefully Lav can explain how to use multiple terrain codes.
 
You need to have something along these lines in your module_scenes:
插入代码块:
  ("random_scene_steppe_1",sf_generate|sf_auto_entry_points,"none", "none", (0,0),(240,240),-0.5,"0x0000000229602800000691a400003efe00004b34000059be",
    [],[], "your_sco_file_number_1"),
  ("random_scene_steppe_2",sf_generate|sf_auto_entry_points,"none", "none", (0,0),(240,240),-0.5,"0x0000000229602800000691a400003efe00004b34000059be",
    [],[], "your_sco_file_number_2"),
Add one entry for each sco file you have, and give them different names (this is what you didn't do). The game needs those names to distinguish the scenes. Make sure scene definitions are grouped together (not scattered around the file) - this makes selecting them randomly easier. It doesn't matter how you name them - for as long as those names are unique.

Then in your module_scripts, find the block responsible for this type of terrain (steppe in my example) and replace the (assign, ":scene_to_use", "scn_random_scene_steppe"), line with the following two lines:
插入代码块:
    (store_random_in_range, ":scene_to_use", 0, 2),
    (val_add, ":scene_to_use", "scn_random_scene_steppe_1"),
In the first line, 2 is the total number of scenes you have in module_scenes for this type of terrain. In my example, there are 2 predefined maps for steppe terrain, so I used this number. If you have 50, place 50 instead of 2. It's simple.

In the second line, you need to reference the first of scenes that you defined. In my example, I defined "random_scene_steppe_1" and "random_scene_steppe_2", the first is "random_scene_steppe_1", so it is the one I reference in the script.
 
Alright, I followed the instructions, and I've made some progress (and I appreciate your help so far). It now randomly chooses a map from the codes I've provided, but there's one problem: it doesn't seem to load the .sco files, because none of the new maps have any background. Once the usable area of the map ends, there's nothing. I'm not sure what I did wrong, because I made several copies of the appropriate sco file (in this case, "scn_random_scene_plain.sco"), and renamed it to correspond with the name of the new entries in scenes. There's "scn_random_scene_plain_2.sco, "scn_random_scene_plain_3.sco, etc. But it doesn't seem to be using them. So, what am I missing? Here are what the new entries look like in scenes:

 
插入代码块:
("random_scene_plain_1",sf_generate|sf_auto_entry_points,"none", "none", (0,0),(240,240),-0.5,"0x000000013520440000096258000057d700004b3400005f25",
    [],[], "outer_terrain_plain_1"),
  ("random_scene_plain_2",sf_generate|sf_auto_entry_points,"none", "none", (0,0),(240,240),-0.5,"0x0000000133e044000009625800003a7800004b3400006782",
    [],[], "outer_terrain_plain_2"),
  ("random_scene_plain_3",sf_generate|sf_auto_entry_points,"none", "none", (0,0),(240,240),-0.5,"0x0000000132e044000009625800005e7f00004b340000443b",
    [],[], "outer_terrain_plain_3"),
 
Damn. My mistake. Correct code:

插入代码块:
  ("random_scene_steppe_1",sf_generate|sf_auto_entry_points,"none", "none", (0,0),(240,240),-0.5,"0x0000000229602800000691a400003efe00004b34000059be",
    [],[], "outer_terrain_steppe"),
  ("random_scene_steppe_2",sf_generate|sf_auto_entry_points,"none", "none", (0,0),(240,240),-0.5,"0x0000000229602800000691a400003efe00004b34000059be",
    [],[], "outer_terrain_steppe"),
I forgot that the last element in each declaration is not the sco file, but the mesh for the hills surrounding the scene. So they should be left as they are.
 
Yeah, haha, I ended up figuring that out. It's no problem. Thanks for your help! It's working great now. :smile: One more question: Is there any limit to how many separate maps I can make it choose from, or could I theoretically have hundreds?
 
后退
顶部 底部