Jump to content
Sign in to follow this  
Stryker35

Bar gates on Sugar Lake

Recommended Posts

So I'm using Sugar Lake to create a training map, and the map has built in bar gates in certain areas of the base. I'm trying to figure out how I can get these to open/close with a trigger as they are built into the map and I can't name them to work with any of the scripts I have seen out there. 

I've also tried removing them to put down a gate that I can set a trigger on, but they won't remove from the map. Any suggestions?

Share this post


Link to post
Share on other sites

You can retrieve a pointer to the gates with https://community.bistudio.com/wiki/nearestObject or https://community.bistudio.com/wiki/nearestObjects. I think the latter command is the preferred way to do this. You know the class of the gates right? If not, you can point at them, then use https://community.bistudio.com/wiki/cursorTarget and print em with diag_log.

Share this post


Link to post
Share on other sites
26 minutes ago, J.Hill_3rdID said:

So I'm using Sugar Lake to create a training map, and the map has built in bar gates in certain areas of the base. I'm trying to figure out how I can get these to open/close with a trigger as they are built into the map and I can't name them to work with any of the scripts I have seen out there. 

I've also tried removing them to put down a gate that I can set a trigger on, but they won't remove from the map. Any suggestions?

 

This one's fun and will automate every bargate on the map for players/units of the specified sides.

Simply put this into initServer.sqf:

 

_sides = [west,civilian,independent];//gates will open only for units of those sides

_gates = [0,0,0] nearObjects ["Land_BarGate_F",worldsize * 3];

{
	_automate = [_x,_sides] spawn {
		params ["_gate","_sides"];
		while {alive _gate} do {
			waitUntil {sleep 0.25; count (getposatl _gate nearEntities 15 select {side _x in _sides}) > 0;};
			_gate animate ["Door_1_rot", 1];
			waitUntil {sleep 10; count (getposatl _gate nearEntities 15 select {side _x in _sides}) == 0;};
			_gate animate ["Door_1_rot", 0];
		}
	}
} forEach _gates;

Doors will open within a quarter second once an allowed unit is within 15m, it will stay open for at least 10 seconds and only close if there's no one nearby.

 

Cheers

  • Like 1

Share this post


Link to post
Share on other sites
19 minutes ago, Grumpy Old Man said:

 

This one's fun and will automate every bargate on the map for players/units of the specified sides.

Simply put this into initServer.sqf:

 


_sides = [west,civilian,independent];//gates will open only for units of those sides

_gates = [0,0,0] nearObjects ["Land_BarGate_F",worldsize * 3];

{
	_automate = [_x,_sides] spawn {
		params ["_gate","_sides"];
		while {alive _gate} do {
			waitUntil {sleep 0.25; count (getposatl _gate nearEntities 15 select {side _x in _sides}) > 0;};
			_gate animate ["Door_1_rot", 1];
			waitUntil {sleep 10; count (getposatl _gate nearEntities 15 select {side _x in _sides}) == 0;};
			_gate animate ["Door_1_rot", 0];
		}
	}
} forEach _gates;

Doors will open within a quarter second once an allowed unit is within 15m, it will stay open for at least 10 seconds and only close if there's no one nearby.

 

Cheers

 

Works like a charm! THANK YOU!

  • 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
Sign in to follow this  

×