World Builder and Carriers

GildedDuke

Chieftain
Joined
Jul 3, 2012
Messages
26
I have been trying to set up a scenario in world builder which requires a series of carriers at sea, with planes already on them. I am not seeing an option to designate the planes as cargo on the map, and whenever I actually load the map, the planes just seem to vanish. I noticed that placed carriers don't seem to have the cargo promotions (Perhaps all unit are loaded at game start?) Specifically giving them Cargo 3 didnt seem to help or change things in any way.
 
It's a bug in WorldBuilder. The planes should autoload on the Carrier (the same way as if you'd placed them with FireTuner) but the code to auto-load seems to run after the code to validate units are correctly placed.

As Hambril says, you'll need Lua to fix it by writing a small mod to place all the Aircraft at game startup.
 
Thanks you two. I've been piecing together the LUA code to try and run the thing. I've got something basic working as a firetuner button, although I havent yet built it into the mod. Would there happen to be any documentation or tutorials on the g_UnitPlopper stuff? So far I've just been piecing it together from the Firetuner buttons.

Now when I actually put it in the mod, would I run it through SerialEventStartGame or something else? I'm worried that putting the commands in there would make the planes spawn whenever a save game was loaded.

Would either of you be up for looking at what I have? I'm not so worried about making it elegant, but I don't want to introduce new issues with the code.

--Find out Who is playing Japan and US

local pPlayer = Players[0];
local JapanNumber = nil;
local PacificNumber = nil;
local description = nil;


description = pPlayer:GetCivilizationShortDescription();
if description == ("Combined Fleet") then JapanNumber= 0 end
if description == ("Pacific Fleet") then PacificNumber= 0 end
local pPlayer = Players[1];

description = pPlayer:GetCivilizationShortDescription();
if description == ("Combined Fleet") then JapanNumber= 1 end
if description == ("Pacific Fleet") then PacificNumber= 1 end
local pPlayer = Players[2];

description = pPlayer:GetCivilizationShortDescription();
if description == ("Combined Fleet") then JapanNumber= 2 end
if description == ("Pacific Fleet") then PacificNumber= 2 end
local pPlayer = Players[3];

description = pPlayer:GetCivilizationShortDescription();
if description == ("Combined Fleet") then JapanNumber= 3 end
if description == ("Pacific Fleet") then PacificNumber= 3 end
local pPlayer = Players[4];

description = pPlayer:GetCivilizationShortDescription();
if description == ("Combined Fleet") then JapanNumber= 4 end
if description == ("Pacific Fleet") then PacificNumber= 4 end
local pPlayer = Players[5];

description = pPlayer:GetCivilizationShortDescription();
if description == ("Combined Fleet") then JapanNumber= 5 end
if description == ("Pacific Fleet") then PacificNumber= 5 end

print ("Japan is Player")
print (JapanNumber)
print ("Pacific is Player")
print (PacificNumber)

local iX = 0;
local iY = 0;
local PlaneUnitType = 0;
local newPlot = nil;

g_PlopperSettings.Player = JapanNumber;

--First Aircraft Carrier
iX = 73;
iY = 51;
PlaneUnitType=131;
newPlot = Map.GetPlot(iX, iY);
g_UnitPlopper.UnitType = PlaneUnitType;
g_UnitPlopper.Plop( newPlot );

iX = 73;
iY = 51;
PlaneUnitType=122;
newPlot = Map.GetPlot(iX, iY);
g_UnitPlopper.UnitType = PlaneUnitType;
g_UnitPlopper.Plop( newPlot );

iX = 73;
iY = 51;
PlaneUnitType=122;
newPlot = Map.GetPlot(iX, iY);
g_UnitPlopper.UnitType = PlaneUnitType;
g_UnitPlopper.Plop( newPlot );
 
You don't need unitplopper et al, they're really just to support FireTuner.

Search the TurnsRemaining.lua files for any DLC scenarios you have, most of them use InitUnit() to add units for players during setup. Also the various wikis for the Unit objects will have the methods needed to "load" the planes onto the carriers
 
Back
Top Bottom