[Release] Safezones

kikyou2

Valued Member!
Help and Discussion for Creating Safe-Zones begins here...
Thanks for this, my issue is my mission.sqm doesn't have a sensor class in it. Do I have to go into the 2d editor to get it?
You're welcome.

You can just paste it in.

Maybe you can use this thread to locate where the sensors thing should be ;).

Here is my complete Sensors part that you have a complete example (item 0-6 are not releated to safezones)

Code:
class Sensors
{
items=10;
class Item0
{
position[]={4053.8501,364.76645,11668.645};
activationBy="WEST";
repeating=1;
interruptable=1;
age="UNKNOWN";
name="zonebash";
expCond="(player distance zonebash) < 50;";
expActiv="TitleText[""Now entering trader city Bash"",""PLAIN DOWN""]; placevault = false;";
expDesactiv="TitleText[""Now leaving trader city Bash"",""PLAIN DOWN""]; placevault = true;";
class Effects
{
soundDet="arabian_market_1";
};
};
class Item1
{
position[]={11463.747,317.3078,11349.89};
activationBy="WEST";
repeating=1;
interruptable=1;
age="UNKNOWN";
name="zoneklen";
expCond="(player distance zoneklen) < 50;";
expActiv="TitleText[""Now entering trader city Klen"",""PLAIN DOWN""]; placevault = false;";
expDesactiv="TitleText[""Now leaving trader city Klen"",""PLAIN DOWN""]; placevault = true;";
class Effects
{
soundDet="arabian_market_1";
};
};
class Item2
{
position[]={6344.8081,304.99023,7806.7598};
activationBy="WEST";
repeating=1;
interruptable=1;
age="UNKNOWN";
name="zonestary";
expCond="(player distance zonestary) < 50;";
expActiv="TitleText[""Now entering trader city Stary"",""PLAIN DOWN""]; placevault = false;";
expDesactiv="TitleText[""Now leaving trader city Stary"",""PLAIN DOWN""]; placevault = true;";
class Effects
{
soundDet="arabian_market_1";
};
};
  class Item3
        {
            position[]={6679.2104,29.542515,2302.5156};
            a=10;
            b=16;
            angle=72.795197;
            rectangular=1;
            activationBy="WEST";
            repeating=1;
            interruptable=1;
            age="UNKNOWN";
            expActiv="thisTrigger = [player,75,true,(getPosATL player)] spawn player_alertZombies;";
            class Effects
            {
                soundDet="Sirene_EP1";
            };
        };
        class Item4
        {
            position[]={10456.856,18.796356,2255.2844};
            a=10;
            b=16;
            angle=-34.950001;
            rectangular=1;
            activationBy="WEST";
            repeating=1;
            interruptable=1;
            age="UNKNOWN";
            expActiv="thisTrigger = [player,75,true,(getPosATL player)] spawn player_alertZombies;";
            class Effects
            {
                soundDet="Sirene_EP1";
            };
        };
        class Item5
        {
            position[]={7068.6538,317.43521,7727.1855};
            a=10;
            b=15;
            angle=-18.1738;
            rectangular=1;
            activationBy="WEST";
            repeating=1;
            interruptable=1;
            age="UNKNOWN";
            expActiv="thisTrigger = [player,75,true,(getPosATL player)] spawn player_alertZombies;";
            class Effects
            {
                soundDet="Sirene_EP1";
            };
        };
        class Item6
        {
            position[]={3055.3408,320.88217,7854.6934};
            a=10;
            b=16;
            angle=305;
            rectangular=1;
            activationBy="WEST";
            repeating=1;
            interruptable=1;
            age="UNKNOWN";
            expActiv="thisTrigger = [player,75,true,(getPosATL player)] spawn player_alertZombies;";
            class Effects
            {
                soundDet="Sirene_EP1";
            };
        };
class Item7
        {
            position[]={4069.8455,365.19922,11661.84};
            a=140;
            b=140;
            activationBy="ANY";
            repeating=1;
            interruptable=1;
            age="UNKNOWN";
            text="Basis_West";
            name="Basis_West";
            expActiv="if (playerSide == WEST) then {[Basis_West] execVM ""safezone.sqf""};";
            class Effects
            {
            };
        };
        class Item8
        {
            position[]={11469.787,317.32358,11356.751};
            a=140;
            b=140;
            activationBy="ANY";
repeating=1;
            interruptable=1;
            age="UNKNOWN";
            text="Basis_East";
name="Basis_East";
            expActiv="if (playerSide == WEST) then {[Basis_East] execVM ""safezone.sqf""};";
            class Effects
            {
            };
        };
  class Item9
        {
            position[]={6345.6113,306.13721,7808.5073};
            a=140;
            b=140;
            activationBy="ANY";
repeating=1;
            interruptable=1;
            age="UNKNOWN";
            text="Basis_South";
name="Basis_South";
            expActiv="if (playerSide == WEST) then {[Basis_South] execVM ""safezone.sqf""};";
            class Effects
            {
            };
        };
};
};
You should put yours after or before the complete Marker block. Hope that helps

