Jump to content
Sign in to follow this  
ward1591

Having Trouble Locking Cargo Tower Door

Recommended Posts

So i used this same format on other building doors which have worked but it doesn't seem to work with the cargo tower doors anyone know why?

((nearestObjects [crypticbase1, ["Land_Cargo_Tower_V3_F"], 10]) select 0) setVariable ['bis_disabled_Door_1',1,true];   
((nearestObjects [crypticbase1, ["Land_Cargo_Tower_V3_F"], 10]) select 0) setVariable ['bis_disabled_Door_2',1,true];   
((nearestObjects [crypticbase1, ["Land_Cargo_Tower_V3_F"], 10]) select 0) setVariable ['bis_disabled_Door_3',1,true];   
((nearestObjects [crypticbase1, ["Land_Cargo_Tower_V3_F"], 10]) select 0) setVariable ['bis_disabled_Door_4',1,true];  

Edited by ward1591

Share this post


Link to post
Share on other sites

I've just checked the config. The cargotower should act no different than the other BIS buildings.

Have you checked if your "nearestObjects" actually returns something ?

Also:

1. don't run "nearestObjects" 4 times when you could just save it in a variable and run it once.

2. if you just need the closest object, use nearestObject instead of nearestObjects and remove the "select 0".

Oh and if you want, simply use my following function:

eed_lockDoors = {
private ["_building","_class","_num","_lockchance","_var","_anim"];
_building = [_this, 0, objNull, [ objNull ]] call BIS_fnc_param;
if ( isNull _building ) exitWith { false };


_class = configFile >> "CfgVehicles" >> typeOf _building;
_num = getNumber (_class >> "numberofdoors");

for "_i" from 1 to _num do {
	if (random 100 < _lockchance) then {
		_var = format ["bis_disabled_Door_%1", _i];
		_anim = format ["Door_%1_rot", _i];
		_building animate[_anim, 0];
		_building setVariable[_var,1,true];
	};
};

true
};

execute it like this:

[ somebuilding, "fnc_lockDoors", true, true] spawn BIS_fnc_MP;

or this, in your case:

[ ( (getPosATL crypticbase1) nearestObject "Land_Cargo_Tower_V3_F" ), "fnc_lockDoors", true, true] spawn BIS_fnc_MP;

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
Sign in to follow this  

×