Jump to content
Purzel

Open/Lock doors from container

Recommended Posts

Hi there,

I´ve seen a new (?) funktion in Arma3:

You can preset door states of some buildings by clicking on the door-symbol (open/closed/locked)
How can I change the door state by script?

Click here for picture!

I didnt found anything in wiki or config-viewer...
Greetings
Purzel

Share this post


Link to post
Share on other sites

@Purzel To lock door via scrip this line can be used:

 

yourbuilding setVariable ["bis_disabled_Door_1", true, true];

That will lock door number 1. just replace yourbuilding with your building

Share this post


Link to post
Share on other sites
briefingroom setVariable ["bis_disabled_Door_1",0,true];   // will just unlock the door.



But how do I open that door?
I´ve tried around with 0-2 and true/false... nothing...
And I´ve found no documentation about that command...
(and sorry - yesterday, when I was posting my question I did not found anything about this code, just the gamelogic-solution)
 

Share this post


Link to post
Share on other sites

Oh you want the door open...

 

try this:

 

yourbuilding animate ["Door_1_rot", 1, true];

 

or maybe:

 

yourbuilding animateDoor ["door_1_rot",1]

 

Share this post


Link to post
Share on other sites

The doors name is "door_1" acourding to this script (executed in the init of my unit)
 

["test", "onEachFrame", { 
 private "_intersectObjectName"; 
 _startPos = ASLToAGL eyePos player; 
 _endPos  = positionCameraToWorld [0, 0, 100]; 
  
 _intersectObjects = [cursorTarget, "VIEW"] intersect [_startPos, _endPos]; 
 _intersectObject = _intersectObjects select 0; 
 if (!isNil "_intersectObject") then { 
  _intersectObject = _intersectObject select 0; 
  titleText [_intersectObject, "PLAIN", 0.001]; 
 } 
}] call BIS_fnc_addStackedEventHandler;


It shows the name of the door as: "door_1", then I tried the following:

 

briefingroom setVariable["bis_disabled_Door_1",0,true];             // unlock door
briefingroom animateSource ["door_1", 1, false];                          //  open door with animateSource
briefingroom animate ["door_1", 1, false];                                      // open door with animate 


and I´ve tried all possibilities

buildingname animate ["Door_1_rot", 1, true];         >>>     ["NAME_OF_DOOR", 0/1, true/false];     >>>     0 = close/1=open,    true = immediatly/false = animated.

but none of that cases are working...

WTF?

Share this post


Link to post
Share on other sites

This worked for me on Tanoa inside a building:

 

b = cursortarget; // make sure b is building...

 

b animate ["Door_1_rot", 1, true]; // Open

b animate ["Door_1_rot", 0, true]; // close

Share this post


Link to post
Share on other sites

To be clear, what i want:

After task1 is completed, the locked briefingroom-door should open visible.
The problem is not the "unlocking" (players can open the door after briefingroom setVariable["bis_disabled_Door_1",0,true];  )
but the door should open itself, without any human interaction...

Share this post


Link to post
Share on other sites
1 minute ago, Purzel said:

but the door should open itself, without any human interaction...

 

That's what my code does, it opens the door instantly

Share this post


Link to post
Share on other sites
13 minutes ago, Purzel said:

The doors name is "door_1" acourding to this script (executed in the init of my unit

and I´ve tried all possibilities

buildingname animate ["Door_1_rot", 1, true];         >>>     ["NAME_OF_DOOR", 0/1, true/false];     >>>     0 = close/1=open,    true = immediatly/false = animated.

but none of that cases are working...

WTF?

 

Animations using animate command won't animate when called from init field, since the init field of objects is called before the mission begins.

Add a spawn and a sleep, should usually do the trick.

 

Cheers

Share this post


Link to post
Share on other sites

After completion of task1 theres a trigger which executes the "open sesame"-code.
The init of that briefingroom is empty!
It has just the doors locked from beginning as seen in this picture (of course its set to "locked", not open as seen in picture):
arma3x642018100100535wvdgt.jpg

Share this post


Link to post
Share on other sites

@ Harzach

Indeed it works with your Code:

briefingroom animate ["Door_1_rot", 1, true];


but my code snippet shows me another door-name... strange... very strange...

Share this post


Link to post
Share on other sites
4 hours ago, Harzach said:

"Door_1_rot" isn't the name of the door, it's the name of the animation class of the door. If you have a door named "Door_2", then you would use the animation class "Door_2_rot".

 

https://community.bistudio.com/wiki/animate

Not always true. It can be named door 1 and have several doors, take the barracks as example but yeah, I think you didn't mean that anyway.

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

×