Jump to content
Sign in to follow this  
bvrettski

Defining the playable area

Recommended Posts

I posted this in the Arma 2 section and got no response so I'm mirroring it here....

I am sure this has been covered somewhere but perhaps I'm searching for the right terms.

I'd like to know how to define a certain section of the map as playable area. Players leaving that area should get a message like " You are leaving the combat area. Please return the battlefield."

I remember playing a capture the flag multiplayer game that started visually distorting the players view by adding white noise or by blurring the view. Something like that would be ideal.

Thanks for your help and insights.

Share this post


Link to post
Share on other sites

I needed the same kind of thing and Mikie boy gave me one which works by giving them a message and reducing their health until they re-enter the area. I've already used it on a mission with other people on a dedicated server and it works perfectly too. Check it out - http://forums.bistudio.com/showthread.php?158668-Restricting-the-playable-area-for-one-team/page2

Share this post


Link to post
Share on other sites

you need to edit it a bit but here is a solution:

put a list of allowed areas in hg_allowedAreas and disallowed in hg_disallowedAreas (both need to be triggers)

private["_active","_isIn","_time","_marker", "_i"];
if (!isDedicated && (hg_bordersActive == 1)) then
{
sleep 10;//make sure markers are not deleted by deletemarkersscript
hg_disallowedAreasMarkers = [];
hg_allowedAreasMarkers = [];
_i = 0;
{
	_x setTriggerActivation["WEST", "PRESENT", true];
	_x setTriggerType "NONE";
	_marker = createMarkerLocal [format["hg_allowedAreas_%1", _i], getPos _x];
	_i = _i + 1;
	_marker setMarkerBrushLocal "DiagGrid";
	_marker setMarkerColorLocal hg_allowedAreasColor;
	if ((triggerArea _x) select 3) then
	{
		_marker setMarkerShapeLocal "RECTANGLE";
	}
	else
	{
		_marker setMarkerShapeLocal "ELLIPSE";
	};
	_marker setMarkerDirLocal ((triggerArea _x) select 2);
	_marker setMarkerSizeLocal[(triggerArea _x) select 0, (triggerArea _x) select 1];
	_marker setMarkerTypeLocal "Empty";
	_marker setMarkerTextLocal "";
	_marker setMarkerAlphaLocal 0.33;
	hg_allowedAreasMarkers = hg_allowedAreasMarkers + [_marker];
}
forEach hg_allowedAreas;
_i = 0;
{
	_x setTriggerActivation["WEST", "PRESENT", true];
	_x setTriggerType "NONE";
	_marker = createMarkerLocal [format["hg_disallowedAreas_%1", _i], getPos _x];
	_i = _i + 1;
	_marker setMarkerBrushLocal "DiagGrid";
	_marker setMarkerColorLocal hg_disallowedAreasColor;
	if ((triggerArea _x) select 3) then
	{
		_marker setMarkerShapeLocal "RECTANGLE";
	}
	else
	{
		_marker setMarkerShapeLocal "ELLIPSE";
	};
	_marker setMarkerDirLocal ((triggerArea _x) select 2);
	_marker setMarkerSizeLocal[(triggerArea _x) select 0, (triggerArea _x) select 1];
	_marker setMarkerTypeLocal "Empty";
	_marker setMarkerTextLocal "";
	_marker setMarkerAlphaLocal 1;
	hg_disallowedAreasMarkers = hg_disallowedAreasMarkers + [_marker];
}
forEach hg_disallowedAreas;
sleep 5;
_active = true;
if (count hg_allowedAreas == 0) then
{
	_active = false;
};
while {_active && (hg_bordersActive == 1)} do
{
	_isIn = false;
	{
		if (player in (list _x) || (vehicle player) in (list _x) || !alive player) then
		{
			_isIn = true;
		};
	}
	forEach hg_allowedAreas;
	{
		if (player in (list _x) || (vehicle player) in (list _x) || !alive player) then
		{
			_isIn = false;
		};
	}
	forEach hg_disallowedAreas;
	_time = 0;
	while {!_isIn} do
	{
		hint format[localize "STR_HINT_BORDER", (hg_bordersReturnTime - _time)];
		{
			if (player in (list _x) || (vehicle player) in (list _x) || !alive player) then
			{
				_isIn = true;
			};
		}
		forEach hg_allowedAreas;
		{
			if (player in (list _x) || (vehicle player) in (list _x) || !alive player) then
			{
				_isIn = false;
			};
		}
		forEach hg_disallowedAreas;
		_time = _time + 0.1;
		sleep 0.1;
		if (_time >= hg_bordersReturnTime) then
		{
			while {_active} do
			{
				player setDamage 1;
				sleep 1;
			};
		};
	};
	sleep 1;
};
{
	deleteMarkerLocal _x;
}
forEach hg_allowedAreasMarkers;
{
	deleteMarkerLocal _x;
}
forEach hg_disallowedAreasMarkers;
};

