Findings on the new Module Builder

Users who are viewing this thread

Janus

*spicy* *camper*
Administrator
This is of course referring to the official Module Builder which Armagan just released.

I posted this in the bug forum, but it's probably more useful here, so I'm reproducing and cleaning it up here. Also, everyone else, post your findings as well!

First, I recommend editing your "build_module.bat" batch file a bit to fix Windows not knowing where Python is, and to clean things up a bit. You should edit the first line below and replace "C:\Python24" with your Python install folder, if it's different than the default. Here's my version of the file now line for line:
Code:
@set PATH=C:\Python24;%PATH%
python process_strings.py
python process_items.py
python process_map_icons.py
python process_factions.py
python process_scenes.py
python process_troops.py
python process_party_tmps.py
python process_parties.py
python process_quests.py
python process_scripts.py
python process_mission_tmps.py
python process_game_menus.py
python process_dialogs.py
@del *.pyc
@pause
Since it creates a bunch of PYC format files (compiled copies of the scripts) which are not needed after it finished, the "@del *.pyc" line cleans up all the temporary PYC files so you don't have to look at them.

The @ symbol at the start of a line (like I also added to the pause line) in a batch file makes it not show the command line being executed to the window, though it will still run it. No big deal, just makes the output a little cleaner.

I've checked, and Armagan's python scripts recreate every file other than "map.txt" and "module_info.txt", and of course the files in the SceneObj folder. Cool!


EDIT: Another tip, when editing the "module_info.py" file to point to the directory you're exporting to, be sure to use forward-slashes (/) instead of back-slashes (\) in the path. Normally for Windows it would be the other way around, but the scripts will not compile and will give you an EOL error if you use back-slashes.
 
I just got through adding new competitors to the arena fights with the module builder. This is pretty cool. :grin:



To add new competitors to the arena, you have to edit the "module_dialogs.py" file. Look for this section:
Code:
[trp_tournament_master,"arenamaster_fight", [[eq,"$zendar_arena_game_type",0]], "The next fight will be a two vs. two\
 melee. I still need a fighter for the blue team. Are you interested?", "arenamaster_will_you_fight",
   [
    [assign,reg(10),"trp_regular_fighter"],
    [assign,reg(11),"trp_regular_fighter"],
    [assign,reg(12),"trp_veteran_fighter"],
    [assign,reg(13),"trp_veteran_fighter"],
    [assign,reg(14),"trp_veteran_fighter"],
    [assign,reg(15),"trp_champion_fighter"],
    [assign,reg(16),"trp_champion_fighter"],
    [assign,reg(17),"trp_xerina"],
    [assign,reg(18),"trp_dranton"],
    [assign,reg(19),"trp_kradus"],
    [shuffle_range,10,20],
You can edit the list of competitors here. Just copy the line with trp_kradus and paste it below, then edit the number to 1 higher (20 from 19) and change the trp_kradus to whatever troop you want. The codes for them you can find in the "module_troops.py" file. Be sure to add the "trp_" extension to names of the troops found in this file.
Lastly, change the second value in "shuffle_range" from 20 to 1 higher than the number of people you now have listed.
So, for example, here is an edited part of the dialog:
Code:
    [assign,reg(19),"trp_kradus"],
    [assign,reg(20),"trp_dark_knight"],
    [assign,reg(21),"trp_dark_knight"],
    [assign,reg(22),"trp_hell_knight"],
    [assign,reg(23),"trp_hell_knight"],
    [assign,reg(24),"trp_hell_knight"],
    [assign,reg(25),"trp_Baron_Rolf"],
    [assign,reg(26),"trp_Constable_Hareck"],
    [shuffle_range,10,27],
There are seperate dialogs for 2v2 and 3v3 arena battles, but this section of each is the same. So you can copy your changes from one to the other.
Enjoy!
 
Janus said:
I've checked, and Armagan's python scripts recreate every file other than "map.txt" and "module_info.txt", and of course the files in the SceneObj folder. Cool!

Does that mean we can't redraw the world map, rename towns and such?
 
Khalid ibn Walid said:
Janus said:
I've checked, and Armagan's python scripts recreate every file other than "map.txt" and "module_info.txt", and of course the files in the SceneObj folder. Cool!
Does that mean we can't redraw the world map, rename towns and such?
The map.txt file just seems to determine the height map and maybe a few features (mountains, steppe, etc.) of the world, from the way it looks. Somebody correct me if I'm wrong, that's just a guess from looking at the file. Renaming towns is definitely possible with the Module Builder. :smile:

And, if you knew what you were doing, I imagine you could edit the map.txt file directly.
 
For people bothered by the ("process_dialogs.py:6: DeprecationWarning: Non-ASCII character '\x92' ") error at the end of compiling the scripts, read here to fix that (it's no real big deal though).


Now then, I've played around with the arena a bit more in the module system, changing betting. It now gives you different possibilities based on your current level. For player levels 1-2, you can choose 5 or 20 denars. Levels 3-5 can bet 5, 20, or 40. Levels 6-9 can bet 20, 40, or 75. Levels 10-19 can bet 40, 75, or 150. Levels 20+ can bet 75, 150, or 300.
Now then, how can you do this yourself? Edit the "module_dialogs.py" script, and find the following section:
Code:
  [trp_tournament_master|plyr,"arenamaster_will_you_bet", [[store_troop_gold,reg(0)],[ge,reg(0),5]], "I want to bet 5 denars.",
   "arenamaster_bet_placed",[[assign,"$zendar_bet_amount",5],[troop_remove_gold, "trp_player",5]]],
  [trp_tournament_master|plyr,"arenamaster_will_you_bet", [[store_troop_gold,reg(0)],[ge,reg(0),15]], "I want to bet 15 denars.",
   "arenamaster_bet_placed",[[assign,"$zendar_bet_amount",15],[troop_remove_gold, "trp_player",15]]],
  [trp_tournament_master|plyr,"arenamaster_will_you_bet", [[store_troop_gold,reg(0)],[ge,reg(0),30]], "I want to bet 30 denars.",
   "arenamaster_bet_placed",[[assign,"$zendar_bet_amount",30],[troop_remove_gold, "trp_player",30]]],
This is the dialog for your betting options. Now replace those lines completely with the following lines:
Code:
  [trp_tournament_master|plyr,"arenamaster_will_you_bet", [[store_character_level,reg(1)],[lt,reg(1),6],[store_troop_gold,reg(0)],[ge,reg(0),5]], "I can spare 5 denars.",
   "arenamaster_bet_placed",[[assign,"$zendar_bet_amount",5],[troop_remove_gold, "trp_player",5]]],
  [trp_tournament_master|plyr,"arenamaster_will_you_bet", [[store_character_level,reg(1)],[lt,reg(1),10],[store_troop_gold,reg(0)],[ge,reg(0),20]], "I want to bet 20 denars.",
   "arenamaster_bet_placed",[[assign,"$zendar_bet_amount",20],[troop_remove_gold, "trp_player",20]]],
  [trp_tournament_master|plyr,"arenamaster_will_you_bet", [[store_character_level,reg(1)],[ge,reg(1),3],[lt,reg(1),20],[store_troop_gold,reg(0)],[ge,reg(0),40]], "I'll go with 40 denars.",
   "arenamaster_bet_placed",[[assign,"$zendar_bet_amount",40],[troop_remove_gold, "trp_player",40]]],
  [trp_tournament_master|plyr,"arenamaster_will_you_bet", [[store_character_level,reg(1)],[ge,reg(1),6],[store_troop_gold,reg(0)],[ge,reg(0),75]], "Why not, I bet 75 denars.",
   "arenamaster_bet_placed",[[assign,"$zendar_bet_amount",75],[troop_remove_gold, "trp_player",75]]],
  [trp_tournament_master|plyr,"arenamaster_will_you_bet", [[store_character_level,reg(1)],[ge,reg(1),10],[store_troop_gold,reg(0)],[ge,reg(0),150]], "I'm pretty good. I'll bet 150 denars.",
   "arenamaster_bet_placed",[[assign,"$zendar_bet_amount",150],[troop_remove_gold, "trp_player",150]]],
  [trp_tournament_master|plyr,"arenamaster_will_you_bet", [[store_character_level,reg(1)],[ge,reg(1),20],[store_troop_gold,reg(0)],[ge,reg(0),300]], "They don't stand a chance. I bet 300 denars.",
   "arenamaster_bet_placed",[[assign,"$zendar_bet_amount",300],[troop_remove_gold, "trp_player",300]]],
You'll notice I changed the dialog a bit for variety.
That's it. Just compile the script and play using the mod folder you compiled to. :smile:

Any questions, feel free to ask.
 
Good work Janus. Can you (or anyone else) work out how to edit the map.txt? I remember Armagan said that it could be changed when the new mod tools came out.
 
Just looking at the file... the first number, 21830, is the count of how many lines for it to read after that (thus ending with line 21831). Then, on line 21832, there is another number indicating how many lines follow, 43071. So, 43071 lines of data later, you hit the end of the file.
What is the significance of that and what does each of the numbers in each line represent? No idea, though the first set (21830) are in a different format than the second set (43071). Maybe Armagan could shed some light on the layout of the file.

Secondly, I just modified the arena to have a 6v6 fight! What a rush. Talk about some crazy fighting in the little arena.
From the number of entry points in the arena now (without using edit mode in the game to change it) and the code already in place from Armagan in the arena scripting, it looks like the limit should be 8v8. I'm going to try that for the heck of it in a minute. :grin:

I think I'll go ahead and make a mod for people to download with all my arena changes after I get through playing around with it. :smile:


EDIT: 8v8 indeed works in the arena. And it is pure chaos. I love it. :lol:
 
thadivine said:
can ya change the number of fighters in the arena too?
Indeed. I'm actually about to release a mod in a few minutes which changes several things in the arena. Check back here in the mod forums in a bit. :smile:
 
Another tip for people working on mods, to help with compatibility with original savegames. When adding in new lines to the files, such as new conversations, new troops, and new items, it's best to add them to the end of the file after the other lines instead of inserting them in the middle of the file. Of course, make sure not to put them outside the main overall braces ("]") that hold the list.
The reason for this is that the scripts number each item based on the order it is in the file; if you add new ones in the middle, it changes the reference number for every item below that. This might affect the items, quests, and so forth that a savegame contains since the reference numbers changed.
If you add it to the end, it is assigned a previously unused reference number.

It doesn't matter if the questions and responses are not together; one could be towards the start of the file and a new response at the bottom of the file without a problem.

The above doesn't apply to modified lines, which should stay where they are.

Furthermore, when releasing new versions of a mod, add each version's new lines below the last version for the same reason of compatibility.

At least all of this is what I gather of the way it works; I know for sure that inserting lines renumbers everything, but it is just my assumption this could potentially cause problems.

EDIT: I now know this to be true. As I was testing adding a short weak arena hammer to the items, I added it towards the top of the file with the other practice equipment. When I loaded up an old game, my character (which was still with crappy starter equipment) then had a charger horse in a weapon slot, some tools in the horse slot, and so forth. Heh. An amusing example, I suppose. :lol:
 
This is the same way it worked before really but hopefully it still doesnt matter with conversations.txt. If you were forced to add out of sequence conversation bits to expand a conversation the whole thing would degenerate into barely readable spaghetti code over time.

For items, quests, troops, etc, thats normal.
 
Yeah, you're probably right.
An exception I've found though: if you use a new variable (you don't declare them, the script itself compiles the list of them) which shows up in a conversation in the middle of the file, it will change the order of the variable list as well. I've been doing file comparisons on the compiled scripts vs an unedited copy of the compiled scripts to see exactly what changed in eahc file, and which files are needed, and I've noticed it doing that.
So conversations where you've added new variables are better off at the bottom.
 
hey, is it possible for you to release the info on changing arena # of fighters, i would like to try to add some more arenas and stuff, ofcourse you may release it on your name (if i succeed...)
 
Just download the v1.3 source files for my Arena Expansion mod. It's got comments throughout which explain pretty much what each line related to the arena does, even ones that are standard (not added by me).
 
OK, i played around a bit with the tools now, tried some simple copying and stuff.

I am trying to let the trainer set another tournement, but then like jackychan(?) in zendar center...(lol 8 vs 8 fight in zendar center with horses :grin: ) Now when the conversation comes to, "its always hard to choose whats next" thing I cant choose any options...

WHy????

(srry for double post btw)
 
You probably need to add the proper entry points to the town center. Entry points 0-7 should be for the red team, and 8-15 for the blue team (the way it's set up now).
 
Janus said:
You probably need to add the proper entry points to the town center. Entry points 0-7 should be for the red team, and 8-15 for the blue team (the way it's set up now).

Well, I have no xp of moding but is it the town center or the tournament area that the entry points are to be added?
 
Back
Top Bottom