PDA

View Full Version : Utility combineMods.py


pyg
February 10th, 2010, 05:13 PM
I intend to release another version of DMG and I would like to test it further by creating combined mods for interested parties. If you want to put together a game with a lot of mods or would like a package of a certain set of mods, let me help. You get the combined mods you want and I get free testing. :)

And here it is. The included utility (combineMods.py) is a functional replacement for Llamabeast's combineMods. It probably contains bugs but many of them have been worked out doing the mods for Blood Red and Lunar Sea games.

The following would generate the equivalent of the Blood Red mod:

./combineMods.py 2 CBcomplete_1.6.dm TombKings.dm City\ of\ Wonders.dm Jomon\ broken.dm Warhammer\ Skaven.dm themiskyra_MA3.dm Warhammer\ Dwarfs.dm Arga\ Dis.dm Warhammer\ Ogre\ Kingdoms.dm BLOODRED


And for Lunar Sea:

./combineMods.py 1 CBcomplete_1.6.dm diversity.dm holywar.dm sitemod.dm CPCS.dm LUNARSEA


This utility has moved to here (http://z7.invisionfree.com/Dom3mods/index.php?showtopic=10). I removed the attachment because I don't want to update in both places.

pyg
March 27th, 2010, 09:26 PM
OP now contains utility.

mehrunes_dagon
April 2nd, 2010, 10:42 AM
ups, does not work under *nix

ImportError: No module named DMG

and after renamin dmg/ to DMG/ is still does not work

ImportError: cannot import name D3M

'''and string d3m is nowhere to be found'''

By the way, perl mod-combiner malfunctions, so i am impatiently waitin for a workin replacement

pyg
April 2nd, 2010, 02:37 PM
ups, does not work under *nix

ImportError: No module named DMG

and after renamin dmg/ to DMG/ is still does not work

ImportError: cannot import name D3M

'''and string d3m is nowhere to be found'''

By the way, perl mod-combiner malfunctions, so i am impatiently waitin for a workin replacement

Sounds like you moved things around after unzipping. Best place to unzip is in mods/ After unzipping there should be a combineMods.py, a DMG.py, and a dmg/ Doing ./combineMods.py should give you usage help text. Moving combineMods.py to a different directory than DMG.py will give you the results described above.

pyg
April 2nd, 2010, 04:23 PM
Here is an Asia themed mod containing EA-LA TC, Yomi-Jomon, EA Atreus, Goguryeo, Shangri-La, and EA-LA * Qayan.

kennydicke
April 2nd, 2010, 04:34 PM
Hmm, sounds like a good time for me to try out Shangri-La. Thanks you!

mehrunes_dagon
April 3rd, 2010, 12:33 AM
the utility has a nice side-effect of checking if all the graphics is referenced correctly

unfortunately there is a bug which becomes visible when a processed mod contains commented-out line like

-spr1 ".\Angmar\Winged Uruloki\Winged_Uruloki_1.tga"
-spr2 ".\Angmar\Winged Uruloki\Winged_Uruloki_2.tga"

combineMods.py tries to find these files, fails and prints error message

Bad File Name: {name of tga}

pyg
April 5th, 2010, 08:49 AM
the utility has a nice side-effect of checking if all the graphics is referenced correctly

unfortunately there is a bug which becomes visible when a processed mod contains commented-out line like

-spr1 ".\Angmar\Winged Uruloki\Winged_Uruloki_1.tga"
-spr2 ".\Angmar\Winged Uruloki\Winged_Uruloki_2.tga"

combineMods.py tries to find these files, fails and prints error message

Bad File Name: {name of tga}

Don't worry about the error message to much, it still creates the mod. If it was a commented out sprite it's still going to complain, sorry. You can turn off the sprite compilation by changing line 8 where it says 'packTGAs = True' to 'packTGAs = False'. This will also save space as you wont' have duplicate copies of all the graphics.

It should also be telling you that how many nations, monsters, spells, etc. it combined. It DOES NOT check to make sure those numbers are within safe limits. Usually new spells is the first to go over (~135 I think).

pyg
April 8th, 2010, 11:33 PM
OK, here is a mod of stuff I enjoy using together. It is a bit like the Lunar Sea mod. This combo adds a lot of magical options. It uses up all the spell slots so it's not compatible with anything else. Contains:

CBM 1.6
Endgame Diversity
Holy War Divine + Sacreds and Priests
FW Thugs
CPCS
Mytheology

Sombre
April 9th, 2010, 06:45 AM
I think that combination deserves its own thread. A lot of people would probably like that pack and it could be used for some simply set up MP games.

Gregstrom
April 9th, 2010, 04:29 PM
Agreed.

mehrunes_dagon
April 11th, 2010, 02:24 AM
spent many hours playtesting a middle-age combination

noticed that the script gave two units the same number, so AI player hired a powerful unit for zero gold. The units are

"Chaos Warrior Chariot"

"Keeper of Secrets"

and the mod is "chaos undivided"

and the commands i ran where
===========================================
#!/bin/sh

target=april_1
#use fixed sitemod with correct incscale

sed -ie 's|/wyvern|/sitemod|g' sitemod.dm

for x in *.dm ; do
perl -pi -e s/\\x0d//g "$x"
done

sed -i -e 's:\\:/:g' angmar.dm
sed -i -e 's:^-.*::g' -e 's-farmlandfort-farmfort-' angmar.dm
sed -i -e s:goodmagiceader:goodmagicleader: themiskyra_MA1.35.dm

/distr/game/Dominions3/utility/combine_Mods.py/combineMods.py \
2 \
sitemod.dm \
BlackTome.dm \
diversity.dm \
CBcomplete_1.6.dm \
themiskyra_MA1.35.dm \
chaos.dm \
Warhammer\ Ogre\ Kingdoms.dm \
Warhammer\ Skaven.dm \
'Cinggis Qayan, Wrath of the Khans.dm' \
TombKings.dm \
$target

===================== end of commands ================

pyg
April 11th, 2010, 09:51 AM
spent many hours playtesting a middle-age combination

noticed that the script gave two units the same number, so AI player hired a powerful unit for zero gold. The units are

"Chaos Warrior Chariot"

"Keeper of Secrets"

and the mod is "chaos undivided"


Interesting. If they have the same ID number then one should just overwrite the other. It shouldn't be changing other aspects (at least cost) of the unit. Can you post the .dm into this thread so I can try and figure it out?

nordlys
April 16th, 2010, 11:11 PM
Uh... can we commoners hope for a compiled executable version?

pyg
April 17th, 2010, 01:01 AM
Uh... can we commoners hope for a compiled executable version?

This is just a script so all you need is to have python (http://python.org/download/) installed (default on all great OSes). In terms of usability this particular script just emulates this perl script (http://forum.shrapnelgames.com/showthread.php?t=40654).

nordlys
April 17th, 2010, 01:09 AM
I have xp, and have no clue how to use it.

nordlys
April 17th, 2010, 01:23 AM
OK, i even trashed my system with Python, and that's what I get:

C:\Program Files\dominions3\mods>combineMods.py 1 ArgaDis.dm Avernum.dm test
File "C:\Program Files\dominions3\mods\combineMods.py", line 13
"""
^
SyntaxError: invalid syntax

edit: nevermind, I needed a 2.x Python version rather than 3.x

nordlys
April 17th, 2010, 03:05 AM
I am now trying to combine a bunch of nation mods (Arga Dis, Avernum, Themiskyra and the 6 Warhammer nations along with endgame diversity and worthy heroes), and the resulting mod always gives me "name2spell" error until I drop half of these mods from the mix (the various warhammer ones typically cause mischief). What am I doing wrong? Or there is a total mod size limit?

kennydicke
April 17th, 2010, 05:40 AM
What am I doing wrong?
There is a limit to the total number of new modded spells: ~120.

Sombre
April 17th, 2010, 06:12 AM
I will reconfigure some of my mods to take less spell slots. Primarily by taking them from other nations, like LA Pythium.

nordlys
April 17th, 2010, 06:41 AM
That's sad :( I was trying to make a single age mod with all the nations plus 10 mod nations, but it seems I am out of luck then :(

Why this arbitrary limit, anyway?

kennydicke
April 17th, 2010, 07:37 AM
"Programming ain't easy, but it sure is fun."

It's has to do with programming. I'm not versed enough to explain further.

Ragnarok-X
April 17th, 2010, 04:15 PM
I dont quite understand how to use it. I have python installed, from Civ 4. I now want to combine a mod (Sombre lateera mod) with the magic site mod. How would i go about doing this ?
When i open the .py files, notepad++ is used.

pyg
April 17th, 2010, 05:58 PM
I dont quite understand how to use it. I have python installed, from Civ 4. I now want to combine a mod (Sombre lateera mod) with the magic site mod. How would i go about doing this ?
When i open the .py files, notepad++ is used.

Well, the last time I used Windows it was called 3.1 so I'm not really sure. If you can get a *DOS terminal* or some such and change to your mod directory, then 'combineMods.py 3 lateera.dm sitemod.dm my_spiffy_new_modname'... I think (.dm names approximated). Really could use some help from savvy windows users out there... if you've used this script how do you do it?

Ragnarok-X
April 17th, 2010, 06:11 PM
In that case, creating a .bat should work...but it doesnt. When i run the batch, notepad still opens up the combinemods.py instead of actually doing something relevant.
Perhaps someone else will post. thanks for your time so far.

mehrunes_dagon
April 18th, 2010, 08:53 AM
spent many hours playtesting a middle-age combination

noticed that the script gave two units the same number, so AI player hired a powerful unit for zero gold. The units are

"Chaos Warrior Chariot"

"Keeper of Secrets"

and the mod is "chaos undivided"


Interesting. If they have the same ID number then one should just overwrite the other. It shouldn't be changing other aspects (at least cost) of the unit. Can you post the .dm into this thread so I can try and figure it out?

not sure which .dm you want me to post.

Attempting to give them all, together with the script

pyg
April 18th, 2010, 12:49 PM
not sure which .dm you want me to post.

Attempting to give them all, together with the script

That was enough information for me to figure it out. It seems like some of my negative lookahead assertions were broken. I think it's fixed now and updated in the first post.

pyg
May 14th, 2010, 10:22 PM
With the help of lch I made a fairly major change to DMG/combineMods.py which gives some extra room for modding spells by overwriting unused national spells. Previously there were ~136 spell slots but by overwriting unused national spells EA mods can have ~252, MA ~225, and LA ~168. By removing all the default nations and playing with just mod nations you can now have ~353 spells. This hasn't been tested all that much but appears to work. More details here (http://z7.invisionfree.com/Dom3mods/index.php?showtopic=10).