Jump to content
Sign in to follow this  
melbo

No shooting zone

Recommended Posts

I'm trying to make a no shooting zone over some shops that I have set up in a mission. They tend to draw in a lot of idiots that will camp them to get free kills.

I'm wanting something that will provide 200m circle that no bullets or projectiles can enter. I have found a few scripts but have not been able to set them up correctly. Any help on this would be awesome, thanks.

Share this post


Link to post
Share on other sites

something like this might work for you. There's probably a better way to do it, but this is pretty easy to setup.

you will need 2 markers on the map for this to work "zone1" and "zone2"

executed from unit init

nul = [this] execVM "no_shooting.sqf";

no_shooting.sqf

private ["_eh1","_inArea","_pos","_unit","_zone1","_zone2","_dis"];

_unit = _this select 0;

_zone1 = getMarkerPos "zone1"; // marker name for the areas you want to protect
_zone2 = getMarkerPos "zone2";
_dis = 200;                             // distance from area safe zone starts



if ((_zone1 distance _unit > _dis) or (_zone2 distance _unit > _dis)) then {        //check if unit is in zone when script starts
  _inArea = false;
}else{
  _inArea = true;
  _eh1 = _unit addEventHandler ["fired", {deleteVehicle (_this select 6);}];
};



while {true} do {


  if (((_zone1 distance _unit < _dis) or (_zone2 distance _unit < _dis)) && (!_inArea)) then {      // check if unit enters

     _eh1 = _unit addEventHandler ["fired", {deleteVehicle (_this select 6);}];
     _inArea = true;
     hint "safe zone";
  };


  if (((_zone1 distance _unit > _dis) or (_zone2 distance _unit > _dis)) && (_inArea)) then {       // check if unit exits

     _unit removeEventHandler ["fired", _eh1];
     _inArea = false;
     hint "You just left the safe zone";
  };

sleep 5;

};

Share this post


Link to post
Share on other sites

the problem with this method is that snipers can still attack the shop and in addition the attacked person can't shoot back now:eek:

making the zone bigger is out of the question since that would interfere with nearby combat too much.

so i think the best solution would be Lifted86's script with the addition of

_unit allowdamage false;

this way people inside the zone are restricted but also protected from projectiles coming from outside the zone.

Share this post


Link to post
Share on other sites

You could also create objects named "ProtectionZone_Ep1" and give them an invisible texture by executing

objectname setObjectTexture [0,""];

I think, they have to be created on every computer, even with createvehicle (not createvehiclelocal) they are local to the server only. These objects can also be found in the editor (forgot where, maybe warfare stuff).

Within this zone nobody can be killed (by weapons and vehicles) and nobody inside can kill anybody inside and outside. Since it has a radius of 25m you might want to create more than one.

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  

×