giovafr 10 Posted June 2, 2014 Hi all. Next to an other discussion, i share my solution to use tiers vehicles in your missions without depending on their mods. Description : when you create a mission and place a vehicle that is not included with Arma3, the player will got an error if he doesn't have the mod. Solution : With my function, you give a list of desired vehicles. If one of them is available, then the vehicle will be replaced by it (the first vehicle in the list is prioritary on the others) Exemple : First of all DO NOT place modded vehicles, use only BIS vehicles, so the mission is not MOD dependant. Ok lets say you placed a A10 plane (the "B_Plane_CAS_01_F" vehicle) available for all as it is an Arma3 vehicle You would like to replace it by a FA18 In mission Editor, double click on the plane, then write this in its init field : if(isnil"TryReplace")then{call compile preprocessFileLineNumbers "TryReplace.sqf";};[this,"JS_JC_FA18F"] call TryReplace; if you named it "myplane", you'll have to use this syntax (or myplane will become objnull) if(isnil"TryReplace")then{call compile preprocessFileLineNumbers "TryReplace.sqf";};myplane = [this,"JS_JC_FA18F"] call TryReplace; Now if the player have the FA18 mod, the plane will be a FA18, if he doesn't have it, it'll be a classic A10, no error raised. Other example : if(isnil"TryReplace")then{call compile preprocessFileLineNumbers "TryReplace.sqf";};myplane=[this,["MV22","kyo_MH47E_HC"]] call TryReplace; if "MV22" vehicle exists the plane will be replaced by it. If not, it'll try to remplace it by "kyo_MH47E_HC" plane. If none of both exists it will stay the default plane, no error raised. This function works if the plane got crew or not, also if there is a waypoint attached to the vehicle. WARNING : allways make a test : disable all mods, restart the game then test. If there is a problem, edit mission.sqm with a text editor, and make sure that addOns[] and addOnsAuto[] sections only contains A3xxxxxxxxxx mods. Here my function, create a TryReplace.sqf file,and copy this code inside it : TryReplace= { private["_obj","_classes","_pos","_dir","_vel","_result","_wp"]; _obj = _this select 0; _classes = _this select 1; if(typeName "" == typeName _classes)then { _classes = [_classes]; }; _pos = getPos _obj; _dir = direction _obj; _vel = velocity _obj; _result = _obj; { if(isClass (configFile >> "CfgVehicles" >> _x))exitWith { _wp = _obj call WaypointAttachedToVehi; deleteVehicle _obj; _typepos = "NONE"; if((_pos select 2) > 5)then { _typepos = "FLY"; }; _result = createVehicle[_x, _pos, [], 0, _typepos]; _result setDir _dir; if(count _wp > 0)then { _wp waypointAttachVehicle _result; }; _result setVelocity _vel; }; }forEach _classes; _result }; WaypointAttachedToVehi= { private["_vehi","_result","_grp"]; if(isNull _this)exitWith { _err = "Argument given to WaypointAttachedToVehi is null"; diag_log _err; [_err] call BIS_fnc_error; [] }; if(typeName player != typeName _this)exitWith { _err = "Wrong argument given to WaypointAttachedToVehi, it should be an object (a vehicle)"; diag_log _err; [_err] call BIS_fnc_error; [] }; _vehi = _this; _result = []; for "_i" from 0 to (count allGroups) do { _grp = allGroups select _i; { if((waypointAttachedVehicle _x) == _vehi)exitWith {_result = _x}; }forEach waypoints _grp; if(count _result > 0)exitWith{}; }; _result }; Share this post Link to post Share on other sites