Author Topic: UpdateModuleParties v1.1 - update module_parties.py after using Map Editor  (Read 4793 times)

0 Members and 1 Guest are viewing this topic.

HokieBT

  • Grandmaster Knight
  • *
  • may the force be with you
    • View Profile
  • Faction: Neutral
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.net/index.php/topic,61873.0.html
     nath9091's C++ code - http://forums.taleworlds.net/index.php/topic,74416.0.html
« Last Edit: February 09, 2012, 03:39:03 AM by HokieBT »
 

Kievan Mereel

  • Squire
  • *
    • View Profile
  • Faction: Neutral
  • M&B
Re: Update Party Coordinates from parties.txt into module_parties.py
« Reply #1 on: September 25, 2008, 07:47:37 PM »
Ooh, thank you so much for this.  I've ran into this exact problem, and this is exactly what I needed!
Liberty or Death (for .903)
A mod set in the American War for Independence.  Redcoats, massive musket battles, & custom map of the 13 colonies.
See the progress on the version for 1.011!

FerdiadITA

  • Squire
  • *
    • View Profile
  • Faction: Neutral
Re: Update Party Coordinates from parties.txt into module_parties.py
« Reply #2 on: October 13, 2008, 07:48:28 AM »
That will save a lot of time,nice job :).

HokieBT

  • Grandmaster Knight
  • *
  • may the force be with you
    • View Profile
  • Faction: Neutral
Re: Update Party Coordinates from parties.txt into module_parties.py
« Reply #3 on: October 13, 2008, 02:57:45 PM »
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.  ;)
 

M.Minkov

  • Sergeant at Arms
  • *
    • View Profile
  • Faction: Khergit
Re: Update Party Coordinates from parties.txt into module_parties.py
« Reply #4 on: December 05, 2008, 09:29:38 PM »
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?

HokieBT

  • Grandmaster Knight
  • *
  • may the force be with you
    • View Profile
  • Faction: Neutral
Re: Update Party Coordinates from parties.txt into module_parties.py
« Reply #5 on: December 06, 2008, 02:53:48 AM »
I think I can make it update the names, check back in a few days.
 

Stoker

  • Regular
  • *
    • View Profile
  • Faction: Neutral
Re: Update Party Coordinates from parties.txt into module_parties.py
« Reply #6 on: December 07, 2008, 01:25:08 PM »
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...
« Last Edit: December 10, 2008, 10:18:49 PM by Stoker »
"Black holes would seem to suggest that God not only plays dice, but also sometimes throws them where they cannot be seen."
"Never let your sense of morals get in the way of doing what's right."

Highlander

  • Grandmaster Knight
  • *
    • View Profile
  • Faction: Neutral
  • MP nick: irc://Highlander
  • WB
Re: Update Party Coordinates from parties.txt into module_parties.py
« Reply #7 on: December 10, 2008, 08:32:55 PM »
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

HokieBT

  • Grandmaster Knight
  • *
  • may the force be with you
    • View Profile
  • Faction: Neutral
Re: Update Party Coordinates from parties.txt into module_parties.py
« Reply #8 on: December 10, 2008, 10:50:26 PM »
thanks for the feedback guys.

Stoker - I think as long as the party id (ie. town_18) 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.
 

Llew

  • Cheap ass bum
  • Grandmaster Knight
  • *
    • View Profile
  • Faction: Vaegir
  • MP nick: nK_Llew
  • M&BWB
Re: Update Party Coordinates from parties.txt into module_parties.py
« Reply #9 on: December 18, 2008, 03:02:43 AM »
So, any update on this? Have you gotten the names work yet?

HokieBT

  • Grandmaster Knight
  • *
  • may the force be with you
    • View Profile
  • Faction: Neutral
Re: Update Party Coordinates from parties.txt into module_parties.py
« Reply #10 on: December 18, 2008, 06:08:23 AM »
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.  ;)  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.
« Last Edit: December 20, 2008, 01:46:39 AM by HokieBT »
 

HokieBT

  • Grandmaster Knight
  • *
  • may the force be with you
    • View Profile
  • Faction: Neutral
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 - http://www.mbrepository.com/modules/PDdownloads/singlefile.php?cid=3&lid=884
« Last Edit: December 23, 2008, 04:36:54 PM by HokieBT »
 

FrisianDude

  • Coitus non Awesome
  • Grandmaster Knight
  • *
  • ... and let's keep this as civil as possible
    • View Profile
  • Faction: Neutral
  • MP nick: OLL_SirAndelot/Warden Leo
  • M&BWB
Re: UpdateModuleParties v1.1 - update module_parties.py after using Map Editor
« Reply #12 on: December 24, 2008, 10:42:12 AM »
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?
Nords ruled by King Ragnar, Khergits ruled by Sanjar Khan, Rhodoks ruled by King Graveth, Swadians ruled by King Harlaus, Vaegirs ruled by King Yaroglek. All those peoples live, fight, and die in the continent of Calradia. The Nords and Rhodoks field solely infantry and archers, the Swadians and Vaegirs have infantry, archers and cavalry and the Khergit field almost exclusively cavalry. No such things as "infarty" or "calvary" exist. A nice link to my mod ;)

HokieBT

  • Grandmaster Knight
  • *
  • may the force be with you
    • View Profile
  • Faction: Neutral
Re: UpdateModuleParties v1.1 - update module_parties.py after using Map Editor
« Reply #13 on: December 24, 2008, 12:20:54 PM »

yeah. I didn't want to overwrite your module_parties.py file (incase there were issues) so that's why it creates a _new.
 

FrisianDude

  • Coitus non Awesome
  • Grandmaster Knight
  • *
  • ... and let's keep this as civil as possible
    • View Profile
  • Faction: Neutral
  • MP nick: OLL_SirAndelot/Warden Leo
  • M&BWB
Re: UpdateModuleParties v1.1 - update module_parties.py after using Map Editor
« Reply #14 on: December 25, 2008, 11:52:18 AM »
So it's best not to change the map untill last, I think?
Nords ruled by King Ragnar, Khergits ruled by Sanjar Khan, Rhodoks ruled by King Graveth, Swadians ruled by King Harlaus, Vaegirs ruled by King Yaroglek. All those peoples live, fight, and die in the continent of Calradia. The Nords and Rhodoks field solely infantry and archers, the Swadians and Vaegirs have infantry, archers and cavalry and the Khergit field almost exclusively cavalry. No such things as "infarty" or "calvary" exist. A nice link to my mod ;)