B Tutorial Scenes Quick Scene Chooser

Users who are viewing this thread

dstemmer

Knight at Arms
QUICK SCENE CHOOSER by dstemmer

Now at version 2! REQUIRES Python 2.6
. Make sure to set your PATH variable correctly to point to your Python 2.6 directory.

This is a modding tool that allows you to jump to any scene defined in your module_scenes file from the quick battles menu, in order to make scene editing more convenient. Just select the “scene chooser” option to browse through an alphabetically organized list of scene files. Press the tab key to return to the menu.

Changes in version 2:

  • adds a list of scene flags to each scene option on the menu

Changes in version 1:

  • bugfixed code
  • includes game_menu_template.py, which allows the creation game menus with text and menu options dynamically generated from long lists. Uses standard python 2.6 string formatting notation. I'll write a tutorial when I get the chance, but for now you can examine the code - it's pretty easy to figure out how to do it.

Installation:

Repository link: http://www.mbrepository.com/file.php?id=1247

  • Download "Quick scene chooser files.rar" from the repository. Unzip “template_tools.py”  into your module directory:
  • Add the following lines to the end of module_game_menus.py, after the last bracket:


Code:
import header_scenes
from template_tools import *
from module_scenes import scenes

sorted_scenes = sorted(scenes)
for i in xrange(len(sorted_scenes)):
  current_scene = list(sorted_scenes[i])
  current_scene[1] = get_flags_from_bitmap(header_scenes, "sf_", current_scene[1])
  sorted_scenes[i] = tuple(current_scene)

choose_scene_template = Game_Menu_Template(
  id="choose_scenes_",
  text="Choose a scene: (Page {current_page} of {num_pages})",
  optn_id="choose_scene_",
  optn_text="{list_item[0]}{list_item[1]}",
  optn_consq = [
    (jump_to_scene, "scn_{list_item[0]}"),
    (change_screen_mission)
  ]
)

game_menus += choose_scene_template.generate_menus(sorted_scenes)

  • Use ctrl-f to search game_menus.py and find the following two lines, and copy/paste the code in red between them:


("custom_battle_scenario_6",[],"Siege Attack",
  [
      (assign, "$g_custom_battle_scenario", 4),
      (jump_to_menu, "mnu_custom_battle_2"),
    ]
),
("choose_scene",[],"Scene Chooser",
  [(jump_to_menu, "mnu_choose_scenes_0"),]
),

("go_back",[],"Go back",
  [(change_screen_quit)]
),

Note: the code you see may be indented differently than mine

  • Then just build module and you're done!

Bugs:

There's a minor issue with flag strings not being output properly in all cases, but you won't see it. I'll fix it in the next release.

Comments:

I was inspired to make this mod after seeing a similar tool in the M&B repository designed by MAXHARDMAN, but I've never actually used his tool or looked at the code. I think his was for an older version. The code is freely reusable by anybody, no credit needed. Many thanks to the M&B modding community for helping me this far!
 
Now how about a dialogue after that that'll let you place visitor troops, friendly or hostile, on all the entry points? :wink:

Oh, and allow choosing of the mission template as well.

Come on! It's not that hard!

Suggestively,
Winter
 
Winter said:
Come on! It's not that hard!

Winter said:
MAKE THEE AN ARK OF GOPHER WOOD; ROOMS SHALT THOU MAKE IN THE ARK, AND SHALT PITCH IT WITHIN AND WITHOUT WITH PITCH. AND THIS IS THE FASHION WHICH THOU SHALT MAKE IT OF: THE LENGTH OF THE ARK SHALL BE THREE HUNDRED CUBITS, THE BREADTH OF IT FIFTY CUBITS, AND THE HEIGHT OF IT THIRTY CUBITS.

I'll see what I can do.  :grin:
 
My text file, although opened with notepad, (I also tried opening it with a hex editor) doesn't have the lines in it, in which I need to insert the red lines.

So... am I an idiot, is this a problem with vista, or is this a problem with my choice of programs?
 
Penlord said:
... is this a problem with vista...

:lol:

Ehm, seriously.
It refers to files in the module system. Get python 2.5, make sure to create a system path, then download the module system, extract it, right click on the .py files you want to open(usually only module_blabla.py) and select "edit with IDLE". There you go.

(Note how he wrote e. g. module_scene_chooser.py)
 
Very handy tool.
Thank you, dstemmer.

There were problems because of the scene sorting. So I removed the sorting. And for me without the sorting it became even easy to navigate through scenes.
 
Sorry it's been taking so long for an update - I'm moving back into a dorm at school right now and my laptop is currently kaputt, and I need to transfer the relevant files from the hard drive before sending it into the manufacturer for repair.

Rongar, could you elaborate on the problems with the scene sorting? The only bug I found is that the scene chooser was displaying one too few scenes/page, making some scenes inaccessible. I've fixed that for the next version. It's now possible to see the flags associated with each scene.
 
There is no problem with sorting in Quick Scene Chooser itself.
But then scenes are sorted it is impossible to play normally, because most of scene's indexes lead to wrong scenes. The sorting mix then up.
 
Update: forgot to pull the files from my hard drive before sending it to the manufacturer, and apparently repair is going to take awhile (the motherboard has a defective chip and Everex is replacing all of that model of laptop out-of-warranty, but they've needed to replace so many that they're waiting on a new shipment from the manufacturer). So no update for awhile. Sorry.
 
Does this work with the latest version of B&M?

And the reason why I'm asking that is because I can't find any .py files in the B&M directory to edit...

And I dunno where to put the .py file I downloaded...

(I know I's nubbish)


Can anyone help or answer the question?
 
you need the official module system (python programming language) which is used to create all the *.txt files that the game uses to play.

Download - http://forums.taleworlds.com/index.php/topic,49267.0.html
updated tutorial - http://forums.taleworlds.com/index.php/topic,56798.0.html
 
Hey there!

I'm experiencing the next problem:

8y9O6c3rS3.jpg
Using Python 2.6. Please help if you can. Thanks beforehand.

Kindest Regards, LB.
 
Wow, it's good to see people are using this.

I lost all of my data on this project when my laptop died but I've restarted work on it and now I'm revamping it. Expect a bugfix in the next few days (for real this time).
 
Back
Top Bottom