Jump to content
pokertour

Open/Close Bargate solution !

Recommended Posts

Hi everyone !

this is the solution to open and close your bargate !

yourbargatename animate ["Door_1_rot", 1] //this open the bargate

yourbargatename animate ["Door_1_rot", 0] //this close the bargate

  • Thanks 1

Share this post


Link to post
Share on other sites

Good stuff, looks like they might have changed the animation name for A3...

Share this post


Link to post
Share on other sites

Thanks

yes! this animated name has no relation with the object.

Share this post


Link to post
Share on other sites

Thanks, :) tested it and made a simple loop - to make the gate automatically open for nearby cars, I have this code in the bargate's initbox:

_nul = [this] SPAWN {while {true} do {
waitUntil {sleep 1; count ((getposATL (_this select 0)) nearEntities [["Car"],30]) > 0};
(_this select 0) animate ["Door_1_rot", 1];
waitUntil {sleep 1; count ((getposATL (_this select 0)) nearEntities [["Car"],30]) == 0};
(_this select 0) animate ["Door_1_rot", 0];
};
};

Civilian pickups drive nicely through it if not alarmed and speedmode set to limited.

Share this post


Link to post
Share on other sites

Yes you can also place trigger on bargate with "Axis A 5" and "Axis B 20"

conf :

Type : None

Activation : Anybody (or what you want)

Repeatedly

Present

Condition :

this

On act :

yournamebargate animate ["Door_1_rot", 1]

On desac :

yournamebargate animate ["Door_1_rot", 0]

Share this post


Link to post
Share on other sites

Does anyone know if the commands above have changed? It's been working for me and now it doesn't!

Share this post


Link to post
Share on other sites

it's fully work for me on last DEV version.

Do you name your bargate ?

example :

Bargate :

name

gate

trigger :

Activation

Blufor
repeatedly
present

condition

this

On Act

gate animate ["Door_1_rot", 1]

On Dea

gate animate ["Door_1_rot", 0]

Share this post


Link to post
Share on other sites

Yeah, named the gate and everything. Super strange. I'll check it out tomorrow. Maybe it was just bugging out or something,

Share this post


Link to post
Share on other sites

I have found that this is not working for me either.  Has anyone come up with a work around or a fix to get the gates closing and opening using these commands?

Share this post


Link to post
Share on other sites

I have found that this is not working for me either.  Has anyone come up with a work around or a fix to get the gates closing and opening using these commands?

 

Works fine for me.

 

1. place a trigger

2. set activation to anybody

3. set it to activate repeatedly

4. on activation: bargate animate ["Door_1_rot", 1];

5. on deactivation: bargate animate ["Door_1_rot", 0];

6. place a bargate and name it bargate

Share this post


Link to post
Share on other sites
On 26.6.2013 at 11:38 PM, SaOk said:

Thanks, :) tested it and made a simple loop - to make the gate automatically open for nearby cars, I have this code in the bargate's initbox:

 


_nul = [this] SPAWN {while {true} do {
waitUntil {sleep 1; count ((getposATL (_this select 0)) nearEntities [["Car"],30]) > 0};
(_this select 0) animate ["Door_1_rot", 1];
waitUntil {sleep 1; count ((getposATL (_this select 0)) nearEntities [["Car"],30]) == 0};
(_this select 0) animate ["Door_1_rot", 0];
};
};
 

 

Civilian pickups drive nicely through it if not alarmed and speedmode set to limited.

 

how do i get multiple classes in it. like having the gate to open for cars, just as well, as to open for trucks and tanks?

Share this post


Link to post
Share on other sites
On 20/03/2017 at 2:15 PM, madpat3 said:

 

how do i get multiple classes in it. like having the gate to open for cars, just as well, as to open for trucks and tanks?

To check tanks, men,trucks and cars, I usually disable the damage to the object and disable the summation, prevent it from falling if you hit it with a vehicle:

_nul = [this] SPAWN {while {true} do {
waitUntil {sleep 1; count ((getposATL (_this select 0)) nearEntities [["Man","Car","Motorcycle","Tank"],30]) > 0};
(_this select 0) animate ["Door_1_rot", 1];
waitUntil {sleep 1; count ((getposATL (_this select 0)) nearEntities [["Man","Car","Motorcycle","Tank"],30]) == 0};
(_this select 0) animate ["Door_1_rot", 0];
};
};

This also works:

_Object animateSource ['Door_1_sound_source',0];

 

Share this post


Link to post
Share on other sites

Hi guys I placed the bar on altis life server and the police can open the bar both in the car and on foot only even applying the control to the west faction the civilians can open the bar while it should open only in the presence of a west (policeman)

 

This is a code:

his allowDamage false;_nul = [this] SPAWN {while {true} do {   
waitUntil {sleep 1; count ((getposATL (_this select 0)) nearEntities [["Car","Man"],9]) > 0 && (playerSide == west)};   
(_this select 0) animate ["door_1_rot", 1];   
waitUntil {sleep 1; count ((getposATL (_this select 0)) nearEntities [["Car","Man"],9]) == 0 && (playerSide == west)};   
(_this select 0) animate ["door_1_rot", 0];   
};   
};

Share this post


Link to post
Share on other sites
1 hour ago, Federick90 said:

Hi guys I placed the bar on altis life server and the police can open the bar both in the car and on foot only even applying the control to the west faction the civilians can open the bar while it should open only in the presence of a west (policeman)

 

This is a code:

his allowDamage false;_nul = [this] SPAWN {while {true} do {   
waitUntil {sleep 1; count ((getposATL (_this select 0)) nearEntities [["Car","Man"],9]) > 0 && (playerSide == west)};   
(_this select 0) animate ["door_1_rot", 1];   
waitUntil {sleep 1; count ((getposATL (_this select 0)) nearEntities [["Car","Man"],9]) == 0 && (playerSide == west)};   
(_this select 0) animate ["door_1_rot", 0];   
};   
};

 

