Jump to content
Sign in to follow this  
mugaben

Lock hangar doors until..

Recommended Posts

Hi guys..

I want to lock this hangars doors. I know it isnt possible to "lock", but what if the doors was given a loop of 0.1 (sleep), and telling it over and over again to close the doors.

Wouldnt this in fact make them "locked"? :)

Scripting is pretty much alien to me, but so far with a little searching i've come up with this:

"getpos doortrigger nearestObject 867 animate ["vrata1",1];getpos doortrigger nearestObject 867 animate ["vrata2",1];"

This causes the doors in hangar ID 867, at gamelogic "doortrigger" to close. ...Once.

How can i convert this to a sqf, or something like it that tells the doors to close with ie. "sleep 0.1"? And I need it to be able to open again with a trigger. (something that stops the script again)

Hope someone out there can help me.. :o

Share this post


Link to post
Share on other sites

while {true} do
{
     sleep 0.1;
     getpos doortrigger nearestObject 867 animate ["vrata1",1];
     getpos doortrigger nearestObject 867 animate ["vrata2",1];
};

Untested - I'm at work

EDIT: Not sure about the trigger part, I'll have to have a look in the editor later

Edited by Das Attorney

Share this post


Link to post
Share on other sites
What kind of hangar is that? Is it Land_Hangar_2 by any chance?

Cant remember the name. It's on my own map im making. It's the hangar with two blue giant doors, where in one of them there is two normal doors.

Attorney; Thanks, ill give it a try and wait for the stop part. ;)

---------- Post added at 05:08 PM ---------- Previous post was at 04:22 PM ----------

Okay.. So far this works:

Create lock.sqf.

while {isNil "OpenDoors"} do
{
       sleep 0.1;
       getpos doortrigger nearestObject 867 animate ["vrata1",0];
       getpos doortrigger nearestObject 867 animate ["vrata2",0];
};

Create a trigger with these params that locks the doors:

Cond: true

On act: lock=execVM "lock.sqf";

Now create another trigger with any params of your choosing to unlock them.

Cond: Your choice. Radio alpha, as an eksample.

On act: OpenDoors = true; publicVariable "OpenDoors";

You can even see the door open 2 cm and then shutting itself again. Looks like youre twirking the door to get it open. Thanks to my teammate Muzzleflash for this solution :yay:

Now I just need to find the door names for the two little doors and do the same thing with them. :)

Share this post


Link to post
Share on other sites

If it's the same hangar then you can use what BIS implemented because of the campaign.

To lock:

((getPos doortrigger) nearestObject 867) setVariable ["BIS_Lock_Hangar", true];

To unlock:

((getPos doortrigger) nearestObject 867) setVariable ["BIS_Lock_Hangar", nil];

This will make the option to open the door completely inaccessible.

Share this post


Link to post
Share on other sites

i'm trying to lock one of those hangars using what you posted but i just can't get it to work. shouldn't it work if i place one of those hangars ( Land_Hangar_2 ) in the editor and put this in its init: this setvariable ["BIS_Lock_Hangar", true]? because it doesn't and i can't figure out why.

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  

×