Regards kikyou2
 
I'm having some frustrating trouble getting the coordinates to work. I want this safe zone to be at 028 109, how do I translate that into the location in the script? As is now, it's at the right x-axis, but not y-axis.
 

kikyou2

Valued Member!
I'm having some frustrating trouble getting the coordinates to work. I want this safe zone to be at 028 109, how do I translate that into the location in the script? As is now, it's at the right x-axis, but not y-axis.
I made some examples for you how the coordiante thing works, hope it helps.

This picture matches position[]={11463.747,317.3078,11349.89};

http://i.imgur.com/fkPHrMJ.jpg

This picture matches position[]={4053.8501,364.76645,11668.645};

http://i.imgur.com/nY1DWqJ.jpg

This picture matches position[]={6344.8081,304.99023,7806.7598};

http://i.imgur.com/1haZqkH.jpg

Also you can simply open the Arma2 Editor Chernarus Map and then add a Unit or a marker save it and open the file and search for it via an Editor like Notepad++ ;)

Hope that helps!
 
I made some examples for you how the coordiante thing works, hope it helps.

This picture matches position[]={11463.747,317.3078,11349.89};

http://i.imgur.com/fkPHrMJ.jpg

This picture matches position[]={4053.8501,364.76645,11668.645};

http://i.imgur.com/nY1DWqJ.jpg

This picture matches position[]={6344.8081,304.99023,7806.7598};

http://i.imgur.com/1haZqkH.jpg

Also you can simply open the Arma2 Editor Chernarus Map and then add a Unit or a marker save it and open the file and search for it via an Editor like Notepad++ ;)

Hope that helps!
Thank you so much! What I did was go to the location (Mountain Klen in my case) and check the database where my character was, I then got these coordinates: 11416.5,11396.6,0.964, those coordinates only gave me the correct coordinates on the X-axis, so I haven't even gotten to see if the safe zone works, since it was in the middle of the ocean.
 
I can't get it working. It doesn't say anything.

I think I might have done something wrong, I don't have the trigger (I don't know how. ;s)
 
player groupchat "i have left Baseshield!";
player removeEventHandler ["Fired", _EH_Fired];
player removeEventHandler ["Hit", _EH_Hit];
player removeEventHandler ["Killed",_EH_Killed];
} <---- There
 

UrbanSkaters

Valued Member!
Does this: player groupchat "i am in Baseshield!";

Display in sidechat for all players on the server?
I'm still getting my head around the different types of chat commands... :)
 

kikyou2

Valued Member!
Hi there, sorry for the delay I was busy with my server.