playerSide will be different on every client, just use nearEntities to filter for west units:

 

_gateStuff = [gate] SPAWN {
	params ["_gate"];
	while {alive _gate} do {
		waitUntil {sleep 1; count (_gate nearEntities 8 select {side _x isEqualTo west}) > 0};
		_gate animate ["Door_1_rot", 1];
		waitUntil {sleep 1; count (_gate nearEntities 8 select {side _x isEqualTo west}) == 0};
		_gate animate ["Door_1_rot", 0];
	};
};

Cheers

Share this post


Link to post
Share on other sites
On 23/9/2018 at 4:20 PM, Grumpy Old Man said:

 

 

The script you suggested works perfectly on a gate, but how can I put the gate locked and open only in the presence of a west? I tried to set from the closed editor, but it opens anyway.

 

This is the modified script applied to my private server:

 

 

this allowDamage false;_nul = [this] SPAWN {while {true} do {   
waitUntil {sleep 1; count ((getposATL (_this select 0)) nearEntities 8 select {side _x isEqualTo west}) > 0}; 
(_this select 0) animate ["Door_1_rot", 1];   
waitUntil {sleep 1; count ((getposATL (_this select 0)) nearEntities 8 select {side _x isEqualTo west}) == 0}; 
(_this select 0) animate ["Door_1_rot", 0];   
};   
}; 
 

 

 

 

 

On 23/9/2018 at 4:20 PM, Grumpy Old Man said:

playerSide will be different on every client, just use nearEntities to filter for west units:

 


_gateStuff = [gate] SPAWN {
	params ["_gate"];
	while {alive _gate} do {
		waitUntil {sleep 1; count (_gate nearEntities 8 select {side _x isEqualTo west}) > 0};
		_gate animate ["Door_1_rot", 1];
		waitUntil {sleep 1; count (_gate nearEntities 8 select {side _x isEqualTo west}) == 0};
		_gate animate ["Door_1_rot", 0];
	};
};

Cheers

 

Share this post


Link to post
Share on other sites
1 hour ago, Federick90 said:

but how can I put the gate locked and open only in the presence of a west?

 

That's what the code does. Works fine for me, anyway.

Share this post


Link to post
Share on other sites
14 minutes ago, Harzach said:

 

That's what the code does. Works fine for me, anyway.

 

 

I do not deny that it works but on altis life if they are in the west faction with police role and the gate is closed by a key key editor and at play the civilians still open the door as if it were not locked with key.

Share this post


Link to post
Share on other sites

Then there is something going on in the Arma Life code that determines bargate behavior. You can't override it by pasting some more code in the object's init.

Share this post


Link to post
Share on other sites
14 minutes ago, Harzach said:

 

That's what the code does. Works fine for me, anyway.

 

how can I integrate this variable in the script I used?

 

setVariable ['bis_disabled_Door_1',1,true];

  • Confused 1

Share this post


Link to post
Share on other sites
On 6/26/2013 at 9:56 PM, pokertour said:

Hi everyone !

this is the solution to open and close your bargate !

 


yourbargatename animate ["Door_1_rot", 1] //this open the bargate
 

 

 


yourbargatename animate ["Door_1_rot", 0] //this close the bargate
 

 

When is a door not a door? When it's ajar!

When it's a A3 bar gate :happy:

9 hours ago, Federick90 said:

 

how can I integrate this variable in the script I used?

 

setVariable ['bis_disabled_Door_1',1,true];

What? Read up. Solution is right there! Why are you trying to use setVariable? Makes no sense.

Share this post


Link to post
Share on other sites
12 hours ago, HazJ said:

When is a door not a door? When it's ajar!

When it's a A3 bar gate :happy:

What? Read up. Solution is right there! Why are you trying to use setVariable? Makes no sense.

 

Because the script works to open and close the door automatically when there is a police club near the west faction, but I want that if for example you are a civilian and do not belong to the west faction (coop) the door is closed with a key. Because if you use the mouse wheel control as a civilian, the door opens even if from the door sept

Share this post


Link to post
Share on other sites
25 minutes ago, Federick90 said:

 

Because the script works to open and close the door automatically when there is a police club near the west faction, but I want that if for example you are a civilian and do not belong to the west faction (coop) the door is closed with a key. Because if you use the mouse wheel control as a civilian, the door opens even if from the door sept

Again. The code upthread does exactly that. If it isn't working in A3L then there is something in the A3L code that is conflicting with it.

Are you sure the civilians are actually side CIV?

Share this post


Link to post
Share on other sites
On 9/24/2018 at 8:15 PM, Federick90 said:

 

 

I do not deny that it works but on altis life if they are in the west faction with police role and the gate is closed by a key key editor and at play the civilians still open the door as if it were not locked with key.

Not sure what you want, you can't lock the bargate with a key, the setVariable option you mentioned only works on building doors from what I know.

Your only way would be to bruteforce the bargate closed if no blufor is nearby, if that's what you want:

_gateStuff = [gate] SPAWN {
	params ["_gate"];
	while {alive _gate} do {
		//small delay before closing the gate again
		sleep 5;
		waitUntil {
			_gate animate ["Door_1_rot", 0];
			count (_gate nearEntities 8 select {side _x isEqualTo west}) > 0
		};
		_gate animate ["Door_1_rot", 1];
		waitUntil {sleep 1; count (_gate nearEntities 8 select {side _x isEqualTo west}) == 0};
		_gate animate ["Door_1_rot", 0];
	};
};

 

 

Cheers

  • Thanks 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

×