![]() |
SUBSIM: The Web's #1 resource for all submarine & naval simulations since 1997 |
![]() |
#1 |
Loader
![]() Join Date: Apr 2005
Location: Madrid, Spain
Posts: 86
Downloads: 0
Uploads: 0
|
![]()
This is the 0.3 release of the SH Batch Editor, a tool for making automated changes to the campaign files. Please consider it a beta release.
If you want to make some extensive changes to the SH4 campaign, but don't spend hours in the in-game editor, this is your tool. Just enter the values you want to set, and (if needed) the conditions a randomly generated group must fulfill to be modified, run the program, and the entire campaign will have been modified. The changes to be made are specified as code snippets in the Python programming language (www.python.org), but the program has been designed to make it possible to use it with only a minimum of programming knowledge. At the moment, the program only supports editing random generated groups (including contents and waypoints, so you can add or remove ships from them), but scripted elements, bases, etc, should not be affected in any way by running it. But, just in case, always make backups. The program is available at: http://downloads.sourceforge.net/shb...editor-0.4.zip
It is written in the Java programming language so you will need the Java Virtual Machine (version 1.5 or later), available at http://java.sun.com/ (but likely to be already installed on your computer). This program is released under the GNU General Public License, and the linked file includes full source code for the technically inclined. The README.txt file includes all instructions for running simple changes. If you know some programming and want to try more complex changes, in the "samples" folder of the distribution you can find the script to reproduce the changes I'm currently using in my campaign. Finally, I really don't know how much further I will be able to develop this. That's one of the reasons for releasing it as Free Software, so that everybody who is interested can continue developing it should I no longer have time or (let's face it) interest. If anybody wants to contribute, I sure could use some help. Hope you enjoy this. Changes in v 0.4
Last edited by mcoca; 06-13-07 at 05:15 PM. Reason: New release |
![]() |
![]() |
![]() |
#2 |
Admiral
![]() Join Date: Sep 2001
Posts: 2,020
Downloads: 15
Uploads: 0
|
![]()
Very impressive looking. Thanks for this, it looks like it will come in very useful.
![]() |
![]() |
![]() |
![]() |
#3 |
Canadian Wolf
|
![]()
Nice effort
![]() RDP |
![]() |
![]() |
![]() |
#4 |
Rear Admiral
![]() |
![]()
Very nice.
|
![]() |
![]() |
![]() |
#5 |
Loader
![]() Join Date: Apr 2005
Location: Madrid, Spain
Posts: 86
Downloads: 0
Uploads: 0
|
![]()
Almost forgot! Please consider this an "undocumented feature" for the moment, but for those who are feeling brave, the distribution includes the entire python standard library, meaning you can do all types of nifty things, including (as per Jace11's suggestion):
Code:
from random import randint group.speed = randint(5,9) group.updateWaypointSpeed() ![]() You can use any of the functions described in the python documentation... (edit to fix problem in example) Last edited by mcoca; 05-03-07 at 06:31 PM. |
![]() |
![]() |
![]() |
#6 |
Seasoned Skipper
![]() Join Date: Mar 2005
Location: UK
Posts: 683
Downloads: 104
Uploads: 1
|
![]()
Just re-stating my gratitude for this. It will speed things up for the people who are editing the campaign layers.
Last edited by Jace11; 05-03-07 at 06:29 PM. |
![]() |
![]() |
![]() |
#7 |
Samurai Navy
![]() Join Date: Mar 2005
Location: Fort Worth, Texas
Posts: 597
Downloads: 0
Uploads: 0
|
![]()
This is superb, especially the random speed functionality.
__________________
-AKD |
![]() |
![]() |
![]() |
#8 |
Admiral
![]() Join Date: Apr 2005
Location: San Diego Calif
Posts: 2,290
Downloads: 187
Uploads: 12
|
![]()
What would be the code to randomly change speed on each way point i.e pt1 is 5, pt 2 is 8 etc ???
|
![]() |
![]() |
![]() |
#9 | |
Loader
![]() Join Date: Apr 2005
Location: Madrid, Spain
Posts: 86
Downloads: 0
Uploads: 0
|
![]()
Thank you everybody for your support! Now, start using the thing so I can feel I haven't completely wasted my time :p
Quote:
Code:
from random import randint for waypoint in group.waypoints: waypoint.speed = randint(2,8) BTW, if you want to get cute, there are functions to provide randomness along a probability curve, so most of the time ships will be around the middle of the range, with the occasional fast or slow one. Check the docs if you are interested. |
|
![]() |
![]() |
![]() |
#10 | ||
Admiral
![]() Join Date: Apr 2005
Location: San Diego Calif
Posts: 2,290
Downloads: 187
Uploads: 12
|
![]() Quote:
It worked perfectly, thanks very much |
||
![]() |
![]() |
![]() |
#11 |
Watch
![]() Join Date: Apr 2007
Posts: 29
Downloads: 0
Uploads: 0
|
![]()
Thanks for this awesome tool. Now I can finally make some changes myself!
![]() I have a few simple questions though. I want to reduce traffic similar to your example script, but I also want to make convoys smaller early in the war and have less escorts. Is it enough to just reduce the spawnprobability for every unit in a convoy to say half? Like this for example, if unit.type == UnitType.DESTROYER: unit.spawnProbability *= 0.25 else: unit.spawnProbability *= 0.5 Also, I'd like to remove all gunboats from the subhunter groups, and maybe replace them with some other ships like subchaser or minesweepers. Can I replace the "type" of ship or do I need to remove the gunboat unit altogether and then add a subhunter unit? I want to keep all the stats for the unit the same (crew, spawnprobability etc). |
![]() |
![]() |
![]() |
#12 |
Samurai Navy
![]() Join Date: Mar 2005
Location: Fort Worth, Texas
Posts: 597
Downloads: 0
Uploads: 0
|
![]()
Best thing to do with gunboats would probably be to change their type so they aren't spawned as patrol vessels (or whatever type is drawn on for that group).
__________________
-AKD |
![]() |
![]() |
![]() |
#13 |
Grey Wolf
![]() Join Date: Mar 2005
Location: Treading Water
Posts: 847
Downloads: 56
Uploads: 0
|
![]()
It would be nice to have both brown and blue water hunter/killer groups
Blue: DD/Subchaser/Minesweeper Brown: Subchaser/Minesweeper/Gunboats or similar. Brown groups would also be common near smaller ports. |
![]() |
![]() |
![]() |
#14 | ||
Loader
![]() Join Date: Apr 2005
Location: Madrid, Spain
Posts: 86
Downloads: 0
Uploads: 0
|
![]() Quote:
OTOH, you could remove half the entries using group.units.remove(unit) and some condition, but adding some kind of counter to how many there were and how many you removed. Quote:
Code:
if unit.type==UnitType.PATROL_CRAFT: unit.type=UnitType.CORVETTE ![]() |
||
![]() |
![]() |
![]() |
#15 |
Watch
![]() Join Date: Apr 2007
Posts: 29
Downloads: 0
Uploads: 0
|
![]()
Well that seems a bit more complicated than I thought, what I'm trying right now instead is sort of reverse what you did for destroyers... In every SubHunter group I check if it's a patrol craft and then set that units shipclass to subchaser. I think that should turn all gunboats into subchasers, which is good enough for me until I learn more.
![]() Code:
if group.groupName.find("SubHunter") != -1: if group.groupName.find("Jap") != -1: # less subhunter groups group.spawnProbability *= 0.5 for unit in group.units: if unit.type == UnitType.PATROL_CRAFT: unit.shipClass="SCSubchaser" |
![]() |
![]() |
![]() |
Thread Tools | |
Display Modes | |
|
|