1. Open Arma 2 Operation Arrowhead, you can load it with your Mod but you needn't it for this
2. Press ALT+E and choose Chernarus
3. You're now in the Editor choose in the upper right corner "Trigger" and simply put the Trigger with a doubleclick on the map where you wanna have the safezone. Maybe you wanna resize the circle radius where the Trigger works and also add to the field Name "safezone" (this helps to find it later). If you added the Trigger you see a blue circle this is the range where the safezone works (just make a mental note of it if you find the right size)
4. Now place a Center, Group and a Unit anywhere on the map (doesn't matter where and use the standard settings). This is just needed that you can save your mission.
5. Now save the mission on a random name
6. Close Arma and open your folder where the mission is saved. In my example its saved here "C:\Users\kikyou2\Documents\ArmA 2\missions\safezonetesttrigger.Chernarus"
7. Upload the mission.biedi to this site http://dayz.codeit.org.ua/parser.php type in the Captcha and send file.
8. Now you will see somthing like this



There you can see the Position you need for the Trigger "position[]={10315.756,, 2619.769};"

Now we create a Safezone Trigger out of it. Could be like this (a and b are the size of the trigger):

Just copy the position line over the one in the trigger I mentioned above. Should look something like this
class Item0
{
position[]={10315.756,, 2619.769};
a=50;
b=50;
activationBy="ANY";
repeating=1;
interruptable=1;
age="UNKNOWN";
text="Basis_South";
name="Basis_South";
expActiv="if (playerSide == WEST) then {[Basis_South] execVM ""safezone.sqf""};";
class Effects
{
};
};

Hope you can do it now ;)

Also if you want a message to appear when the player access the safezone you can do it like they done it in the Epoch Mod for the trader zones. Use the exactly same position like your Safezonetrigger and create a new trigger (simply copy everything, change item number, don't forget to raise item count at the beginning like I mentioned in the beginning post of this thread).

class Item1
{
position[]={10315.756,, 2619.769};
activationBy="WEST";
repeating=1;
interruptable=1;
age="UNKNOWN";
name="safezone";
expCond="(player distance safezone) < 50;";
expActiv="TitleText[""Now entering Safezone"",""PLAIN DOWN""]; placevault = false;";
expDesactiv="TitleText[""Now leaving Safezone"",""PLAIN DOWN""]; placevault = true;";
class Effects
{
};
};


Have fun!
 

kikyou2

Valued Member!
Edit: Just have a look the next posts. There is a better solution ;)

For the problems with the Zombies I modified the version of felixberndt.

You just have to replace the safezone.sqf with this version:

Code:
//Base protection for Players with Eventhandler
//
//requires Trigger with activation BLUEFOR and OPFOR with name Basis_West and Basis_East
//
// you can't fire out of your own Base
//
//Those who hit or kill Enemy in it's Base, will be killed
//
// Parameters: [name of the side trigger for the Base Area]
//
//Center_West:
//if (playerSide == WEST) then {[Basis_West] execVM "safezone.sqf"};
//
//Center_East:
//if (playerSide == EAST) then {[Basis_East] execVM "safezone.sqf"};
 
 
Private ["_Basis","_EH_Fired","_EH_Hit","_EH_Killed"];
 
 
_Basis = _this select 0; //Basisname
 
while {true} do
  {
    //wait until Player is in base, then start Eventhandler
    waitUntil {vehicle player in list _Basis};
    player groupchat "i am in Baseshield!";
    _EH_Fired  = vehicle player addEventHandler ["Fired", { NearestObject [_this select 0,_this select 4] setPos[0,0,0]}];
    _EH_Hit    = vehicle player addEventHandler ["Hit",  {_this select 1 setdammage 1; player setDammage 0; vehicle player setDammage 0}];
    _EH_Killed = vehicle player addEventHandler ["Killed",{_this select 1 setdammage 1}];
sleep 10;
_zombies = _Basis nearEntities ["zZombie_Base",150];
_count = count _zombies;
 
for "_i" from 0 to (_count -1) do
{
_zombie = _zombies select _i;
_zombie setpos [-3367.739,-120.84577,-8247.0625];
};
 
    //wait until Player left base, then delete EventHandler
    waitUntil {! (vehicle player in list _Basis)};
    player groupchat "i have left Baseshield!";
    player removeEventHandler ["Fired", _EH_Fired];
    player removeEventHandler ["Hit",  _EH_Hit];
    player removeEventHandler ["Killed",_EH_Killed];
  }
