Jump to content
roy86

Spawn Aircraft Carrier 'USS Freedom' Jets DLC

Recommended Posts

I've tested this and it spawned with actions:

if (isServer) then {
    USS_FREEDOM_CARRIER = createVehicle ["Land_Carrier_01_base_F",[7577.91,2066.26,0],[],0,"None"];
    USS_FREEDOM_CARRIER setPosWorld [7577.91,2066.26,0];
    USS_FREEDOM_CARRIER setDir 270;
    [USS_FREEDOM_CARRIER] call BIS_fnc_Carrier01PosUpdate;
    publicVariable "USS_FREEDOM_CARRIER";
} else {
    [] spawn {
        waitUntil {!(isNull (missionNamespace getVariable ["USS_FREEDOM_CARRIER",objNull]))};
        [USS_FREEDOM_CARRIER] call BIS_fnc_Carrier01Init;
    };
};

 

Share this post


Link to post
Share on other sites

ACC spawns and can land but still no catapults

 

if (isServer) then {
    USS_FREEDOM_CARRIER = createVehicle ["Land_Carrier_01_base_F",[7577.91,2066.26,0],[],0,"None"];
    USS_FREEDOM_CARRIER setPosWorld [7577.91,2066.26,0];
    USS_FREEDOM_CARRIER setDir 270;
    [USS_FREEDOM_CARRIER] call BIS_fnc_Carrier01PosUpdate;
    publicVariable "USS_FREEDOM_CARRIER";
} else {
    [] spawn {
        waitUntil {!(isNull (missionNamespace getVariable ["USS_FREEDOM_CARRIER",objNull]))};
        [USS_FREEDOM_CARRIER] call BIS_fnc_Carrier01Init;
    };
};

 

Share this post


Link to post
Share on other sites

only thin i see in the rpt to do with the jet/carrier is this

 

B_Plane_Fighter_01_Stealth_F: gear_f_hook_down - unknown animation source hook

Share this post


Link to post
Share on other sites

I've worked out the problem. now just have to build a scripted work around

 

Share this post


Link to post
Share on other sites

Ok.. after a bit of test, fix and learn, this now seems to work. Try this....
 

Init.sqf

if (isServer) then {
	private _carrier = createVehicle ["Land_Carrier_01_base_F",getMarkerPos "marker_0",[],0,"None"];
	_carrier setPosWorld getMarkerPos "marker_0";
	_carrier setDir 270;
	[_carrier] call BIS_fnc_Carrier01PosUpdate;
	["Carrier %1 Found. Server Initilising.",_carrier] call BIS_fnc_logFormatServer;
	missionNamespace setVariable ["USS_FREEDOM_CARRIER",_carrier]; publicVariable "USS_FREEDOM_CARRIER";
} else {
	[] spawn {
		waitUntil { !(isNull (missionNamespace getVariable ["USS_FREEDOM_CARRIER",objNull])) };
		["Carrier %1 Found. Client Initilising.",USS_FREEDOM_CARRIER] call BIS_fnc_logFormatServer;
		if (count (USS_FREEDOM_CARRIER getVariable ["bis_carrierParts", []]) == 0) then {
			["Carrier %1 is empty. Client Fixing.",str "bis_carrierParts"] call BIS_fnc_logFormatServer;
			private _carrierPartsArray = (configFile >> "CfgVehicles" >> typeOf USS_FREEDOM_CARRIER >> "multiStructureParts") call BIS_fnc_getCfgDataArray;
			private _partClasses = _carrierPartsArray apply {_x select 0};
			private _nearbyCarrierParts = nearestObjects [USS_FREEDOM_CARRIER,_partClasses,500];
			{
				private _carrierPart = _x;
				private _index = _forEachIndex;
				{
					if ((_carrierPart select 0) isEqualTo typeOf _x) exitWith { _carrierPart set [0,_x]; };
				} forEach _nearbyCarrierParts;
				_carrierPartsArray set [_index,_carrierPart];
			} forEach _carrierPartsArray;
			USS_FREEDOM_CARRIER setVariable ["bis_carrierParts",_nearbyCarrierParts];
			["Carrier %1 was empty. Now contains %2.",str "bis_carrierParts",USS_FREEDOM_CARRIER getVariable ["bis_carrierParts", []]] call BIS_fnc_logFormatServer;
		};
		[USS_FREEDOM_CARRIER] spawn { sleep 1; _this call BIS_fnc_Carrier01Init};
	};
};

 

  • Like 1

