Jump to content
Sign in to follow this  
vincentz

LHD Random placement different ASL. Cant place units on carrier...

Recommended Posts

I've started loosing my mind over this. Before someone breaks in and says :" this has been asked before, use search!" then its not the typical setposasl [x,x,15.7]....

I've added a random placed carrier spawn on Lingor Island, but unfortunately the height is not same everywhere (donno if its because of waves, terrain levels or something completely different).

I've then used attachto to different objects and units, so they are placed correctly (random carrier is also random direction of carrier ;))

However, attachto, though I thought it was going to be, is not a constant, meaning every new place carrier is placed, a new Pos/ASL/ATL height is being used...

So I either gets "flying" Carrier Crew or units without legs.

The only solution I've found is to drop a roadcone on the deck, and then attach all the units to the roadcone. That way the units have a constant height to go for. Unfortunately if someone kicks the cone, all equipment and personel goes flying, as they are attached.

Please help me find another solution. I really need the random placed carrier, and a good constant height to place units.

//***** CREATING LHD CARRIER *****
waituntil {!isnil "bis_fnc_init"};
CarRND = floor (random 4);
switch (CarRND) do {
case 0: {carX = 0; carY = random 10240};
case 1: {carX = 10240; carY = random 10240};
case 2: {carX = random 10240; carY = 0};
case 3: {carX = random 10240; carY = 10240};
};
LHD1 setposasl [carX, carY, 0];
LHD1Dir = random 359;
LHD1 setdir LHD1Dir;

LHD1 call BIS_EW_fnc_createLHD;

Stuff placed

Liftupramp = "HeliH" createVehicle (getposasl LHD1); Liftupramp attachto [LHD1, [22.5,-92,17.5]]; Liftupramp setdir getdir Liftupramp-90;
//Liftupramp setposasl getposasl CPLHD;
Liftupramp2 = "HeliH" createVehicle (getposasl LHD1); Liftupramp2 attachto [LHD1, [-22.5,-42.5,0]]; Liftupramp2 setdir getdir Liftupramp+90;
//Liftupramp2 setposasl getposasl CPLHD;
RHIBRamp = "HeliH" createVehicle (getposasl LHD1); RHIBRamp attachto [LHD1, [-21,22,9]]; // RHIBRamp setdir getdir RHIBRamp-90;
StorageAirA = "PARACHUTE_TARGET" createVehicle (getposasl lhd1); StorageAirA attachto [LHD1, [-3,-17,10.45]]; StorageAirA setdir getdir StorageAirA+90;
StorageAirB = "PARACHUTE_TARGET" createVehicle (getposasl lhd1); StorageAirB attachto [LHD1, [-3,4,10.45]]; StorageAirB setdir getdir StorageAirB+90;

_carriercrew = CreateGroup west;
"USMC_LHD_Crew_Blue" createUnit [getposasl GEN1, _carriercrew, "Liftcrew1 = this; this attachto [GEN1, [16,-85,0]]; this allowDamage false;"];
"USMC_LHD_Crew_Yellow" createUnit [getposasl GEN1, _carriercrew, "this attachto [GEN1, [10,-95,0]]; this allowDamage false;];

Edited by vincentz

Share this post


Link to post
Share on other sites

Finally someone stating the same problem ;-)

I wrapped my head around this issue, too.

Actually, your "dropping a cone"-solution sound pretty good. Maybe you can use an even less intrusive object and disable its simulation as soon it dropped on the floor or something? I am thinking of https://community.bistudio.com/wiki/enableSimulation

One could try:

- place droppable cone

- wait until cone is on floor (just sleep 2 should be fine)

- disableSimulation on cone to prevent kicking over

Another - not working - approach which I tried in my init.sqf:

// CAUTION: Most objects on the Nimitz carrier on dedicated server are 20 cm too high but not in SP or local server
// Example: Mission briefing room is on 12.1 m altitude in SP but 11.9 on dedi, flight deck is 17.5 in SP.
// But it looks like this also depends on the location of the carrier, e.g. outside the map border, these values differ and also the difference seems to differ!
// set objects like this:
//nul = this spawn { waitUntil{not isNil ""nimitz_offset""}; _this setPosASL [getPos _this select 0, getPos _this select 1, 17.38 + nimitz_offset]};
// but when I added this to all objects on the carrier and moved it out of map borders, I could not access boxes anymore!
// Also this could incude a performance hit as every spawn in init is called as a thread
// Only a single machine (the server) should broadcast the variable
if (isServer) then {
nimitz_offset = if (isDedicated) then {-0.02} else {-0.10};

// map placing specific offset, correct this one, if common for both host variants
//nimitz_offset = nimitz_offset + 0.25;

   publicVariable "nimitz_offset";
};

a bit ugly and also not really working that good.

Share this post


Link to post
Share on other sites

another thought I had was to let the cone drop, then copy its location, delete the cone, make a nonmovable object at the cones dropped position and attach stuff to the nonmovable (invi heli) point.

Could work, but problem is I setup carrier before spawn, and somehow it wont let me use sleep, so I have to move objects placed to after init.

I was really hoping for some other, more clean way of doing stuff.

Share this post


Link to post
Share on other sites

ASL height varies as the waves move.

A bit like okurz suggested, you could just create a helipad at some coordinates on the map and attach the stuff to it.

eg.:

_helih = "HeliHEmpty" createVehicle [0, 0, 0];
//Either setpos the objects to desired locations and attach them immediately to the HeliHEmpty
//Or fiddle around until you have the needed coordinates for the attachTo command
_myvehicle setpos _desiredpos;
_myvehicle attachTo [_helih];
//or
_myvehicle attachTo [_helih, _myarrayofcoordinates];

Share this post


Link to post
Share on other sites

I've decided to go with a different "angle". I primarily use deckcrew for services on carrier, and since attachto makes them act funny, I wanted to use setpos (ATL/ASL/POS) to put the crew down. That way (if i put them a bit higher) they will fall into place, and not fly or get their legs cut off.

However, I have a math problem.... :( How do I place them correctly?

If the centerpoint of the LHD is LHD1 and the direction of the LHD is LHD1Dir what would the formula be for a crew who would have been "attachto [LHD1, [16,-85,17]]"?

My guess (which is obviously wrong) would have been :

"USMC_LHD_Crew_Blue" createUnit [[(getPos LHD1 select 0)+ (16*cos(LHD1Dir)),(getPos LHD1 select 1)+ (-85*sin(LHD1Dir)), 17].

Help needed :D

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  

×