There is just one weird problem:

http://opendayz.net/threads/fixing-weird-script-restriction-106.9199/
 
Hey Kikyou,

do you have tested it ?
I think it will not work because

Code:
Private ["_Basis","_EH_Fired","_EH_Hit","_EH_Killed"];
 
 
_Basis = _this select 0; //Basisname
 
while {true} do
  {
    //wait until Player is in base, then start Eventhandler
    waitUntil {vehicle player in list _Basis};
    player groupchat "i am in Baseshield!";
    _EH_Fired  = vehicle player addEventHandler ["Fired", { NearestObject [_this select 0,_this select 4] setPos[0,0,0]}];
    _EH_Hit    = vehicle player addEventHandler ["Hit",  {_this select 1 setdammage 1; player setDammage 0; vehicle player setDammage 0}];
    _EH_Killed = vehicle player addEventHandler ["Killed",{_this select 1 setdammage 1}];
sleep 10;
_zombies = _Basis nearEntities ["zZombie_Base",150];
_count = count _zombies;
 
for "_i" from 0 to (_count -1) do
{
_zombie = _zombies select _i;
_zombie setpos [-3367.739,-120.84577,-8247.0625];
};
 
    //wait until Player left base, then delete EventHandler
    waitUntil {! (vehicle player in list _Basis)};
    player groupchat "i have left Baseshield!";
    player removeEventHandler ["Fired", _EH_Fired];
    player removeEventHandler ["Hit",  _EH_Hit];
    player removeEventHandler ["Killed",_EH_Killed];
  }
you have a loop in a loop. ;)
the first loop get only executed once. ;)



A other problem is when you use that on a Server where are 20 Players or and once in one Safezone you will get a huge Performance Problem. ;)

get it in two .sqf files and all will be fine and execute it Server side
 

kikyou2

Valued Member!
Hey Kikyou,

do you have tested it ?
I think it will not work because

Code:
Private ["_Basis","_EH_Fired","_EH_Hit","_EH_Killed"];
 
 
_Basis = _this select 0; //Basisname
 
while {true} do
  {
    //wait until Player is in base, then start Eventhandler
    waitUntil {vehicle player in list _Basis};
    player groupchat "i am in Baseshield!";
    _EH_Fired  = vehicle player addEventHandler ["Fired", { NearestObject [_this select 0,_this select 4] setPos[0,0,0]}];
    _EH_Hit    = vehicle player addEventHandler ["Hit",  {_this select 1 setdammage 1; player setDammage 0; vehicle player setDammage 0}];
    _EH_Killed = vehicle player addEventHandler ["Killed",{_this select 1 setdammage 1}];
sleep 10;
_zombies = _Basis nearEntities ["zZombie_Base",150];
_count = count _zombies;
 
for "_i" from 0 to (_count -1) do
{
_zombie = _zombies select _i;
_zombie setpos [-3367.739,-120.84577,-8247.0625];
};
 
    //wait until Player left base, then delete EventHandler
    waitUntil {! (vehicle player in list _Basis)};
    player groupchat "i have left Baseshield!";
    player removeEventHandler ["Fired", _EH_Fired];
    player removeEventHandler ["Hit",  _EH_Hit];
    player removeEventHandler ["Killed",_EH_Killed];
  }
you have a loop in a loop. ;)
the first loop get only executed once. ;)



A other problem is when you use that on a Server where are 20 Players or and once in one Safezone you will get a huge Performance Problem. ;)

get it in two .sqf files and all will be fine and execute it Server side
The idea from this method was that it doesn't have to run when nobody is there. I think I know what you mean, that it is executed for every new player which get into that safezone. Wanted to test that out :)

The break weren't that problem for me as I tested it out. The zombies kept disappearing :)
 
Top