Jump to content
piedebeouf

Lock/unlock doors on a builing

Recommended Posts

Hello ,

I would like to know how to lock/unlock buiding , military building in the base of stratis ( only one building) ?

how could I do this?

Thanks for your answer ...

Share this post


Link to post
Share on other sites

building1 setVariable["bis_disabled_Door_1",1,true];
building1 setVariable["bis_disabled_Door_2",1,true];
building1 setVariable["bis_disabled_Door_3",1,true];
building1 setVariable["bis_disabled_Door_4",1,true];

That should give you the idea, with military 'offices' you would probably be going through the numbers alot (Door_x) but it gives you the idea on how to do it. How to get the specific building well that I won't answer because it's posted everywhere :P Also to unlock it just change 1 to 0 and it's unlocked.

*Edit*

It might be 0 to lock and 1 to unlock, I forget.

  • Like 1

Share this post


Link to post
Share on other sites

Awesome! I just started working on this yesterday. hehe I'm trying to setup a system

where we can lock certain doors, but you need a keycard or code to unlock. Ideas?

Can you do this with Trigger conditions or would I have to setup some detailed .sqf file?

Share this post


Link to post
Share on other sites

I manged to lock a specific door I want using a Gamelogic, but then how would I setup

something to unlock with a Trigger? I tried to deleteVehicle but this doesn't seem to

work. Plus IF we could get this to work, it would disable the lock permanently. hmm :confused:

For now I would settle to just delete the Gamelogic so we can get into the Room...

Share this post


Link to post
Share on other sites

i hope i understand it right you createt your own game logic for this?

then in the sqf:

_activated = [_this,2,true,[true]] call bis_fnc_param;
//...
if (_activated) then {
// your code
};

maybe you have to add it to the discription but its not rly needed

Share this post


Link to post
Share on other sites

hello,

in normal version it's working .

but in dev version , this command :

building1 setVariable["bis_disabled_Door_1",1,true];

building1 setVariable["bis_disabled_Door_2",1,true];

building1 setVariable["bis_disabled_Door_3",1,true];

building1 setVariable["bis_disabled_Door_4",1,true];

are not working ? seem they have change the command ligne?

Someone could find it ? thanks a lot ...

Share this post


Link to post
Share on other sites

WIP Lock & Unlock Security Systems Setup: -- by Von Quest Industries

I was working on setting up a Security System for some Maps/Missions.

You can customize how you wish. This is one way that works. If anyone

has a better way (maybe publicVariable instead of the unlock.sqf file?)

please chime in. To work, you MUST find the Building Classname and how

many Doors it has that may apply. Name lockSC = Security Center.

For this Example I'm using the Military Offices, and they have 8 Doors.

0. Place a Gamelogic on the Building. Name it lockSC:

(Optional) - To lock door #2 permanently, use in Gamelogic code box:

((nearestobjects [this, ["Land_MilOffices_V1_F"], 8]) select 0) setVariable ['bis_disabled_Door_2',1,true]

1. Place your LOCK Trigger around the Door you want to Lock.

BLUFOR, REPEATEDLY, Present, Timeout 0,0,0,

CONDITION: this

ON ACT: nul=[]execVM "lock.sqf"; hint "Enter Passcode or Keycard";

2. Place your KEYCARD Trigger around the same Door to Unlock.

BLUFOR, REPEATEDLY, Present, Timeout 2,2,2

CONDITION: player in thisList && ("sc_keycard" in items player);

ON ACT: nul=[] execVM "unlock.sqf"; hint "UNLOCKED";

3. Create your SQF file in your Mission Folder. Name it lock.sqf

while {isNil "OpenDoors"} do
{
       sleep 0.1;
((nearestobjects [lockSC, ["Land_MilOffices_V1_F"], 8]) select 0) setVariable ['bis_disabled_Door_1',1,true] 
};

4. Since I could not figure out the publicVariable thingy, create another file named unlock.sqf

while {isNil "OpenDoors"} do
{
((nearestobjects [lockSC, ["Land_MilOffices_V1_F"], 8]) select 0) setVariable ['bis_disabled_Door_1',0,true] 
};

In my prototype design, this would lock ANY door you need. I'm testing the single Front Door on the Military

Offices (door #1). This door is LOCKED if ANY Blufor is near. I gave an Officer nearby a Keycard. If you

can takeout the slimy bloke, you can loot his pockets and grab the Keycard which will UNLOCK that door

in about 2 seconds IF it detects you have it on you and standing at that door. Freaking Awesome!

This was my weekend project. Works in SP. Not tested in MP as of yet. GF just walked in, gotta run! :p

Edited by Goblin
its complicated

Share this post


Link to post
Share on other sites

hello could you help me to this script ? :

private ["_code", "_inputcode", "_DEFUSED"];

_DEFUSED=false;

_code = _this select 0;

_inputcode = _this select 1;

// compare arrays to see if code matches

_DEFUSED = [_code, _inputcode] call BIS_fnc_areEqual;

if (!DEFUSED) then { nul= [] execVM "unlock.sqf"; hint "ouvert";

titletext ["Password Successful. Area Open", "PLAIN DOWN"];

};

if (!_DEFUSED) then { nul = []execVM "lock.sqf"; hint "fermé";

titletext ["PASSWORD FAILED. ALARM TRIGGERED.", "PLAIN DOWN"];

sleep 5;

Playsound3d ["\A3\sounds_f\sfx\alarm.wss"] ;

};

sleep 5;

_inputcode = [0];

nul=[] execVM "lock.sqf"; hint "fermé";

The problem is on first the door is lock , and when I input a bad numer the door unlock ....

what I want to have :

1. doors lock in the beginning

2. input a code : if good unlock door for a time about 35 sec then close door automatically and lock again

3. if input the wrong code still lock until the good code come .

now I use the script lock and unlock given in the up thread thanks to Goblin

Share this post


Link to post
Share on other sites

I made a different topic for the same question, but it's about the same topic really:

http://forums.bistudio.com/showthread.php?162552-Locking-all-doors-of-building-adding-object-next-to-every-door&p=2482112#post2482112

I just much rather want something dynamic and universal then having to create a new script for every single building / door.

Share this post


Link to post
Share on other sites

Hey Goblin, I tested this in the editor and got as far as the message popping up to "Enter passcode or keycard". I don't see an option to enter a passcode, and I did verify that if I try to open the door without this passcode or keycard it just jiggles like it's locked. How would I create a keycard for my player to use to open this door?

Share this post


Link to post
Share on other sites

can you lock a vehicle when it is spawned with a shop script then add like a key sort to a player so he/she can unlock and also share the key, please help

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

×