.com.unity Forums
  The Official e-Store of Shrapnel Games

This Month's Specials

Raging Tiger- Save $9.00
winSPMBT: Main Battle Tank- Save $6.00

   







Go Back   .com.unity Forums > Illwinter Game Design > Dominions 3: The Awakening > Scenarios, Maps and Mods

Reply
 
Thread Tools Display Modes
  #1  
Old November 25th, 2006, 05:01 PM
DrPraetorious's Avatar

DrPraetorious DrPraetorious is offline
Major General
 
Join Date: Feb 2005
Location: Lake of Hali, Aldebaran, OH
Posts: 2,474
Thanks: 51
Thanked 67 Times in 27 Posts
DrPraetorious is on a distinguished road
Default Mod combination script

I've automated the process of combining and renumbering mods.

This means people don't have to worry about what number-space their mods use, b/c you can just use this script to renumber all the mods dynamically.

To use it, you will need a real computer (or a real computer emulator such as cygwin).
awk -f mod_mixer.awk *.dm
vi *.txt
cat headers.txt footers.txt armors.txt weapons.txt monsters.txt sites.txt nations.txt > combined_mod.dm
-- You'll probably want to glance over combined_mod.dm just to make sure nothing got horribly bungled.

I've attached an example where I did this on four mods I grabbed off the forum just now.

Planned improvements:
1) Support for custom namespaces (right now it just dumps them in footers.)
2) Combination of multiple mods on a single existing object - i.e., every line that "selects" the same object should be pulled together into once place.
3) Support for full magic item, spell and pretender modding, should that appear in 3.02.
4) More egomania - it should generate random titles for me (from the list of pretender titles inside Dom3) each time it creates a header for a new mod combination.
5) Notice on name collisions - this should only be a problem with armor, since people equip armor by-name, but if the same name is used more than once for anything, it should be noted.

Once 3.02 is out and I've added support for the 3.02 modding changes, I'll start releasing combined mods (along with a final version of the script so other people can mix their own mods easily.)
Attached Files
File Type: zip 473526-mod_mixer.zip (1.20 MB, 142 views)
__________________
If you read his speech at Rice, all his arguments for going to the moon work equally well as arguments for blowing up the moon, sending cloned dinosaurs into space, or constructing a towering *****-shaped obelisk on Mars. --Randall Munroe
Reply With Quote
  #2  
Old November 25th, 2006, 05:20 PM
DrPraetorious's Avatar

DrPraetorious DrPraetorious is offline
Major General
 
Join Date: Feb 2005
Location: Lake of Hali, Aldebaran, OH
Posts: 2,474
Thanks: 51
Thanked 67 Times in 27 Posts
DrPraetorious is on a distinguished road
Default Re: Mod combination script

Here's the script by itself. Sorry it's long.

Code:

BEGIN{
#print ARGC;
num_files = ARGC-1;
for (i = 1; i <= num_files; i++){
ARGV[ARGC] = ARGV[i];
ARGC++;
}
#print ARGC;
cweapon = 600;
carmor = 200;
cmonster = 2000;
csite = 750;
cnation = 68;
fout = "headers.txt";
print "-- Mod combined by The Notorious Doctor Praetorious, Prince of Men's Fates, God of the Pole Star, Lord of Courage." >> fout;
}

## First pass
/^#newweapon/ && (ARGIND <= num_files){
wmap[ARGIND+num_files,$2] = cweapon;
cweapon++;
}

/^#newarmor/ && (ARGIND <= num_files){
amap[ARGIND+num_files,$2] = carmor;
carmor++;
}

/^#newmonster/ && (ARGIND <= num_files){
mmap[ARGIND+num_files,$2] = cmonster;
cmonster++;
}

/^#newsite/ && (ARGIND <= num_files){
smap[ARGIND+num_files,$2] = csite;
csite++;
}

/^#selectnation/ && (ARGIND <= num_files){
if ($2 < 68){
nmap[ARGIND+num_files,$2] = $2;
} else {
nmap[ARGIND+num_files,$2] = cnation;
cnation++;
}
}

### Second pass
## Choose output file.
(FNR == 1){fout = "headers.txt";}


/^#newweapon/ || /^#selectweapon/{
fout = "weapons.txt";
}

/^#newarmor/ || /^#selectarmor/{
fout = "armors.txt";
}

/^#newmonster/ || /^#selectmonster/{
fout = "monsters.txt";
}

/^#newsite/ || /^#selectsite/{
fout = "sites.txt";
}

/^#selectspell/ || /^#newspell/{
fout = "spells.txt";
}

/^#selectnation/{
fout = "nations.txt";
}

## Process individual lines.
# By default, we're going to print the line unmolested.
{pmode = 2;}
# cweapon = 600;
# carmor = 200;
# cmonster = 2000;
# csite = 750;
# cnation = 68;

# weapons
(ARGIND > num_files && $2+0 >= 600) && (/#^weapon/ || /#^newweapon/){
print $1 " " wmap[ARGIND,$2] >> fout;
pmode = 0;
}

# armor
(ARGIND > num_files && $2+0 >= 200) && /^#newarmor/{
print $1 " " amap[ARGIND,$2] >> fout;
pmode = 0;
}

# monsters
# NOTE - if a spell does >=2000 damage, I'm going to assume that it is referencing a monster ID. That's the only way I can tell.
(ARGIND > num_files && $2+0 >= 2000) && (/^#newmonster/ || /^#firstshape/ || /^#secondshape/ || /^#secondtmpshape/ || /^#shapechange/ || /^#homemon/ || /^#homecom/ || /^#addrecunit/ || /^#addreccom/ || /^#defcom/ || /^#defunit/ || /^#hero/ || /^#multihero/ || /^#startcom/ || /^#startscout/ || /^#startunittype/ || /^#damage/){
print $1 " " mmap[ARGIND,$2] >> fout;
pmode = 0;
}

# nations
(ARGIND > num_files && $2+0 >= 68) && (/^#selectnation/ || /^#restrictedgod/){
print $1 " " nmap[ARGIND,$2] >> fout;
pmode = 0;
}

# sites
(ARGIND > num_files && $2+0 >= 750) && (/^#startsite/ || /^#newsite/){
print $1 " " smap[ARGIND,$2] >> fout;
pmode = 0;
}

# sprites
#(ARGIND > num_files){
#}

# If we didn't have to map anything on this line, we just spit it out.
(pmode == 2 && ARGIND > num_files){print >> fout;}

# End lines indicate that the *next* line may be filler, but we still need teh end line in the correct file.
/^#end/{print "" >> fout; fout = "footers.txt";}

__________________
If you read his speech at Rice, all his arguments for going to the moon work equally well as arguments for blowing up the moon, sending cloned dinosaurs into space, or constructing a towering *****-shaped obelisk on Mars. --Randall Munroe
Reply With Quote
Reply

Bookmarks


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is On

Forum Jump


All times are GMT -4. The time now is 05:45 AM.


Powered by vBulletin® Version 3.8.1
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©1999 - 2024, Shrapnel Games, Inc. - All Rights Reserved.