Author Topic: kt0's troop script: the return of BLAM  (Read 15926 times)

0 Members and 1 Guest are viewing this topic.

kt0

  • Knight
  • *
    • View Profile
  • Faction: Swadian
kt0's troop script: the return of BLAM
« on: July 08, 2009, 05:55:55 AM »
Many people have asked for a script that takes troops.txt and converts it back into module system code.  You can now find such a script at the repository:  http://www.mbrepository.com/file.php?id=1398.  This will allow you to hack up your troops.txt file and bring the data back into your module system code with a minimum of effort.  As a test of effectiveness, I successfully decompiled a Native module, re-compiled the resulting code, and diffed the results against the original txt data. 

Caveats:
- If you have stats higher than 30, you'll need to add new stat lines in header_troops.py to get things to compile again.  Note that Native has one troop with a stat at that level (the fugitive has strength of 31)
- Aliasing of flag values, especially skills, is not guaranteed to come out 100% like your original module system code.  Many of the skill macros (like knight_skills_5 and knows_common) overlap and it's impossible to tell from the txt files what the original code looked like.  Face codes also have value collisions.
- Weapon proficiencies as produced by the module system have a random component of 10+10%.  Rather than try to approximate this value, I assume that anyone using the unofficial editor to hack this stuff up is going to continue to do so and I kept the literal values.  Anyone intending to only use the script once should go through and tidy up their proficiency values with the expected macros.

To use:
- Install Ruby.
- Edit the script to look at your data files (look near the top of the script).
- Pop open a command window.
- run the script.
- Copy & paste the tuples from the destination file to your module_troops.py.  Fight with all your might, the urge to make the destination output the same as your module_troops.py.  I don't replace macro and alias values. 

