SUBSIM Radio Room Forums



SUBSIM: The Web's #1 resource for all submarine & naval simulations since 1997

Go Back   SUBSIM Radio Room Forums > Silent Hunter 3 - 4 - 5 > SH4 Mods Workshop
Forget password? Reset here

 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
Old 04-27-07, 07:23 AM   #1
mcoca
Loader
 
Join Date: Apr 2005
Location: Madrid, Spain
Posts: 86
Downloads: 0
Uploads: 0
Default [WIP] Mission edition API

Hi everybody,

Maybe I'm reinventing the wheel here, but I have the beginings of something interesting. I wanted to do some mass editing of the campaign files, to give all merchants a chance of getting a patrol boat as escort. Not wanting to do the edit by hand, I wrote a program to do it. This has evolved into a Java library to edit mission files.

Right now the library allows adding/removing/changing random groups and their units. Waypoints would be trivial to add, and with a little effort you could add pretty much everything else.

To make things clear, this is a library for writing programs, not a program in itself, so you need to know how to write Java programs to use it. But if you do, it's easy to use. As an example, if you wanted to make all elite destroyers veteran, you could use something like this:

Code:
Mission mission = new Mission ();
mission.read(filename);
for (RndGroup group : mission.getRandomGroups()) {
    for (RndUnit unit : group.getUnits()) {
        if (unit.getType() == UnitType.DESTROYER &&
                unit.getCrewRating() == CrewRating.ELITE) {
            unit.setCrewRating(CrewRating.VETERAN);
        }
    }
}
mission.write(filename);
The insides of the library are not that clean but it works.

Now, if there is enough interest in it, I can clean it up a bit, add some documentation, and release it under the GNU GPL. But the API already does what I wanted it to do, so I can't promise to develop it much further.

Anyone interested in this?
mcoca is offline   Reply With Quote
 

Thread Tools
Display Modes

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 Off

Forum Jump


All times are GMT -5. The time now is 06:15 PM.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright © 1995- 2025 Subsim®
"Subsim" is a registered trademark, all rights reserved.