Hi. Depends if tent has source animation available. If it does, then it should be exactly as you done. Changing 1 to 0 should hide/unhide doors of the tent. To be able to animate, source has to be set to "user" by config. I tried this code with "Land_MedicalTent_01_NATO_generic_open_F" and it worked. Not really sure where is the problem if it didn't worked for you. Maybe wrong animation source name ?
//Hide/unhide doors
tent animateSource ["Door_Hide",0,TRUE];
//Debug-get all source animations
_animations = configProperties [(configfile >> "CfgVehicles" >> typeOf tent >> "AnimationSources"),"TRUE",TRUE] apply {configName _x};
systemChat str _animations;
In case when tent doesn't have any animation source, you would have to replace the object on the original position with original vector.
Something like this:
soldierXXXX_fnc_replaceWith = {
scriptName "soldierXXXX_fnc_replaceWith";
params ["_original","_new"];
private _pos = getPosWorldVisual _original;
private _dir = vectorDirVisual _original;
private _up = vectorUpVisual _original;
private _name = vehicleVarName _original;
deleteVehicle _original;
private _object = _new createVehicle [0,0,0];
_object setPosWorld _pos;
_object setVectorDirAndUp [_dir,_up];
_object setVehicleVarName str _original;
missionNamespace setVariable [str _original,_object];
_object
};
[tent,"Land_MedicalTent_01_white_IDAP_open_F"] call soldierXXXX_fnc_replaceWith;
Hello,
is there a way to open and close the doors of the tents with in game via script? I tried - tent animateSource ["Door_Hide",1,true]; - or similar but didn't work.
If you need simple flyover just for effect, I recommend using BIS_fnc_ambientFlyby. You just fill the parameters and the script takes care of the rest.