Edited by Coding

Share this post


Link to post
Share on other sites

"zone restriction" module, which allows for custom scripts for punishment and warnings, and also an 'air vehicle' exclusion.

i got it to work once, ill try again tonight. you need to synchronize a trigger area and unit or group if i recall

----

theres this:

http://forums.bistudio.com/showthread.php?148049-How-thris-Restriction-Zone-Module-works&highlight=zone+restriction+module

but couldn't get it to work....keep getting undefined and other errors from the module that seem to make it stop functioning.....sleeping on it...

Edited by dr_strangepete

Share this post


Link to post
Share on other sites

Place a trigger on the map.

Make it a very large size that covers your battlefield.

Place a colourful marker over the trigger, the same size as the trigger area, area so the player can see the battlefield area

If the player moves out of the trigger area (Not Present) then he gets a message Hint "You have left the playing area".

OR:

You could fill the non-playing area with mines. The game Iron Front 1944 is a mod of Arma2. It has mines with trip wires. You can make the ground impassable.

OR:

Surround the non playing area with 6 foot high barbed wire fence so the player cannot exit the playing area. The wire is not easy to see from a distance so it would not upset your decore.

.

.

Share this post


Link to post
Share on other sites

I'm really shocked no one has said anything about Norrin's Boundary Script. This is exactly what you are looking for. I use it in one of my missions as well.

Share this post


Link to post
Share on other sites

I'd like a really simple, elegant solution...

I saw what done for the agia marina deathmatch..he surrounded his playable area with red spheres. It looks similar to what is suggested in Norrin's script but requires placing a large number of objects to accurately define the area.

Isnt there some way to use an ellipse and if they leave that area then they are warned and killed after x number of seconds?

Rather than keeping them out of that area, like Norrins does, isnt there some way to keep them in an area? Much cleaner.

Share this post


Link to post
Share on other sites

Here's my border script.

cly_borders.sqf

/*
CLY Borders
Author: Mika Hannola AKA Celery

Description:
Border creation script for PVP missions.

How to use:
[
	[], //Universal borders
	[], //BLUFOR borders
	[], //OPFOR borders
	[], //Independent borders
	[], //Civilian borders
	false, //Inverse border: player has to stay inside the border
	0, //Border effect | 0: Heavy fog | 1: Death | 2: Custom
	"", //Custom effect
	0, //Warning time until the border effect is put into motion
	15, //Range at which the player receives a warning of a nearby border
	false //Flying units (at least 3 meters off the ground) are excluded
] execVM "cly_borders.sqf";

Place area markers in your mission and put their names in STRING format into the arrays. Execute the script multiple times with different parameters if you need borders with different effects or activation conditions. The border trigger will have the same name as the marker.
*/

//Get parameters
_borders_universal = _this select 0;
_borders_west = _this select 1;
_borders_east = _this select 2;
_borders_resistance = _this select 3;
_borders_civilian = _this select 4;
_inverse = _this select 5;
_effect = _this select 6;
_customEffect = _this select 7;
_warningTime = _this select 8;
_warningRange = if (_inverse) then {- (_this select 9);} else {_this select 9;};
_airExcluded = _this select 10;

