Jump to content
ricoarma

[SCRIPT HELP] OPEN AND CLOSE

Recommended Posts

Hello everyone.

I've got a problem with a script
That's my problem:  I created a door with a digital board that must open with a code. Once the code entered on the digital board, the door can open.

But if it closes, you can not open it again!! (That's the problem).

my script is:

class CfgVehicles
{
	class Static;
	class Wall_F;


	class Rico_my_gate_digitale_01: Static
	{
		editorPreview="\mydoc\data\ui\Land_ConcreteWall_01_l_gate_F.jpg";
		scope=2;
		scopeCurator=2;
		icon="iconObject_10x1";
		model="\A3\Structures_F_Exp\Walls\Concrete\ConcreteWall_01_l_gate_F.p3d";
		displayName="MyGateDigitalNamed";
		vehicleClass="Structures_Walls";
		cost=0;
		armor=200;
		mass=200;
		class EventHandlers
		{
			init=" Code_a_inserer =floor random [11451,50000,99999]; publicVariable ""Code_a_inserer""; Rico_code_gate_01=false; publicvariable ""Rico_code_gate_01""; [_this select 0] execVM ""mydoc\scripts\myOtherScript.sqf"";";
          /*myOtherScript.sqf is the script I use to put de code on a keypad to open the door*/
		};
		class AnimationSources
		{
			class Door_1_sound_source
			{
				source="user";
				initPhase=0;
				animPeriod=5;
				sound="RoadGateDoors";
				soundPosition="Door_1_trigger";
			};
			class Door_1_noSound_source
			{
				source="user";
				initPhase=0;
				animPeriod=5;
			};
			class Door_1_locked_source
			{
				source="user";
				initPhase=0;
				animPeriod=0.80000001;
			};
		};
		class UserActions
		{
			class OpenDoor_1
			{
				displayNameDefault="<img image='\A3\Ui_f\data\IGUI\Cfg\Actions\open_door_ca.paa' size='2.5' />";
				displayName="$STR_DN_OUT_O_DOOR";
				position="Door_1_trigger";
				priority=11;
				actionNamedSel="Door_1_action";
				radius=3;
				aiMaxRange=9;
				onlyForPlayer=0;
				condition="((this animationSourcePhase 'Door_1_sound_source') < 0.5) && (cameraOn isKindOf 'CAManBase') && (Rico_code_gate_01)";
				statement="([this, 1, 1] call BIS_fnc_Door)";
			};
			class CloseDoor_1: OpenDoor_1
			{
				displayNameDefault="<img image='\A3\Ui_f\data\IGUI\Cfg\Actions\open_door_ca.paa' size='2.5' />";
				displayName="$STR_DN_OUT_C_DOOR";
				priority=11;
				condition="((this animationSourcePhase 'Door_1_sound_source') >= 0.5) && ((this getVariable ['bis_disabled_Door_1', 0]) != 1) && (cameraOn isKindOf 'CAManBase') && (Rico_code_gate_01)";
				statement="([this, 1, 0] call BIS_fnc_Door); this animate [""OpenDoor_1"", 0]; Rico_code_gate_01=false; publicvariable ""Rico_code_gate_01"";";
			};
		};
		actionBegin1="OpenDoor_1";
		actionEnd1="OpenDoor_1";
	};
};

So how to add a command that will verify that the unlocking script has been executed, and especially where?
Thank you very much

Share this post


Link to post
Share on other sites

 "Rico_code_gate_01" is set to false in both the door init and in the door close action, so if its being set to true in the unlock script (and is required to be true in condition of door opening) won't it be reset to false when the door is closed again... ?

 

its hard to tell exactly without seeing "myOtherScript.sqf"

  • Like 1

Share this post


Link to post
Share on other sites

Hi Bro! Tanks bro!

It's true.It's been two weeks since I pull my hair.

Actually by removing my true in the close_door, it works well. Thanks again.
I had tried everything like crazy.

the myOtherScript;sqf, is just the addAction command to open the door to a Digital pad with a KeyPad.sqf

  • Like 1

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

×