thy_ 164 Posted August 31, 2022 Hey, tudo bem com você? 🤓 Gentlemen, I've read the Jets DLC functions to understand how the USS Freedom Carrier accepts landings by planes with tailhook, 'cause I wanna print out a hintSilent "You did it!", but only and precisely at that cables area (X, Y, Z), even if the Mission Editor changes the carrier's spot. A3_Jets > BIS_fnc_AircraftTailhook Spoiler /* Author: Bravo Zero One development - John_Spartan Description: Aircrfat carrier arrest/recovery function for USS Freedom aircraft carrier Exucution: Call the function via user-action or script for any compatible fixed wing aircrfat [this] spawn bis_fnc_aircraftTailhook; Requirments: - Compatible aircrfat must have an animation for arrest/tail hook selection defined in CfgCehicles and modeled in 3D model (model.cfg) - Compatible aircrfat must have a memory point for cable attach position example of cfgVehicles subclass definitions; tailHook = true; Allow to land on carrier class CarrierOpsCompatability { ArrestHookAnimationList[] = {"tailhook", "tailhook_door_l", "tailhook_door_r"}; List of animation played to animate tailhook. Defined in model.cfg (type user) ArrestHookAnimationStates[] = {0,0.53,1}; Tailhook animation states when down, hooked, up. ArrestHookMemoryPoint = "pos_tailhook"; TailHook memory point in plane model.p3d ArrestMaxAllowedSpeed = 275; Max speed km/h allowed for successful landing ArrestSlowDownStep = 0.8; Simulation step for calcualting how smooth plane will be slowed down. ArrestVelocityReduction = -12; Speed reduced per simulation step }; Parameter(s): _this select 0: mode (Scalar) 0: plane/object Returns: nothing Result: Aircrfat after touch down on carrier deck will be dynamicly slowed down. If speed willbe above 275 km/h (suggested and configured on vanilla assets) wire snap will be simulated. Aircrfat will come to full stop in 155-175 m */ #define EXIT_CODE {_plane animate [_x,_planeHookUpAnimState];} forEach _planeHookAnimList;_plane SetUserMFDvalue [4,0]; private _plane = param [0, objNull]; if (!local _plane) exitWith {}; private _configPath = configFile >> "CfgVehicles" >> typeOf _plane; private _planeCarrierOpsEnabled = (_configPath >> "tailHook") call BIS_fnc_getCfgData; if (_planeCarrierOpsEnabled == 0) exitWith {}; private _planeHookAnimList = (_configPath >> "CarrierOpsCompatability" >> "ArrestHookAnimationList") call BIS_fnc_getCfgData; private _arrestMaxAllowedSpeed = (_configPath >> "CarrierOpsCompatability" >> "ArrestMaxAllowedSpeed") call BIS_fnc_getCfgData; private _arrestSlowDownStep = (_configPath >> "CarrierOpsCompatability" >> "ArrestSlowDownStep") call BIS_fnc_getCfgData; private _arrestVelocityReduction = (_configPath >> "CarrierOpsCompatability" >> "ArrestVelocityReduction") call BIS_fnc_getCfgData; private _planeHookAnimStates = (_configPath >> "CarrierOpsCompatability" >> "ArrestHookAnimationStates") call BIS_fnc_getCfgData; _planeHookAnimStates params ["_planeHookDownAnimState","_planeHookCaughtAnimState","_planeHookUpAnimState"]; private _carrierPart = "Land_Carrier_01_hull_08_1_F"; sleep 2; private _hookAnim = _planeHookAnimList param [0,"",[""]]; waitUntil{!alive _plane || {_plane animationphase _hookAnim == _planeHookUpAnimState || {getPos _plane select 2 < 1}}}; if (!alive _plane || getPos _plane select 2 > 1) exitWith {EXIT_CODE}; private _objects = _plane nearObjects [_carrierPart, 150]; if (count _objects == 0) exitWith {EXIT_CODE}; private _carrier = _objects param [0, objNull]; private _carrierWirePos = _carrier modelToWorld (_carrier selectionPosition "pos_cable_1"); private _distance = _plane distance2D _carrierWirePos; if (_distance > 75) exitWith {EXIT_CODE}; {_plane animate [_x,_planeHookCaughtAnimState, true];} foreach _planeHookAnimList; sleep 0.5; if (speed _plane > _arrestMaxAllowedSpeed ) exitWith {EXIT_CODE; _plane say3D "Land_Carrier_01_wire_snap_sound";}; _plane say3D "Land_Carrier_01_wire_trap_sound"; while {alive _plane && {_plane animationphase _hookAnim != _planeHookUpAnimState && {speed _plane > -10}}} do { _velInitial = velocity _plane; _dirPlane = direction _plane; _plane setVelocity (_velInitial vectorAdd [sin _dirPlane * _arrestVelocityReduction,cos _dirPlane * _arrestVelocityReduction,0]); sleep _arrestSlowDownStep; if (_arrestVelocityReduction >= -3) then {_arrestVelocityReduction = -3;} else {_arrestVelocityReduction = _arrestVelocityReduction + 0.1;}; if (_arrestSlowDownStep <= 0.2) then {_arrestSlowDownStep = 0.03;} else {_arrestSlowDownStep = _arrestSlowDownStep - 0.1;}; }; sleep 2; if (_plane animationphase _hookAnim == _planeHookUpAnimState) exitWith {}; EXIT_CODE; //------------------------------------ //Set Steam Archivement state //------------------------------------ if (canMove _plane && {(isPlayer driver _plane || {(UAVControl _plane) isEqualTo [player,"DRIVER"]})}) then { setStatValue ["JetsGetArrested", 1]; }; A3_Jets > BIS_fnc_AircraftTailhookAi Spoiler params["_params","_isLanding"]; if (_isLanding) then { //handle automated tailhook operations (for AI and player's autopilot) //["[ ] Tailhook 'landing' eh - this: %1",_this] call bis_fnc_logFormat; _params params[["_plane", objNull],"",["_needsHook",false]]; if (isNull _plane || {!alive _plane}) exitWith {}; private _cfg = configFile >> "CfgVehicles" >> typeOf _plane; private _haveHook = (_cfg >> "tailHook") call bis_fnc_getCfgDataBool; if (!_haveHook || !_needsHook) exitWith {}; if (_plane animationPhase "tailhook" > 0.1) then { _plane animate ["tailhook",0]; _plane animate ["tailhook_door_l",0]; _plane animate ["tailhook_door_r",0]; _plane say "Plane_Fighter_01_tailhook_down_sound"; _plane say3D "Plane_Fighter_01_tailhook_down_sound"; }; _plane setUserMFDvalue [0,1]; [_plane] spawn bis_fnc_aircraftTailhook; } else { //handle automated tailhook operations (for AI and player's autopilot) //["[ ] Tailhook 'landingcanceled' eh - this: %1",_this] call bis_fnc_logFormat; private _plane = _params param [0, objNull]; if (isNull _plane || {!alive _plane}) exitWith {}; private _cfg = configFile >> "CfgVehicles" >> typeOf _plane; private _haveHook = (_cfg >> "tailHook") call bis_fnc_getCfgDataBool; if (!_haveHook) exitWith {}; if (_plane animationPhase "tailhook" < 0.1) then { _plane animate ["tailhook",1]; _plane animate ["tailhook_door_l",1]; _plane animate ["tailhook_door_r",1]; _plane say "Plane_Fighter_01_tailhook_up_sound"; _plane say3D "Plane_Fighter_01_tailhook_up_sound"; }; _plane setUserMFDvalue [0,0]; }; How can I smartly track that area to print out the message with no triggers and hidden objects dropped around? Share this post Link to post Share on other sites
pierremgi 4886 Posted September 1, 2022 nearestObjects [_plane,["Land_Carrier_01_Hull_08_1_F"],50] isNotEqualTo [] That's for presence in arresting gear area... That doesn't mean you didn't crash, or bolter (not sure it's possible in Arma). Of course, the plane stops farther: You can try with "Land_Carrier_01_Hull_05_1_F" and speed 0, or test all parts in config viewer / "cfgVehicles" starting with "Land_carrier_01..." 1 Share this post Link to post Share on other sites
Larrow 2822 Posted September 1, 2022 Wait for planes hook animation to be in _planeHookDownAnimState. Then check the state of the plane's hook animation to see if it changes to either _planeHookCaughtAnimState or _planeHookUpAnimState. If it's in _planeHookCaughtAnimState you know it has been caught and possibly landed, maybe also check alive, speed, height above deck and possibly distance to _carrierWirePosition of the plane to make sure it didn't crash, break the wire or abort the landing? All the bits needed can be found in \a3\functions_f_jets\functions\aircraft\fn_aircrafttailhook.sqf 1 Share this post Link to post Share on other sites
thy_ 164 Posted September 24, 2022 Just coming back to share the solution is present in my Vehicle Overhauling Script: Thanks, @pierremgi, and @Larrow for the ideas.Resuming the solution: Instead of looking for cables in the aircraft carrier asset, reading the Jets DLC functions, I realized that the USS Freedom asset is composed of 3 smaller assets. I've stored your asset classnames in a list, and as soon as a plane approaches any classname within the list, the plane gets the action to rearm, repair, and refuel. fn_VO_parameters.sqf: VO_assetsRangeChanger = ["Land_Carrier_01_hull_08_1_F","Land_Carrier_01_hull_07_1_F","Land_Carrier_01_hull_06_1_F"]; fn_VO_globalFunctions.sqf THY_fnc_VO_isStationRangeChanger = { // This function checks if the current station has the ability to change its service range to attemp planes only. If so, the range is increase where _servRng != _currentRng. // Returns the integer range _currentRng. params [["_stat", objNull], ["_veh", objNull], ["_hasRngChanger", false], ["_servRng", 20]]; private ["_rangeChanger", "_currentRng", "_statType"]; _rangeChanger = 80; _currentRng = _servRng; if ( !_hasRngChanger ) exitWith { _currentRng /* Returning. */ }; // Handling Errors: if (_stat isEqualTo objNull) exitWith {if (VO_debugMonitor) then {systemChat "VO > THY_fnc_VO_isStationRangeChanger error: needs a station as parameter."; sleep 15}}; if (_veh isEqualTo objNull) exitWith {if (VO_debugMonitor) then {systemChat "VO > THY_fnc_VO_isStationRangeChanger error: needs a vehicle as parameter."; sleep 15}}; _statType = typeOf _stat; // Range-Changer trigger to action: if ( _veh isKindOf "Plane" AND _statType in VO_assetsRangeChanger ) then { if ( _servRng < _rangeChanger ) then { _currentRng = _rangeChanger }; if ( VO_debugMonitor AND (_currentRng >= _rangeChanger) AND ((_veh distance _stat) <= _currentRng) ) then { systemChat format ["DEBUG: station %1 is a RANGE-CHANGER, its service range increase to %2m for Planes.", _statType, _currentRng]; sleep 3; }; }; _currentRng // returning. }; Cheers, thy SOLVED. Share this post Link to post Share on other sites