And since I haven't in a while:  BLAM
« Last Edit: December 20, 2011, 04:03:08 AM by Caba`drin »

HokieBT

  • Grandmaster Knight
  • *
  • may the force be with you
    • View Profile
  • Faction: Neutral
  • M&BWB
Re: kt0's troop script: the return of BLAM
« Reply #1 on: July 08, 2009, 04:09:08 PM »

well that is very cool, nice work!    I added a summary about this to the first page of my troop editor, thanks!
 
PC Gamer - "Uninstall KOTOR. Forget TIE Fighter and Star Wars Battlefront. There is only one Star Wars video game, and it's an unfinished mod for a six-year-old medieval RPG built by an indie studio from Turkey."

Darwin

  • Watchin' your language...
  • Language Moderator
  • *
  • Life's a play.
    • Skype - darwin989
    • Steam - the_darwin
    • View Profile
    • The Automated Mod List
  • Faction: Neutral
  • WBM&BWF&SVC
Re: kt0's troop script: the return of BLAM
« Reply #2 on: July 08, 2009, 04:12:39 PM »
kt0, you're just great, thank you very much :wink:

Edit: str_* is not defined :(
« Last Edit: July 08, 2009, 04:27:20 PM by Darwin »

Fürwahr, ein guter Deutscher labt sich am Leid allein!

Darwin

  • Watchin' your language...
  • Language Moderator
  • *
  • Life's a play.
    • Skype - darwin989
    • Steam - the_darwin
    • View Profile
    • The Automated Mod List
  • Faction: Neutral
  • WBM&BWF&SVC
Re: kt0's troop script: the return of BLAM
« Reply #3 on: July 10, 2009, 05:57:09 PM »
come on, anybody has an idea, i'm sure

Fürwahr, ein guter Deutscher labt sich am Leid allein!

kt0

  • Knight
  • *
    • View Profile
  • Faction: Swadian
Re: kt0's troop script: the return of BLAM
« Reply #4 on: July 11, 2009, 12:35:59 AM »
I've uploaded a new version that handles stats > 30 in a better way. 

bjorne.

  • Sergeant Knight
  • *
  • I'm a nerd... deal with it..
    • View Profile
    • Age of Blackpowder - Realm of Revolution
  • Faction: Swadian
Re: kt0's troop script: the return of BLAM
« Reply #5 on: July 11, 2009, 01:12:03 AM »
kt0. You've done it again!

Darwin

  • Watchin' your language...
  • Language Moderator
  • *
  • Life's a play.
    • Skype - darwin989
    • Steam - the_darwin
    • View Profile
    • The Automated Mod List
  • Faction: Neutral
  • WBM&BWF&SVC
Re: kt0's troop script: the return of BLAM
« Reply #6 on: July 11, 2009, 08:10:07 AM »
>30 still doesnt work, and 1, too :cry:

Fürwahr, ein guter Deutscher labt sich am Leid allein!

kt0

  • Knight
  • *
    • View Profile
  • Faction: Swadian
Re: kt0's troop script: the return of BLAM
« Reply #7 on: July 11, 2009, 03:27:46 PM »
Do you see this stuff in the output?
(click to show/hide)

If you don't, you've either copied & pasted incorrectly or you're running the wrong script.  You can also modify your header_troops.py to have the correct str_* values as I mentioned in the original post:
(click to show/hide)

Strengths lower than 3 you'll have to patch yourself.

Darwin

  • Watchin' your language...
  • Language Moderator
  • *
  • Life's a play.
    • Skype - darwin989
    • Steam - the_darwin
    • View Profile
    • The Automated Mod List
  • Faction: Neutral
  • WBM&BWF&SVC
Re: kt0's troop script: the return of BLAM
« Reply #8 on: July 12, 2009, 10:03:30 AM »
ok, works now, thanks

Fürwahr, ein guter Deutscher labt sich am Leid allein!

dariel

  • Sergeant Knight
  • *
    • View Profile
    • The Madman's Cave
  • Faction: Khergit
Re: kt0's troop script: the return of BLAM
« Reply #9 on: August 18, 2009, 02:59:40 PM »
This tool is very useful for me, thanks kt0! You wouldn't have any plans of doing something similar for party_templates.py, would you? (hint, hint)  :)
I'm a nut, I know I'm a nut, and I like being a nut so I'll stay a nut. 
(from The Legacy of Nathan Brazil, Jack Chalker)

dariel

  • Sergeant Knight
  • *
    • View Profile
    • The Madman's Cave
  • Faction: Khergit
Re: kt0's troop script: the return of BLAM
« Reply #10 on: December 18, 2009, 03:52:16 AM »
Sorry to bump this thread, but a quick question -- can I modify this so it can preserve Firearms proficiency values, and how do I do it?  I'm using it on a mod that has arquebusiers.

Thanks!
I'm a nut, I know I'm a nut, and I like being a nut so I'll stay a nut. 
(from The Legacy of Nathan Brazil, Jack Chalker)

Zarthas

  • Squire
  • *
    • View Profile
  • Faction: Vaegir
Re: kt0's troop script: the return of BLAM
« Reply #11 on: December 29, 2009, 04:13:08 PM »
YOU sir, are a scholar and a gentleman.  I wasted two days converting by hand before discovering these converters, but you saved me another two, so thank you.

stuguy909

  • Recruit
  • *
    • View Profile
  • Faction: Neutral
Re: kt0's troop script: the return of BLAM
« Reply #12 on: July 07, 2010, 10:35:00 AM »
got it working finally.  great script, saved my life!
« Last Edit: July 07, 2010, 12:23:10 PM by stuguy909 »

yanzco

  • Recruit
  • *
    • View Profile
  • Faction: Rhodok
  • MP nick: yanco
Re: kt0's troop script: the return of BLAM
« Reply #13 on: July 09, 2010, 09:34:25 AM »
i cant get it to work..

i changed the directories..
it found the files it needed




for the other files.. troops, factions, scenes, i made a txt file but blank inside..

im testing out to convert 2 items in item_kinds.txt

and yeah it wrote, 2 items found
parsing troops data... 0 troops  parsed!
writing tuples file (D:/test.txt)...0 troops written to the output file.

and theres nothing on the file i want..
what went wrong..



Aeon221

  • Sergeant at Arms
  • *
    • View Profile
  • Faction: Neutral
  • MP nick: SUPER_KING_BIG_NUTS
Re: kt0's troop script: the return of BLAM
« Reply #14 on: July 15, 2010, 01:18:34 AM »
Any chance of a Warband version someday? Like, tomorrow? Tomorrow would be good for me.
Pike and Blade 3.5: Riders on the Storm!
-An Infantry Focused Mod for M&B:WB-
Pike & Blade + Diplomacy
-Like Jesus, but with fewer holes-