Share this post


Link to post
Share on other sites

Trying this now, I assume this would be our correct init.sqf with wps

 

if (isServer) then {
    private _carrier = createVehicle ["Land_Carrier_01_base_F",[7577.91,2066.26,0] "marker_0",[],0,"None"];
    _carrier setPosWorld [7577.91,2066.26,0] "marker_0";
    _carrier setDir 270;
    [_carrier] call BIS_fnc_Carrier01PosUpdate;
    ["Carrier %1 Found. Server Initilising.",_carrier] call BIS_fnc_logFormatServer;
    missionNamespace setVariable ["USS_FREEDOM_CARRIER",_carrier]; publicVariable "USS_FREEDOM_CARRIER";
} else {
    [] spawn {
        waitUntil { !(isNull (missionNamespace getVariable ["USS_FREEDOM_CARRIER",objNull])) };
        ["Carrier %1 Found. Client Initilising.",USS_FREEDOM_CARRIER] call BIS_fnc_logFormatServer;
        if (count (USS_FREEDOM_CARRIER getVariable ["bis_carrierParts", []]) == 0) then {
            ["Carrier %1 is empty. Client Fixing.",str "bis_carrierParts"] call BIS_fnc_logFormatServer;
            private _carrierPartsArray = (configFile >> "CfgVehicles" >> typeOf USS_FREEDOM_CARRIER >> "multiStructureParts") call BIS_fnc_getCfgDataArray;
            private _partClasses = _carrierPartsArray apply {_x select 0};
            private _nearbyCarrierParts = nearestObjects [USS_FREEDOM_CARRIER,_partClasses,500];
            {
                private _carrierPart = _x;
                private _index = _forEachIndex;
                {
                    if ((_carrierPart select 0) isEqualTo typeOf _x) exitWith { _carrierPart set [0,_x]; };
                } forEach _nearbyCarrierParts;
                _carrierPartsArray set [_index,_carrierPart];
            } forEach _carrierPartsArray;
            USS_FREEDOM_CARRIER setVariable ["bis_carrierParts",_nearbyCarrierParts];
            ["Carrier %1 was empty. Now contains %2.",str "bis_carrierParts",USS_FREEDOM_CARRIER getVariable ["bis_carrierParts", []]] call BIS_fnc_logFormatServer;
        };
        [USS_FREEDOM_CARRIER] spawn { sleep 1; _this call BIS_fnc_Carrier01Init};
    };
};
 

Share this post


Link to post
Share on other sites

Get rid of the "marker_0"  it breaks the command syntax. 

  • Like 1

Share this post


Link to post
Share on other sites

roy86 I can confirm that this is working on our server, thanks for your time and help man. Greatly appreciate it. For the record this is our exact init.sqf 

 

if (isServer) then {
    private _carrier = createVehicle ["Land_Carrier_01_base_F",[7577.91,2066.26,0],[],0,"None"];
    _carrier setPosWorld [7577.91,2066.26,0];
    _carrier setDir 270;
    [_carrier] call BIS_fnc_Carrier01PosUpdate;
    ["Carrier %1 Found. Server Initilising.",_carrier] call BIS_fnc_logFormatServer;
    missionNamespace setVariable ["USS_FREEDOM_CARRIER",_carrier]; publicVariable "USS_FREEDOM_CARRIER";
} else {
    [] spawn {
        waitUntil { !(isNull (missionNamespace getVariable ["USS_FREEDOM_CARRIER",objNull])) };
        ["Carrier %1 Found. Client Initilising.",USS_FREEDOM_CARRIER] call BIS_fnc_logFormatServer;
        if (count (USS_FREEDOM_CARRIER getVariable ["bis_carrierParts", []]) == 0) then {
            ["Carrier %1 is empty. Client Fixing.",str "bis_carrierParts"] call BIS_fnc_logFormatServer;
            private _carrierPartsArray = (configFile >> "CfgVehicles" >> typeOf USS_FREEDOM_CARRIER >> "multiStructureParts") call BIS_fnc_getCfgDataArray;
            private _partClasses = _carrierPartsArray apply {_x select 0};
            private _nearbyCarrierParts = nearestObjects [USS_FREEDOM_CARRIER,_partClasses,500];
            {
                private _carrierPart = _x;
                private _index = _forEachIndex;
                {
                    if ((_carrierPart select 0) isEqualTo typeOf _x) exitWith { _carrierPart set [0,_x]; };
                } forEach _nearbyCarrierParts;
                _carrierPartsArray set [_index,_carrierPart];
            } forEach _carrierPartsArray;
            USS_FREEDOM_CARRIER setVariable ["bis_carrierParts",_nearbyCarrierParts];
            ["Carrier %1 was empty. Now contains %2.",str "bis_carrierParts",USS_FREEDOM_CARRIER getVariable ["bis_carrierParts", []]] call BIS_fnc_logFormatServer;
        };
        [USS_FREEDOM_CARRIER] spawn { sleep 1; _this call BIS_fnc_Carrier01Init};
    };
};
 