//Make borders
{
_side = _x;
_borders = [_borders_universal, _borders_west, _borders_east, _borders_resistance, _borders_civilian] select _forEachIndex;
{
	_marker = _x;
	if ((markerSize _marker select 0) + (markerSize _marker select 1) > 0) then
	{
		_trigger = [objNull, _marker] call BIS_fnc_triggerToMarker;
		_trigger setTriggerActivation ["ANY", "PRESENT", true];
		_trigger setTriggerTimeout [_warningTime, _warningTime, _warningTime, true];
		missionNamespace setVariable [_marker, _trigger];
		//Condition
		_condition = "";
		if (_inverse) then
		{
			_condition = _condition + "!";
		};
		_condition = _condition + "(vehicle player in thisList)";
		if (_forEachIndex > 0) then
		{
			_condition = _condition + " && side player getFriend " + _side + " < 0.6";
		};
		if (_airExcluded) then
		{
			_condition = _condition + " && getPos vehicle player select 2 < 3";
		};
		_condition = _condition + " && alive player";
		//Activation
		_onact = "";
		_deact = "";
		if (_effect == 0) then
		{
			_onact = "if (fog != 1 || isNil 'CLY_borders_originalFog') then {CLY_borders_originalFog = fog;};1 setFog 1;[] spawn {sleep 0.5;20 cutText ['You have entered a restricted area!', 'PLAIN', 0.5];};";
			_deact = "1 setFog CLY_borders_originalFog;";
		};
		if (_effect == 1) then
		{
			_onact = "player setDamage 1;[] spawn {sleep 0.5;20 cutText ['You have died for entering a restricted area!', 'PLAIN', 0.5];};";
		};
		if (_effect == 2 || _customEffect != "") then
		{
			_onact = _onact + _customEffect;
		};
		//Trigger statements
		_trigger setTriggerStatements
		[
			_condition,
			_onact,
			_deact
		];
		//Warning trigger
		if (_warningRange != 0 || _warningTime > 0) then
		{
			_trigger = createTrigger ["EmptyDetector", markerPos _marker];
			_trigger setTriggerArea [(markerSize _marker select 0) + _warningRange, (markerSize _marker select 1) + _warningRange, markerDir _marker, markerShape _marker == "RECTANGLE"];
			_trigger setTriggerActivation ["ANY", "PRESENT", true];
			missionNamespace setVariable [_marker + "warning", _trigger];

			_trigger setTriggerStatements
			[
				_condition,
				"20 cutText ['You are entering a restricted area!', 'PLAIN', 0.5];",
				""
			];
		};
	};
} forEach _borders;
} forEach ["", "west", "east", "resistance", "civilian"];

Share this post


Link to post
Share on other sites

Thanks Celery but isnt your script similar to the others previously posted? Using a series of areas to surround your playable area rather than some sort area being defined by one trigger..if you leave then X happens?

Share this post


Link to post
Share on other sites

Use the zone restriction module, all it requires is the module and a synchronized trigger with blufor/opfor/independent present.

Share this post


Link to post
Share on other sites
Thanks Celery but isnt your script similar to the others previously posted? Using a series of areas to surround your playable area rather than some sort area being defined by one trigger..if you leave then X happens?

You have the option for an inverse border in the script's parameters.

Share this post


Link to post
Share on other sites

If I set a trigger with the following:

Activation :Anybody

Once

Present

Condition: call {if (count thislist > 0) then {{if (alive _x) then {_x setDamage 1}} forEach thislist};false}

It kills anyone that enters the area.

Why can't I flip it to

Not Present and kill anyone that leaves the area?

I can't seem to make that work though. What am I missing in the trigger logic?

Share this post


Link to post
Share on other sites

In my opinión, playable areas are commonly usless.

Ok, the fine solution is the ona you are saying, or other that are around the scene.

But being practical, players tend to play where the play exists. If the mission is "take that point" and the player decides to go to the opposite... is up to him to wander like an idiot around a digital island with no action at all. Nobody makes it.

