View Single Post
Old 05-04-07, 10:15 AM   #14
mcoca
Loader
 
Join Date: Apr 2005
Location: Madrid, Spain
Posts: 86
Downloads: 0
Uploads: 0
Default

Quote:
Originally Posted by Yanaran
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
Yes, that should work... except that I'm not sure what happens if the lead unit in the group doesn't spawn? But the editor let's you enter such a group, so it's no big deal.

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:
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).
The best solution, as tater suggested in another thread, would be to move the subhunter and the minesweeper to the "corvette" category by editing the roster files and changing the type=0 to type=1. Then, switch all the patrol craft in the campaign to corvettes:

Code:
if unit.type==UnitType.PATROL_CRAFT:
    unit.type=UnitType.CORVETTE
And if you want to add some gunboats around coastal areas, do so manually with editor. Unless you are a really enterprising programmer and can figure out a way to tell coastal patrols apart based on long/lat
mcoca is offline   Reply With Quote