Jump to content

Recommended Posts

I am attempting to edit the Virtual Vehicle Spawner by Tonic to allow me to spawn only planes on the Nimitz carrier and only helicopters on the Atlas LHD.

I have the code working 95% of the way I would like but I am running into an issue where planes will spawn on the LHD after I have spawned helicopters.

A brief description of the code as I read it:
Create the vehicle defined under _className earlier in the code on a previously determined position.

Disable the damage of that vehicle.

 

Check to see if there is a plane within five meters of the object named nimitz_pad_1 and select it.
Check to see if there is a helicopter within five meters of the object named wasp_pad_1 and select it.

Check to see if there is a helicopter within five meters of the object named wasp_pad_2 and select it.

 

If there is not a plane within five meters of the object named nimitz_pad_1 then set the vehicle's direction and move it to the object named nimitz_pad_1.
If there is a plane within five meters of the object named nimitz_pad_1 then set the vehicle's direction and move it to the object named nimitz_pad_2.

 

If there is not a helicopter within five meters of the object named wasp_pad_1 then set the vehicle's direction and move it to the object named wasp_pad_1.
If there is a plane within five meters of the object named wasp_pad_2 then set the vehicle's direction and move it to the object named wasp_pad_3.
If there is a plane within five meters of the object named wasp_pad_1 then set the vehicle's direction and move it to the object named wasp_pad_2.

Spoiler

_vehicle = _className createVehicle _position;
_vehicle allowDamage false;

_planeCheck = nearestObjects[nimitz_pad_1,["Plane"],5] select 0;
_helCheck = nearestObjects[wasp_pad_1,["Helicopter"],5] select 0;
_hel2Check = nearestObjects[wasp_pad_2,["Helicopter"],5] select 0;

if (isNil "_planeCheck") then {_vehicle setDir _direction; _vehicle setPosASL (getPosASL nimitz_pad_1);}
    else {if (!isNil "_planeCheck") then {_vehicle setDir _direction + 180; _vehicle setPosASL (getPosASL nimitz_pad_2)}};

if (isNil "_helCheck") then {_vehicle setDir _hel_dir; _vehicle setPosASL (getPosASL wasp_pad_1)};
if (!isNil "_hel2Check")
    then {_vehicle setDir _hel_dir; _vehicle setPosASL (getPosASL wasp_pad_3);}
    else {if (!isNil "_helCheck") then {_vehicle setDir _hel_dir; _vehicle setPosASL (getPosASL wasp_pad_2)}};

 

 

I'm beating my head into a wall on this one. I know it is something in the code but four people looking at it together couldn't sort out exactly what my issue it.

Thanks in advance for the help!

Share this post


Link to post
Share on other sites

Your ships are sailing (moving),... or are they static?

Well. I guess static.

So, make it simple: in editor, place aircraft/helo as you like they spawn and right click on them/  log / log position to clipboard.

Now, you have an array of workable positions (_arrayOfPositions you can sort helos/aircraft ones)

And, use the alternative syntax of the createVehicle command, this way:

 

private _pos = _arrayOfPositions select 0;  // something like [1482.26,6235.69,50.8909]
private _plane  = createVehicle ["B_Plane_Fighter_01_F",_pos, [],0, "can_collide"];
_plane  setdir (what direction you want);

 

"can_collide" insures the exact position. On the other hand, if the place is still occupied, the collision will blow the assets.

You can check that by:   (ATLToASL _pos nearObjects ["air",5]) isNotEqualTo [] and decide what to do.

For respawning any edited / scripted aircraft on a deck, at their initial positions, it's more difficult, especially if you need specific pylon loadouts and/or folded wings.... I recommend you the advanced module included in this mod.

 

 

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

×