Waldemar 337 12 Posted April 15, 2022 I have written a set of scripts which toggle the state of all vehicle's doors. It works on a vanilla UH-80 helicopter (class name is "B_Heli_Transport_01_F"). Before using the script I see that all the doors are closed: [["door_l",0],["door_back_l_lock",0],["door_r",0],["door_back_r_lock",0]] After usage of the script I see that all the doors are toggled to the opened state: [["door_l",1],["door_back_l_lock",1],["door_r",1],["door_back_r_lock",1]] I can also visually inspect the helicopter and I see that the doors are now opened. When I use the script on a vanilla CH-67 helicopter (class name is "B_Heli_Transport_03_F"), the doors' states are not changed. Before running the script: [["door_rt",0],["door_rb",0],["door_lt",0],["door_lb",0],["door_rear",0],["door_rear_hide",0]] After running the script: [["door_rt",0],["door_rb",0],["door_lt",0],["door_lb",0],["door_rear",0],["door_rear_hide",0]] What can be a reason for this behaviour ? Share this post Link to post Share on other sites
Waldemar 337 12 Posted April 15, 2022 If you need the source code of my scripts, here they are. <root>\init.sqf : // init.sqf. // Functions. MCA_fn_strHasPrefix = compile preprocessFileLineNumbers "scripts\MCA_fn_strHasPrefix.sqf"; MCA_fn_getVehicleDoorAnimes = compile preprocessFileLineNumbers "scripts\MCA_fn_getVehicleDoorAnimes.sqf"; MCA_fn_getVehicleDoorStates = compile preprocessFileLineNumbers "scripts\MCA_fn_getVehicleDoorStates.sqf"; MCA_fn_oppositeState = compile preprocessFileLineNumbers "scripts\MCA_fn_oppositeState.sqf"; MCA_fn_toggleAllDoors = compile preprocessFileLineNumbers "scripts\MCA_fn_toggleAllDoors.sqf"; <root>\scripts\MCA_fn_getVehicleDoorAnimes.sqf : // MCA_fn_getVehicleDoorAnimes.sqf. params ["_veh"]; private ["_animeNames", "_doorAnimes", "_ok"]; _animeNames = animationNames _veh; _doorAnimes = []; { _ok = [_x, "door_"] call MCA_fn_strHasPrefix; if (_ok) then { _doorAnimes pushBack _x; }; } forEach _animeNames; _doorAnimes <root>\scripts\MCA_fn_getVehicleDoorStates.sqf : // MCA_fn_getVehicleDoorStates.sqf. params ["_veh"]; private ["_doorAnimes", "_doorStates", "_doorPhase"]; _doorAnimes = _veh call MCA_fn_getVehicleDoorAnimes; _doorStates = []; { _doorPhase = _veh animationPhase _x; _doorStates pushBack [_x, _doorPhase]; } forEach _doorAnimes; _doorStates <root>\scripts\MCA_fn_oppositeState.sqf : // MCA_fn_oppositeState.sqf. params ["_state"]; if (_state == 0) exitWith { 1 }; if (_state == 1) exitWith { 0 }; false <root>\scripts\MCA_fn_strHasPrefix.sqf : // MCA_fn_strHasPrefix.sqf. params ["_s", "_prefix"]; private ["_prefix_size"]; _prefix_size = count _prefix; if (_prefix_size == 0) exitWith { false }; private ["_i"]; _i = _s find [_prefix, 0]; if (_i == 0) exitWith { true }; false <root>\scripts\MCA_fn_toggleAllDoors.sqf : // MCA_fn_toggleAllDoors.sqf. params ["_veh"]; private ["_doorStates"]; _doorStates = _veh call MCA_fn_getVehicleDoorStates; { _veh animateDoor [_x select 0, (_x select 1) call MCA_fn_oppositeState]; } forEach _doorStates; Thanks for your help. Share this post Link to post Share on other sites
sarogahtyp 1108 Posted April 15, 2022 the reason for this could be different animation names for the two helicopter types or different animation methods. I would first check the configs of those helis for the animation names. Its a long time since I did check those things but if I did it right the there are this names: UH-870 Door_L Door_R CH-47 Door_L_source Door_R_source Door_rear_source Share this post Link to post Share on other sites
Waldemar 337 12 Posted April 15, 2022 I took the animation names which were returned by the built-in 'animationNames' function. Is there another source of animation names available ? P. S. The config viewer that is available as GUI interface in the editor shows different door animation names. This is strange. I have several questions to the developers then. 1. Why is the real config different from the values returned by the built-in 'animationNames' function ? 2. How can I use the 'animationNames' function to get door animation names ? 3. How can I get real animation names in the script without the 'animationNames' function ? Share this post Link to post Share on other sites
sarogahtyp 1108 Posted April 15, 2022 Yes you can see those information in the config class of the desired object. For that you can use edens config browser. The easiest way to get there is to install @7erra's Editing Extensions (it will NOT add dependencies to your missions!): https://steamcommunity.com/sharedfiles/filedetails/?id=1387934106 Then after you have opened your mission in Eden just create your uh-80 and ch-67 and right click it. On the bottom of the now opened menu you ll find an entry to get the vehicle config entry in config browser (something like "find in config viewer..."). Click it! If the config has loaded and is open then on the left side the classname of the heli ("B_CTRG_Heli_Transport_01_sand_F" or similar) is marked already. double click it and the whole entry of the heli will open. Now you can see the sub entry "AnimationSources". Clicking there will you show the wanted names. But not all of those animation names will work. If I remember right then only the animations which have the property "source" set to "user" or "door" may work... 1 Share this post Link to post Share on other sites
Waldemar 337 12 Posted April 15, 2022 Thank you very much for your help. If anyone will face the same difficulty, I am posting here an updated script which seems to be working. <root>\init.sqf : is the same as above <roo t>\scripts\MCA_fn_getVehicleDoorAnimes.sqf : // MCA_fn_getVehicleDoorAnimes.sqf. params ["_veh"]; private ["_vehClassName", "_animeNames", "_doorAnimes", "_ok", "_classPaths"]; _vehClassName = typeOf _veh; _classPaths = "true" configClasses (configFile >> "CfgVehicles" >> _vehClassName >> "AnimationSources"); _animeNames = []; { _animeNames pushBack (configName (_x)); } forEach _classPaths; //_animeNames = animationNames _veh; // This function shows wrong animation names ! _doorAnimes = []; { _ok = [toLower _x, "door_"] call MCA_fn_strHasPrefix; if (_ok) then { _doorAnimes pushBack _x; }; } forEach _animeNames; _doorAnimes <root>\scripts\MCA_fn_getVehicleDoorStates.sqf : // MCA_fn_getVehicleDoorStates.sqf. params ["_veh"]; private ["_doorAnimes", "_doorStates", "_doorPhase"]; _doorAnimes = _veh call MCA_fn_getVehicleDoorAnimes; _doorStates = []; { //_doorPhase = _veh animationPhase _x; _doorPhase = _veh animationSourcePhase _x; _doorStates pushBack [_x, _doorPhase]; } forEach _doorAnimes; _doorStates <root>\scripts\MCA_fn_oppositeState.sqf : is the same as above <root>\scripts\MCA_fn_strHasPrefix.sqf : is the same as above <root>\scripts\MCA_fn_toggleAllDoors.sqf : is the same as above Now the states of the CH-67 (class name is "B_Heli_Transport_03_F") doors are changed. [["Door_R_source",0],["Door_L_source",0],["Door_rear_source",0]] [["Door_R_source",1],["Door_L_source",1],["Door_rear_source",1]] P. S. For some reason the unarmed version of this CH-67 (class name "B_Heli_Transport_03_unarmed_F") is not working. 😂 1 Share this post Link to post Share on other sites
Waldemar 337 12 Posted April 15, 2022 For some reason the unarmed version of the CH-67 (class name "B_Heli_Transport_03_unarmed_F") does not show door animations. _vehClassName = typeOf veh_1; _classPaths = "true" configClasses (configFile >> "CfgVehicles" >> _vehClassName >> "AnimationSources"); _classPaths veh_1 is the name of the helicopter object. Quote [bin\config.bin/CfgVehicles/Heli_Transport_03_unarmed_base_F/AnimationSources/Minigun_Hide_Source,bin\config.bin/CfgVehicles/Heli_Transport_03_unarmed_base_F/AnimationSources/MainTurret,bin\config.bin/CfgVehicles/Heli_Transport_03_unarmed_base_F/AnimationSources/MainGun,bin\config.bin/CfgVehicles/Heli_Transport_03_unarmed_base_F/AnimationSources/MainTurret2,bin\config.bin/CfgVehicles/Heli_Transport_03_unarmed_base_F/AnimationSources/MainGun2] 🙃 OK. I will try not to use the built-in vehicles anymore. CUP and RHS vehicles are much better. Share this post Link to post Share on other sites