Share this post


Link to post
Share on other sites

No worries. Glad we got it in the end. 

  • Like 1

Share this post


Link to post
Share on other sites

Updated first post with working version!!

  • Like 2

Share this post


Link to post
Share on other sites

Great stuff man. Now I'm going to research adding custom missions. Wish me luck lol.

Always good to meet another helpful person who lives in my area.  

  • Like 1

Share this post


Link to post
Share on other sites
8 hours ago, roy86 said:

Updated first post with working version!!

 

Works great roy86

 

I appreciate the work you've done.

Share this post


Link to post
Share on other sites

Sorry Roy was away for a few days.

 

I too would like to say thanks for the work you did on this.

Updated the server code as above and Catapults now working perfectly.

Thanks again for your help

 

Zeus

 

 

Share this post


Link to post
Share on other sites

Hi all.

 

A quick one on the AAA and SAM batteries for the ship.  How can I spawn them to make them usable ?

 

I have them in the mission file atm but they do nothing and you cannot take ownership etc..

Any advice appreciated.

 

I am wondering if it's the type of objects I am loading. Maybe they are not usable or something..

 

            type="B_SAM_System_01_F";

            type="B_SAM_System_02_F";

            type="B_AAA_System_01_F";

Zeus

Share this post


Link to post
Share on other sites

I have a function I wrote for PO4, I'll post it up soon ;)

  • Like 1

Share this post


Link to post
Share on other sites

Is there any way to hide the runway outline on the ingame map? or spawn it in without the DynamicAirport_01_F so the carrier isn't actually treated as a runway?  i'd like players to have to try and find the carrier's location but the rectangle on the map gives away its position :/

Share this post


Link to post
Share on other sites

Hey Roy86!
Thanks for the script man!
But unfortunately I'm having some issues. Maybe you can help me out.

The code I used is the server one:

private _carrier = createVehicle ["Land_Carrier_01_base_F",[9202.701,25039.354,59.762],[],0,"None"];
    _carrier setPosWorld getMarkerPos "marker_0";
    _carrier setDir 0;

The problem is: 
If I input position on line 1 (createVehicle), it spawns half in the water, half outside of it. The left side of the carrier is sinking. the right one is ok.
If I input in the SetPosWorld. It spawns flying.
And if I use it on both lines, it spawns 2 carrier, one on top of each other xD
It's really funny, but, not what I intend haha

I've changed the setDir to 0, in order to keep it facing north. No problem with that.
 

Share this post


Link to post
Share on other sites
On 14/03/2018 at 12:16 PM, MidaZ IDG said:

Hey Roy86!
Thanks for the script man!
But unfortunately I'm having some issues. Maybe you can help me out.

The code I used is the server one:

private _carrier = createVehicle ["Land_Carrier_01_base_F",[9202.701,25039.354,59.762],[],0,"None"];
    _carrier setPosWorld getMarkerPos "marker_0";
    _carrier setDir 0;

The problem is: 
If I input position on line 1 (createVehicle), it spawns half in the water, half outside of it. The left side of the carrier is sinking. the right one is ok.
If I input in the SetPosWorld. It spawns flying.
And if I use it on both lines, it spawns 2 carrier, one on top of each other xD
It's really funny, but, not what I intend haha

I've changed the setDir to 0, in order to keep it facing north. No problem with that.
 

Are you using the singleplayer  part on a server? Try the multiplayer script.

Share this post


Link to post
Share on other sites

Is there a variant of this script that works with the new destroyer?

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

×