I am not meaning nothing against inmersión.

But, anyway to make it the simplest way is:

- Place a game logic in the center of the scene, name it "mycenter"

- On player's init field Call a script with this:

waituntil {sleep 2; player distance mycenter > desired distance in meters};

hint "go back to action, you stupid scumbag!";

here put code for effects, whatever you like

Edited by barbolani

Share this post


Link to post
Share on other sites
In my opinión, playable areas are commonly usless.

Ok, the fine solution is the ona you are saying, or other that are around the scene.

But being practical, players tend to play where the play exists. If the mission is "take that point" and the player decides to go to the opposite... is up to him to wander like an idiot around a digital island with no action at all. Nobody makes it.

I am not meaning nothing against inmersión.

But, anyway to make it the simplest way is:

- Place a game logic in the center of the scene, name it "mycenter"

- On player's init field Call a script with this:

waituntil {sleep 2; player distance mycenter > desired distance in meters};

hint "go back to action, you stupid scumbag!";

here put code for effects, whatever you like

Thanks for the suggestion but this did not have the desired effect.

At mission preview I immediately get the message "Your leaving the combat area!"

After a period of time (10-15) seconds it went away and then never appeared again even if a player was outside the defined radius.

Normally I would agree with you about the playable area being useless but we always seem to get one random player that gets in a vehicle and goes joy riding around the map for no reason. it only takes one asshat to mess up a team effort.

Share this post


Link to post
Share on other sites

Dont know why, lets do it much simpler.

Game logic : name mydistance

One trigger: Repeatedly. Condition: player distance mydistance > 500. On Act: hint "You are trying to troll the game?"

Other trigger: Once. Condition: player distance mydistance > 510. On Act: hint "Die then"; player setdamage 1;

This Works. Of course you may change the on act to whatever you want, script, player setpos etc...

Share this post


Link to post
Share on other sites
Dont know why, lets do it much simpler.

Game logic : name mydistance

One trigger: Repeatedly. Condition: player distance mydistance > 500. On Act: hint "You are trying to troll the game?"

Other trigger: Once. Condition: player distance mydistance > 510. On Act: hint "Die then"; player setdamage 1;

This Works. Of course you may change the on act to whatever you want, script, player setpos etc...

That works nicely. The only other thing I could ask for would be the ability to define the are as an oval or rectangle with adjustable dimensions rather than just a circle. This will do nicely for now.

Thanks again

{
	items=1;
	class Item0
	{
		position[]={11511.308,23.003922,11682.059};
		name="playable";
		markerType="ELLIPSE";
		type="Empty";
		colorName="ColorRed";
		fillName="SolidBorder";
		a=170;
		b=170;
		drawBorder=1;
	};
};
class Sensors
{
	items=2;
	class Item0
	{
		position[]={11524.736,22.970644,11687.279};
		a=175;
		b=175;
		activationBy="ANY";
		repeating=1;
		interruptable=1;
		age="UNKNOWN";
		expCond="player distance mydistance > 175";
		expActiv="hint ""Your leaving the battlefield soldier. Return now or die a cowards death!""";
		class Effects
		{
		};
	};
	class Item1
	{
		position[]={11525.016,22.970526,11687.088};
		a=200;
		b=200;
		activationBy="ANY";
		repeating=1;
		interruptable=1;
		age="UNKNOWN";
		expCond="player distance mydistance > 200";
		expActiv="hint ""Game over man....""; player setdamage 1;";
		class Effects
		{
			sound="Alarm";
			titleEffect="BLACK OUT";
		};
	};
};

Share this post


Link to post
Share on other sites

If anyone has a method that works with the rectangle or ellipse triggers that would be nice to have also.

Share this post


Link to post
Share on other sites

This looks promising but how is it implimented?

Insert sensor(s) named BIS_Zora_x - x as a number, starting from 0, numbers must follow, e.g BIS_Zora_0, BIS_Zora_1, etc.

Are the sensors triggers or any other object?

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  

×