Jump to content

Recommended Posts

I want to restrict a area for my player to play in on Altis i want to make a Infantry Game and i want to stop players to use the hole island to run around on.

 

does anyone know if it can be done.

i have tried with 4 triggers so if you walk/run inside them you die, but i want to make it so you get a warning and will be told to turn around or you die.

 

// Play3r

 

 

Share this post


Link to post
Share on other sites

You can limit the area by using marker size as the area, like this:

 

areaTimer = 0;

#define DTIME 5 // Time until death

while { true } do
{

 _pos = getMarkerPos "playarea";
 _size = getMarkerSize "playarea";
 _p = getpos player;
 
 _w = _size select 0;
 _h = _size select 1;
 
 if(((_p select 0) > ((_pos select 0) - _w)) && ((_p select 0) < ((_pos select 0) + _w))
&&  ((_p select 1) > ((_pos select 1) - _h)) && ((_p select 1) < ((_pos select 1) + _h))  ) then
{
 areaTimer = time;
 hintSilent "";
}
else
{
 _t = time - areaTimer;
 if(_t >= DTIME) then
 {
  player setDamage 1;
 }
 else
 {
  hintSilent format["Return to the play area or you will die in %1 seconds", DTIME - _t];
 };
};

 sleep 0.1;
};

 

"playarea" is the marker that defines the area.

 

That's just an example, it should be run on client.

 

  • Like 3

Share this post


Link to post
Share on other sites

sorry gc8

when you say client du then mean initserver.sqf, that is have to be in that file..

this is my first try in a MP game,   

Share this post


Link to post
Share on other sites

initPlayerLocal.sqf

 

initServer.sqf is, according to its name, for the server, not for the client.

  • Like 2

Share this post


Link to post
Share on other sites
8 minutes ago, Belbo said:

initPlayerLocal.sqf

 

initServer.sqf is, according to its name, for the server, not for the client.

THX for the answer 

Share this post


Link to post
Share on other sites

in the initPlayerLocal, define a variable called playableInZone and set it to false(this is only if you have it so the players are required to enter the playable area first and going in/out of it upon death, if not then just remove this variable and remove the first if statement in the outOfZone.sqf and remove playableInZone = true in the activation box of the trigger. make a trigger with the name playableArea), set for any player present with this in the condition and make it cover the area you want to be the playable area. make sure the trigger is repeatable

this && player in thisList

in the activation do

playableInZone = true;

in the deactivation do

null = [] execVm "zone\outOfZone.sqf";

inside outOfZone.sqf do

_timer = 10;//set for how long it takes that the unit can be outside of the zone before being killed

if (playableInZone) then
{
	while {_timer > 0} do
	{
		hint format ["You Have %1 Seconds To ReEnter The Playable Area", _timer];
		_timer = _timer - 1;
		_backInZone = [playableArea, player] call BIS_fnc_inTrigger;//checks if player re entered the zone
		if (_backInZone) exitWith {hint "Back In Zone"; _keepAlive = true;};//if the player did re enter the zone then exit the loop/script
		sleep 1;
	};
	player setDammage 1;//if the timer runs out/hits 0 then it will kill the player
};

 

Share this post


Link to post
Share on other sites

@gokitty1199 i wanted to try your code for a restrict gamearea but i keep dying everytime i go back inside the trigger.

I get the Hint 'Back in Zone' and then i die, it is like the script doesn't skip the last line :


 player setDammage 1;//if the timer runs out/hits 0 then it will kill the player

 

when i get inside again.

do you have any solutions for that problem.

Share this post


Link to post
Share on other sites

See this post, along with my previous post, in this thread

Share this post


Link to post
Share on other sites

Thanks larrow 

My problem is that I'm trying to make MP game this time where players respawn outside the zone and then get HALO in to the zone again. 

I will have look at your script when I get home later today (Sunday).

Share this post


Link to post
Share on other sites

Instead of simple kill on player, you can penalize him like this:

 

_infringement =   ppEffectCreate ["DynamicBlur",450];   _infringement ppEffectEnable true;  _infringement ppEffectAdjust [4]; _infringement ppEffectCommit 10;

_recovery =  ppEffectCreate ["DynamicBlur",450];   _recovery ppEffectEnable true;  _recovery ppEffectAdjust [0]; _recovery ppEffectCommit 10;

 

Note: It's just the idea. The completion is a little bit different. Using an optic can ruin the effect, GPS and map are not impacted.

 

 

 

  • 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

×