Jump to content
Sign in to follow this  
armatech

LHD (Aircraft Carrier) spawning script

Recommended Posts

Hey guys I also seem to be getting the same issue on editor only one carrier is spawned the same when I host a mission however when the mission is put on a dedicated server there seems to be two carriers one on top of the other only very slight but definately there, to the point that any characters you place on the carrier at mission start all drop dead. Was wondering if you guys had managed to find a sove for the with the (IsServer) command in the script.

Share this post


Link to post
Share on other sites
Excellent script, armatech. I've created an Editoraddon out of it which adds the LHD in the Editor under WEST/USMC/SHIPS/LHD and also under EMPTY of course.

It uses 100% of armatech's script so full credit to you mate. I've just packed a config and Editor Icon with it. Also added 2 lines to the script to make sure it runs server-side only.

You can get the addon version of armatech's script here:

http://www.armaholic.com/datas/users/372-glt_lhd.7z

Don't suppose you could tell us how you made it server-side only so that clients don't require the addon?

Nevermind, it's simply a case of adding.

[color="Red"]if (isServer) then {[/color]
_LHDspawn = _this select 0;
_LHDdir = getdir _LHDspawn;
_LHDspawnpoint = [getposasl _LHDspawn select 0, getposasl _LHDspawn select 1, 0];
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;
};

Thanks for the scripts! :bounce3:

Edited by Talyn

Share this post


Link to post
Share on other sites

I'be neen using this script with very good effects. Great job. A small problem though...

If I populate the ship with units (setPOSASL +15.9 meters) the ship sometimes spawns too slow. Hence my units "collide" with the deck and end up dead or bouncing (static objects and helos). setPosing them to 16.1 seems to solve this issue. But if there's many players in an MP game I suppose the spawning will be reduced even further. Has someone found out a working and simple method to prevent this from happening? I have a few static obbjects that really need to be at exactly 15.9 meters.

Share this post


Link to post
Share on other sites

I encountered the same issue when creating a simple mission for MP.

Fortunately, I found a solution that works for players spawning and re-spawning on-deck and aircraft remaining stable. Unfortunately, it's still hit or miss if the AI end up in the middle of a bulkhead.

First of all, place an invisible landing pad named: LHD_Center

In the init of that unit place:

this setPosASL [getposASL this select 0, getposASL this select 1, 0]; res=[this]execVM"CreateLHD.sqf"

Then finally modify the CreateLHD.sqf so it's like this:

if (isServer) then {
_LHDspawn = _this select 0;
_LHDdir = 270;
_LHDspawnpoint = [getposasl LHD_Center select 0, getposasl LHD_Center select 1, 0];

_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;
};

Credits go to Alexei Vostrikov for his implementation of the LHD in Carrier Domination.

Share this post


Link to post
Share on other sites

I've got a small problem with using the LHD.

I have a light source located in the big cargo area below decks. Unfortunately it illuminates the upper (outdoor) surface as well. Is there some kind of clipping plane or script I could use to illuminate ONLY cargo bay area?

Thanks for any help!

Share this post


Link to post
Share on other sites

Awesome work man!

I was wondering if it is possible to make the ship sink ... maybe some explosions would be nice.

How about using SetPos or anything else?

Share this post


Link to post
Share on other sites

That's awesome mate, I can spawn players/ammoboxes/objects on the deck, but when I try to place a fighterjet or a chopper it bounces and blows up, any solutions?

Share this post


Link to post
Share on other sites
I encountered the same issue when creating a simple mission for MP.

Fortunately, I found a solution that works for players spawning and re-spawning on-deck and aircraft remaining stable. Unfortunately, it's still hit or miss if the AI end up in the middle of a bulkhead.

First of all, place an invisible landing pad named: LHD_Center

In the init of that unit place:

this setPosASL [getposASL this select 0, getposASL this select 1, 0]; res=[this]execVM"CreateLHD.sqf"

Then finally modify the CreateLHD.sqf so it's like this:

if (isServer) then {
_LHDspawn = _this select 0;
_LHDdir = 270;
_LHDspawnpoint = [getposasl LHD_Center select 0, getposasl LHD_Center select 1, 0];

_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;
};

Credits go to Alexei Vostrikov for his implementation of the LHD in Carrier Domination.

I'm still amazed how many people had a look at my carrier domination and used the tricks i found not sleeping for 1 week on it :P

Share this post


Link to post
Share on other sites

What do you put in the init of a unit that starts on the carrier deck?

Im trying to use the carrier deck as a starting point for an Airborne insertion team that either on a UH Y or ready to board it. Please help with instructions a newbie can use.

Share this post


Link to post
Share on other sites

I know this is an older script, but I thought it was significant. I'm wondering why when I run the LHD script my arma2.RPT file seems to be written to in a loop, as long as the mission is running. The error which is repeated is:

Error position: <createvehicle _LHDspawnpoint;
_dummy set>
 Error Type Any, expected Number
File C:\Users\(me)\Documents\ArmA 2 Other Profiles\Model299\missions\Annhialation.Chernarus\CreateLHD.sqf, line 20
Error in expression <d_LHD_5",
"Land_LHD_6"
];
{
_dummy = _x createvehicle _LHDspawnpoint;
_dummy set>

the complete file I'm using is

;this setPosASL [getposASL this select 0, getposASL this select 1, 0]; res=[this]execVM"CreateLHD.sqf"
;if (isServer) then {
_LHDspawn = _this select 0;
_LHDdir = 270;
_LHDspawnpoint = [getposasl _LHDspawn select 0, getposasl _LHDspawn select 1, 0];
_playersetpoint = [getposasl _LHDspawn select 0,((getposasl _LHDspawn select 1)-7), 10];
_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;
;};

I have if (isServer) commented out for now while I develop the mission in the editor. and the _playersetpoint was a local variable I was playing with to set a player on the carrier. but I'm not using it.

Anyhow I don't really understand the error, and it's repetitive, as though the game were in a loop, I end up with 35MB arma2.RPT files after just a few moments.

Any opinions would be appreciated.

*EDIT: I think it had something to do with my filesystem, cause I replaced the script again with the one in the archive posted above and arma 2 stopped complaining. Probably some special character in the text.

Edited by Model 299
status change

Share this post


Link to post
Share on other sites
What do you put in the init of a unit that starts on the carrier deck?

Im trying to use the carrier deck as a starting point for an Airborne insertion team that either on a UH Y or ready to board it. Please help with instructions a newbie can use.

What you have to do is setpos the units at the carrier. The problem is, that the carrier deck is technically 20 meters in the air and not at sealevel where the object is.

So, you have to getpos something at the same position as the carrier. So in the new version of the script it deletes the helipad you used so you'll have to comment that out.

deletevehicle _LHDspawn

turns to

;deletevehicle LHDspawn

it's easier not to delete the helipad because you want the position of objects that were created at it's position, and this is easier than exporting the position of the objects that were created. (cause the script uses a foreach)

now that you have that you need to modify the position and set that for your units.

so, your unit should have in it

this setpos [(getpos LHD_Center select 0),(getpos LHD_Center select 1),10]

where this is your unit, and LHD_Center is the name of the helipad you used to spawn the LHD. What it does is it uses getpos to get the numbers out of the position of the helipad. Positions are always an array of three numbers. like this [pos x east west, pos y north south, height above ground z] So you just grab the x and y coordinates out of the helipad and then set the altitude at 10 (which should put you inside the carrier, 20 will drop things on the deck) you have to play with the numbers to get things where you want them. Additionally it's possible to add or subtract meters from the coordinates.

this setpos [((getpos LHD_Center select 0) + 2),(getpos LHD_Center select 1),18.50] 

this will put this two meters east of the LHD_Center position and 18.5 meters in the air. you can put -2 for two meters west, or do the same math on the other coordinate for north and south.

So basically that's it you just have to rebuild the position array with the values that you want, which are relative to the location of any object. Careful dropping helicopters on the deck, if they start out too high they'll take damage, and if they're dropped inside the carrier they're hard to fly. I doubt if AI units will stay on the deck, so you'll have to order units into an empty chopper.

Share this post


Link to post
Share on other sites

I have tried both LHD scripts above and Im having a problem when I put it on a dedicated server.

The first time I start the mission on the server everything is fine. After the first time being run, my LHD spawns to slow and everything drops in the water. This happens with both the LHD scripts above.

For somereason when the server runs the mission for the first time its all good. After that its broken :-(

Share this post


Link to post
Share on other sites

anyone know how I can get the boat to despawn after someone is out for 5 seconds and respawn back in the lift or add a new boat once one is let down from the life? I am trying to finish my Beach Assault MP and I am having issues trying to figure that out.

---------- Post added at 08:46 PM ---------- Previous post was at 08:44 PM ----------

veh = [this, 3600, 3600] execVM "_SunderScripts\vehicle.sqf"

that is what I usually use on the int of the vehicle on the map.

Share this post


Link to post
Share on other sites
I have tried both LHD scripts above and Im having a problem when I put it on a dedicated server.

The first time I start the mission on the server everything is fine. After the first time being run, my LHD spawns to slow and everything drops in the water. This happens with both the LHD scripts above.

For somereason when the server runs the mission for the first time its all good. After that its broken :-(

I have this problem every time i start the mission. All are spawning under the ship, not on the deck, what can i do please help!

I have the feeling that the ship spawn to late :-(

Share this post


Link to post
Share on other sites

I've got a problem where some people who connect see another copy of the lights of the LHD over the water in different directions. I'm using the server compatible script so there shouldn't be any other copies of the ship or anything and I've not seen one, but this lights thing has happened a few times. Has anybody else had this happen.

Share this post


Link to post
Share on other sites
I have this problem every time i start the mission. All are spawning under the ship, not on the deck, what can i do please help!

I have the feeling that the ship spawn to late :-(

http://www.armaholic.com/forums.php?m=posts&q=7119

---------- Post added at 07:46 ---------- Previous post was at 07:45 ----------

How/where do I install this?

Share this post


Link to post
Share on other sites
http://www.armaholic.com/forums.php?m=posts&q=7119

---------- Post added at 07:46 ---------- Previous post was at 07:45 ----------

How/where do I install this?

I use the spawn LHD for my dedicated games and have no issues with it so far... on a not above with the duplicate lights thing, this script needs to be at the top of the init.sqf and cannot be loaded someplace else as this has to be the first items spawned when it hits the init.sqf. second, as for server issues and maybe duplicate lights, make sure that it is spawning once and by the server... here is what I use to spawn mine and I have used this on every map that I need it for and my team I play with report no issues with spawning on the water or under the LHD. I hope this helps, I would be glad to provide a sample script of my working version if would help... here is what I have at the top of my init.sqf

// Spawn of the LHD Carrier
if (isServer) then {
_LHDspawnpoint = [getPosASL LHD_Center select 0, getPosASL LHD_Center select 1, -0.9];
{
	_dummy = createVehicle [_x, _LHDspawnpoint, [], 0, "NONE"];
	_dummy setdir 228.178;
	_dummy setPos _LHDspawnpoint;
} foreach ["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"];
};

the isserver lines are important to make sure that it only spawns on the server one time... not multiple times when each user loaded the init.sqf.

"LHD_Center" is a hidden "H" pad so the above script can reference a center point to make the LHD... :)

-VRCRaptor

Edited by VRCRaptor

Share this post


Link to post
Share on other sites

Hmmm, I've been running the script from it's own file and executing it from the init line of the invisible H, not from the init.sqf. This is what I have in the invisible H called LHD_Center as told to do from this thread:

this setPosASL [getposASL this select 0, getposASL this select 1, 0]; res=[this]execVM"CreateLHD.sqf"

So you just put that code at the top of your init.sqf and then you create the invisible H with nothing in the init?

Well just tried taking that code out and adding yours to my init.sqf, changing a couple of values so it now reads

// Spawn of the LHD Carrier
if (isServer) then {
   _LHDspawnpoint = [getposasl LHD_Center select 0, getposasl LHD_Center select 1, 0];
   {
       _dummy = createVehicle [_x, _LHDspawnpoint, [], 0, "NONE"];
       _dummy setdir 270;
       _dummy setPos _LHDspawnpoint;
   } foreach ["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"];
};  

Everything is there in the right place on the carrier etc so it seems fine so far, will have to test the mission again to see if it's fixed the duplicate lights problem.

This is my previous script btw also from this thread:

if (isServer) then {
_LHDspawn = _this select 0;
_LHDdir = 270;
_LHDspawnpoint = [getposasl LHD_Center select 0, getposasl LHD_Center select 1, 0];

_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;
};

Edited by clydefrog

Share this post


Link to post
Share on other sites

hmmm... the dup lights thing sound like it makes more than one LHD and there have been many people with the same issue... I have not had any of those running the script I posted... its very stable and everyone I play with on the LHD seems to not have any issues outside the normal BIS stuff. Yes, the invisiable H should not have anything in its init... just post this in the top section of the init.sqf and yopu should be golden... :)

glad its working thus far...

-VRCRaptor

Share this post


Link to post
Share on other sites
hmmm... the dup lights thing sound like it makes more than one LHD and there have been many people with the same issue... I have not had any of those running the script I posted... its very stable and everyone I play with on the LHD seems to not have any issues outside the normal BIS stuff. Yes, the invisiable H should not have anything in its init... just post this in the top section of the init.sqf and yopu should be golden... :)

glad its working thus far...

-VRCRaptor

Tested my mission now a few times with a few people with your version of the LHD script in my init.sqf, seems to work great, everybody spawns on the carrier and nothing weird has happened, thanks.

Share this post


Link to post
Share on other sites
and nothing weird has happened

That's impossible, are you sure you're still playing ArmA? :)

Share this post


Link to post
Share on other sites
That's impossible, are you sure you're still playing ArmA? :)

lol, that's a good point, if everything that could possibly be going wrong isn't going wrong, it probably isn't ArmA.

Share this post


Link to post
Share on other sites
Tested my mission now a few times with a few people with your version of the LHD script in my init.sqf, seems to work great, everybody spawns on the carrier and nothing weird has happened, thanks.

AWESOME!!! great to hear.

-VRCRaptor

Share this post


Link to post
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now
Sign in to follow this  

×