UpdateModuleParties v1.1 - update module_parties.py after using Map Editor

Users who are viewing this thread

HokieBT

Grandmaster Knight
Description:
This program will create a module_parties_new.py by reading the python code from an existing module_parties.py and the following data from a parties.txt file:
    - field  2: party name
    - field 10: initial coordinates
    - field 12: party direction in degrees (optional)

This is helpful if you use the Map Editor to move or rename parties on the world map but want to re-build your module using module_parties.py in the future.

NOTE:  Currently this program only updates parties that exist in both module_parties.py and parties.txt, so you cannot create new parties in the map editor and expect those to be copied to module_parties.py.  You must create any new parties in module_parties.py first.

Instructions:
Place a module_parties.py and parties.txt in the same folder as this executable and run it.

Possible Workflow:
1) create new towns/castles/villages in module_parties.py, run build_module.bat, create a parties.txt file.
2) use the Map Editor to move/rename/rotate parties on the map, save changes to parties.txt
3) put module_parties.py and parties.txt into the same folder as UpdateModuleParties.exe, run it and it should create module_parties_new.py
4) rename module_parties_new.py to module_parties.py (backup your old module_parties.py)
5) re-run build_module.bat, launch your mod and the towns should be in the correct location

Download:
http://www.mbrepository.com/file.php?id=884

Version History:
v1.0 September 24, 2008 - initial release, only allowed updating party coordinates.
v1.1 December 22, 2008 - modified program to update names and rotation.

Notes:
- this has only been tested very briefly so please post in the forum if there are any problems or suggestions.
- Some changes, like updating the icons, which can be made with the Map Editor will not be updated in module_parties_new.py
- There are some other programs available that reverse-engineer the parties.txt to create python code.  You can use these as an alternative to this program:
    kt0's party script - http://forums.taleworlds.com/index.php/topic,61873.0.html
    nath9091's C++ code - http://forums.taleworlds.com/index.php/topic,74416.0.html
 
hehe, glad a few other people are finding this helpful.  My first time using the map editor was a couple weeks ago and I was a little confused how people got around this issue in the past...  They must have been manually modifying the parties.txt or module_parties.py file!?!?!  I'm way too lazy efficient for that.  :wink:
 
Very useful tool HokieBT.

And I want to ask is it too difficult to make the program to change/update the names of the settlements as well?
 
Thank you, thank you and once again thank you...

I was wondering if it would also be possible for it to update Icons and rotation, would help a lot with bridges...

Edit: I've been using it a bit more and it doesn't seem to work quite perfectly when you add additional parties. I've added a few extra towns and when I run this program they all get the same coordinates...
 
This worked quite well for me, thanks for it!
Still, there is one bug, easy to rollback, though.
The programme somehow changed this line:

  ("main_party","Main Party",icon_player|pf_limit_members, no_menu, pt_none,fac_player_faction,0,ai_bhvr_hold,0,(17,52.50),[(trp_player,1,0),(trp_heavy_infantry,20,0)]),

to this:

  ("main_party","Main Party",icon_player|pf_limit_members, no_menu, pt_none,fac_player_faction,0,ai_bhvr_hold,0,(17,52.50),[(trp_player,1,0),)trp_heavy_infantry,20,0
 
thanks for the feedback guys.

Stoker - I think as long as the party id (ie. town_1:cool: is unique it should work... Can you post an example of your code?  updating icons and rotation might be possible as well, I'll take a look.

Highlander - ahhh, thats a bug.  I think I know the problem and will try to fix it in the next release that will hopefully update the names as well.
 
Llew2 said:
So, any update on this? Have you gotten the names work yet?
hehe, I was actually working on a final exam most of this week and just submitted it a few minutes ago.  So now I can try and get back to this and other M&B stuff.  :wink:  I'm hoping to update this so it can do the names and maybe icons & rotation.  I'll take a look tomorrow and try to post something in the next day or so.  thanks for the interest.

Edit: my weekend is going to be really busy, so it might be early next week before I can look at this.
 
Here's a minor update I created this weekend so that party names and rotation are also updated in the python code.  I did not include the ability to update the icon since I'm not quite sure how to do the math to convert the party flag in parties.txt correctly...  I've only briefly tested this, so please let me know if there are any problems or questions, thx.

download - https://www.mbrepository.com/file.php?cid=3&id=884
 
Seems a bit confusing really.  :???:

So, the module_parties_new.py should be exactly the same as module_parties.py only with different coordinates for any towns I've moved?
 
Wow, can you do this with any other file?  Like, can I update say module_items with item_kinds1.txt using this program?

Or is there a way to enable one to do so?
 
nope, this was only created to update module_parties.py since the map editor only updates parties.txt.  You'd have to create another program if you wanted to update something like the items file.
 
maybe I'm not getting this...  I am supposed to copy parties txt, drop it into update blah blah blah, and then drop in a copy of mudule_parties and double click the icon, which is located in program files?  or is it done differently?
 
Dudro said:
maybe I'm not getting this...  I am supposed to copy parties txt, drop it into update blah blah blah, and then drop in a copy of mudule_parties and double click the icon, which is located in program files?  or is it done differently?

yeah, put your module_parties.py and parties.txt into the same folder as this executable and then double-click it.  It should created a module_parties_new.py, which you would then use to replace your original module_parties.py.  I didn't want to automatically overwrite module_parties.py increase there was a problem, etc... But this will allow you to re-build your mod and keep the changes you made with the map editor. 
 
Back
Top Bottom