Click the 'Modules' button on the right sidebar and place down a 'Functions' module anywhere on your map. I suggest grouping onjects such as this in one place so they are easy to locate.
Click on the 'Units' button on the right sidebar and then double-click on your map where you would like the aircraft carrier to spawn. Choose 'Game Logic' from the 'Side' dropdown and name the unit 'LHD01'. Enter the following code in your init.sqf file:
// -----INITIATE FUNCTION MODULE
waitUntil {!isNil "bis_fnc_init"};
// -----CREATE AIRCRAFT CARRIER
LHD01 call BIS_EW_fnc_createLHD;
If you do not have an init.sqf file then open your text editor (MS Notepad and the like) and paste the above code into it. Save it as init.sqf and drop it into your mission folder. Your mission folder is located here:
C:\Users\User\Documents\ArmA 2 Other Profiles\YOUR-NAME\missions
Or here:
C:\Users\User\Documents\ArmA 2\missions
Click the 'Preview' button and you will see your new LHD Aircraft Carrier. There may be up to a five second wait before you see it spawn due to a delay in the Function Module initializing.
Click on the 'Units' button and pick a spot on the map for your aircraft carrier. Choose 'Empty' from the 'Side' selections and 'Ship' for the class. Actually, any type of class will work (merely used as a placeholder) but for the sake of consistency we will select ship.
Place this code in the 'Intialization' field of the ship unit:
res=[this]execVM"lhd.sqf"
Now open up your text editor and copy & paste this code into it:
_LHDspawn = _this select 0;
_LHDdir = getdir _LHDspawn;
_LHDspawnpoint = getposasl _LHDspawn;
deletevehicle _LHDspawn;
_parts =
[
"Land_LHD_house_1",
"Land_LHD_house_2",
"Land_LHD_elev_R",
"Land_LHD_1",
"Land_LHD_2",
"Land_LHD_3",
"Land_LHD_4",
"Land_LHD_5",
"Land_LHD_6"
];
{
_dummy = _x createvehicle _LHDspawnpoint;
_dummy setdir _LHDdir;
_dummy setpos _LHDspawnpoint;
}foreach _parts;
Save the file as lhd.sqf and drop it into your mission folder. Relaunch ArmA 2, go to your mission in the editor and click the 'Preview' button. Your new LHD Aircraft Carrier will be waiting for you.
If you try to place crewmen, airplanes and/or supplies on the aircraft carrier you will notice (upon testing the mission) that everything falls through it and sinks into the ocean.
You can fix this situation by placing the following code into the 'Initialization' field of each and every unit you want to place on the ship:
this setPos [getPos this select 0, getPos this select 1, 20]
Everything with this code will spawn at a height of twenty meters, which is just above the deck clearance of the LHD. In regarding to shuffling objects around, You are working in a very constrained area so it will take a bit of patience and maneuvering of units to get everything positioned correctly.
LHD Steerable by deanosbeano: This is a version of the LHD that you can navigate through the ocean. Players can be spawned as the driver and take immediate control of the ship. The download link and details can be found on the previous link.
USS Nimitz by JDog: This is a massive creation and a nice addition to your navy. More information and the downloadable file are available via the previous link.
Related article: Adding Mission Tasks [ArmA 2]
Related article: Detonate on Trigger: IED [ArmA 2]
Related article: Creating Multiplayer Missions [ArmA 2]
Related article: General assembly: ArmA 2 VPN Setup [ArmA 2]
Related article: Spawning Soldiers with Timers [ArmA 2]
Related article: Implement Looping Waypoints [ArmA 2]
Related article: Code Design Potpourri [ArmA 2]
written by RJ Wattenhofer