Jump to content
salival

[Release] Safe Zone Relocate

Recommended Posts

Hi,

Here's a simple safe zone relocation script for vehicles. 

  • Simple relocate only safe zone script.

  • Extremely quick and low overhead since we're only scanning the safe zone array instead of every vehicle.

  • Uses the Epoch DZE_SafeZonePosArray for convenience.

Install instructions and download link: https://github.com/oiad/safeZoneRelocate

Share this post


Link to post
Share on other sites

Simple, small and clean useful script. As always, good work! I like the idea. That's better than deleting the vehicles.

I will probably add that the vehicles that are relocated get unlocked so everybody can take them (to punish the owner who parked in the safezone).
But anyways, thanks for that!

Share this post


Link to post
Share on other sites
9 hours ago, DAmNRelentless said:

Simple, small and clean useful script. As always, good work! I like the idea. That's better than deleting the vehicles.

I will probably add that the vehicles that are relocated get unlocked so everybody can take them (to punish the owner who parked in the safezone).
But anyways, thanks for that!

Yeah, I don't like forcibly unlocking vehicles since someone might have disconnected from the server legitly i.e internet died or something.

Share this post


Link to post
Share on other sites
1 hour ago, salival said:

Yeah, I don't like forcibly unlocking vehicles since someone might have disconnected from the server legitly i.e internet died or something.

Also true but I mean you could do that with a timer so they only get unlocked after 10 or 15 mins of inactivity.

Share this post


Link to post
Share on other sites

I Just want to add that this version of salivals relocate script was meant to be much cleaner and optimized for 1061, compared to Halvs version for earlier versions of epoch. I asked salival to release his version.

Now, with these posts, specially with the database question about deleting the key, we are just falling back on the older script...

The old one works, its the one i HAD running on my server. But salivals is cleaner, for that specific reason.

 

Share this post


Link to post
Share on other sites
7 hours ago, theduke said:

I Just want to add that this version of salivals relocate script was meant to be much cleaner and optimized for 1061, compared to Halvs version for earlier versions of epoch. I asked salival to release his version.

Now, with these posts, specially with the database question about deleting the key, we are just falling back on the older script...

The old one works, its the one i HAD running on my server. But salivals is cleaner, for that specific reason.

 

Hi guys,

I cleaned up the thread a bit.

I wrote this script to be a SIMPLE relocate script with low overhead. I didn't want to add unlocking (which is stupid and unfair to legitimate players)

There are a lot of other safe zone scripts that will do the unlocking (unfair) deleting (unfair) and you are more than welcome to use them.

Share this post


Link to post
Share on other sites
2 minutes ago, DAmNRelentless said:

@salival That's okay but why you deleted the posts with the configurable position? So they get moved to a specific location? There was no unlocking in this code. :D

I would only assume its because there are already scripts like that in the forums. This was meant to do one thing, and it ended up starting to do the same things as the other ones..

Share this post


Link to post
Share on other sites
Just now, theduke said:

I would only assume its because there are already scripts like that in the forums. This was meant to do one thing, and it ended up starting to do the same things as the other ones..

+1 agree

Share this post


Link to post
Share on other sites
4 minutes ago, DAmNRelentless said:

@salival That's okay but why you deleted the posts with the configurable position? So they get moved to a specific location? There was no unlocking in this code. :D

I am okay with moving vehicles to a specific position, i.e a junkyard, but im not interested in unlocking or deleting since that punishes legitimate players that either a) didn't know better or b) mom told them they had to go do the dishes.

Share this post


Link to post
Share on other sites
1 minute ago, salival said:

I am okay with moving vehicles to a specific position, i.e a junkyard, but im not interested in unlocking or deleting since that punishes legitimate players that either a) didn't know better or b) mom told them they had to go do the dishes.

Made my day! :D

Okay then final post: For those guys that want to move the vehicles out of the safezone to a specific location, go to dayz_server\init\safeZoneRelocate.sqf and search this line:

_position = [_safeZonePos,_safeZoneRadius + 50,_maxDist,_objDist,if (_x isKindOf "Ship") then {2} else {0},0,0,[],[_safeZonePos,_safeZonePos]] call BIS_fnc_findSafePos;

And replace it with:

_position = [[YOUR COORDINATES],15,250,10,if (_x isKindOf "Ship") then {2} else {0},0.5,0] call BIS_fnc_findSafePos;

 

Share this post


Link to post
Share on other sites
7 minutes ago, DAmNRelentless said:

Made my day! :D

Okay then final post: For those guys that want to move the vehicles out of the safezone to a specific location, go to dayz_server\init\safeZoneRelocate.sqf and search this line:

_position = [_safeZonePos,_safeZoneRadius + 50,_maxDist,_objDist,if (_x isKindOf "Ship") then {2} else {0},0,0,[],[_safeZonePos,_safeZonePos]] call BIS_fnc_findSafePos;

And replace it with:

_position = [[YOUR COORDINATES],15,250,10,if (_x isKindOf "Ship") then {2} else {0},0.5,0] call BIS_fnc_findSafePos;

 

Just bare in mind, you need to test this properly, if BIS_fnc_findSafePos can't find a safe position, it will fail to find a position. I'll do an update to this script to do a "junk yard" style parking lot

Share this post


Link to post
Share on other sites
1 minute ago, salival said:

Just bare in mind, you need to test this properly, if BIS_fnc_findSafePos can't find a safe position, it will fail to find a position. I'll do an update to this script to do a "junk yard" style parking lot

I am using this already and it works quite fine for me but ofcourse you could at the last optional parameter to define a default position if no safe position was found. If you update this, it would be nice if you do that.

Share this post


Link to post
Share on other sites

I have updated the script to reflect the changes wanted regarding a custom vehicle dump / junk yard.

I have tested this with: land vehicles, air and boats and it works as intended, you will need to fiddle with the _customRadius and _maxDist variables to get things optimized if you are going to use a custom position, though. I found it makes a big difference in where the vehicles are spawned.

https://github.com/oiad/safeZoneRelocate/commit/2b7c5a9c03c0646de544e166debba0d195d92ce9

https://github.com/oiad/safeZoneRelocate

 

Share this post


Link to post
Share on other sites
6 minutes ago, SmokeyBR said:

doesnt seem to be working for me anymore if anyone else could confirm....

Working fine here man.

There's not really anything that can go wrong on this unless you've broken your DZE_SafeZonePosArray since that's what it goes off.

Share this post


Link to post
Share on other sites

As far as anything broke goes i doubt it since i get no errors in server side or client side, also the DZE_SafeZonePosArray is referenced in other places which are working good.

could you humor me and tell me if with the added diag_log format should be displayed regardless of variables true or false ? ive added two 

diag_log format ["[SAFEZONE] Making Sure: %1",_x];

it should display on server log as soon as server starts right ?

/*
	Safe Zone Relocate by salival (https://github.com/oiad)
*/

private ["_customPosition","_customRadius","_maxDist","_maxDamage","_nearVehicles","_objDist","_position","_safeZonePos","_safeZoneRadius","_useCustomPosition","_unlock"];

_useCustomPosition = false; // Enable a custom position to move vehicles to (i.e a junk yard)
_customPosition = [6942.64,15121.6,0]; // Position for vehicles to be moved to if _useCustomPosition = true;
_customRadius = 5; // Minimum distance from the custom position to move vehicles to 
_maxDist = 1000; // Maximum distance from the safe zone position to find a safe position or custom position for relocation, setting this too low can make vehicles spawn very close to other vehicles.
_objDist = 15; // Minimum distance from the safe position for relocation to the center of the nearest object. Specifying quite a large distance here will slow the function and might often fail to find a suitable position.
_unlock = false; // Unlock vehicle when moved from the safe zone?
_maxDamage = 0.75; // Vehicles above this amount of damage will be deleted

{
	_safeZonePos = _x select 0;
	_safeZoneRadius = _x select 1;
	_nearVehicles = _safeZonePos nearEntities [["Air","LandVehicle","Ship"],_safeZoneRadius];
	diag_log format ["[SAFEZONE] Making Sure: %1",_x];
	{
		diag_log format ["[SAFEZONE] Making Sure: %1",_x];
		if (damage _x > _maxDamage) then {
			deleteVehicle _x;
			[_x getVariable["ObjectID","0"],_x getVariable["ObjectUID","0"],"safeZoneRelocate"] call server_deleteObjDirect;
			diag_log format ["[SAFEZONE] %1 was deleted from the server for being too damaged before relocate: @%2 %3",typeOf _x,mapGridPosition _x,getPosATL _x];
		} else {
			if (_useCustomPosition) then {
				_position = [_customPosition,_customRadius,_maxDist,_objDist,1,0,0,[]] call BIS_fnc_findSafePos;
			} else {
				_position = [_safeZonePos,_safeZoneRadius + 50,_maxDist,_objDist,if (_x isKindOf "Ship") then {2} else {0},0,0,[],[_safeZonePos,_safeZonePos]] call BIS_fnc_findSafePos;
			};
			_x setPos _position;
			[_x,"position"] call server_updateObject;
			if (_unlock && {locked _x}) then {_x setVehicleLock "UNLOCKED"};

			diag_log format ["[SAFEZONE] %1 was moved out of a safe zone to: @%2 %3",typeOf _x,mapGridPosition _position,_position];
		};
	} forEach _nearVehicles;
} forEach DZE_safeZonePosArray;

 

Share this post


Link to post
Share on other sites
12 minutes ago, SmokeyBR said:

As far as anything broke goes i doubt it since i get no errors in server side or client side, also the DZE_SafeZonePosArray is referenced in other places which are working good.

could you humor me and tell me if with the added diag_log format should be displayed regardless of variables true or false ? ive added two 

diag_log format ["[SAFEZONE] Making Sure: %1",_x];

it should display on server log as soon as server starts right ?

/*
	Safe Zone Relocate by salival (https://github.com/oiad)
*/

private ["_customPosition","_customRadius","_maxDist","_maxDamage","_nearVehicles","_objDist","_position","_safeZonePos","_safeZoneRadius","_useCustomPosition","_unlock"];

_useCustomPosition = false; // Enable a custom position to move vehicles to (i.e a junk yard)
_customPosition = [6942.64,15121.6,0]; // Position for vehicles to be moved to if _useCustomPosition = true;
_customRadius = 5; // Minimum distance from the custom position to move vehicles to 
_maxDist = 1000; // Maximum distance from the safe zone position to find a safe position or custom position for relocation, setting this too low can make vehicles spawn very close to other vehicles.
_objDist = 15; // Minimum distance from the safe position for relocation to the center of the nearest object. Specifying quite a large distance here will slow the function and might often fail to find a suitable position.
_unlock = false; // Unlock vehicle when moved from the safe zone?
_maxDamage = 0.75; // Vehicles above this amount of damage will be deleted

{
	_safeZonePos = _x select 0;
	_safeZoneRadius = _x select 1;
	_nearVehicles = _safeZonePos nearEntities [["Air","LandVehicle","Ship"],_safeZoneRadius];
	diag_log format ["[SAFEZONE] Making Sure: %1",_x];
	{
		diag_log format ["[SAFEZONE] Making Sure: %1",_x];
		if (damage _x > _maxDamage) then {
			deleteVehicle _x;
			[_x getVariable["ObjectID","0"],_x getVariable["ObjectUID","0"],"safeZoneRelocate"] call server_deleteObjDirect;
			diag_log format ["[SAFEZONE] %1 was deleted from the server for being too damaged before relocate: @%2 %3",typeOf _x,mapGridPosition _x,getPosATL _x];
		} else {
			if (_useCustomPosition) then {
				_position = [_customPosition,_customRadius,_maxDist,_objDist,1,0,0,[]] call BIS_fnc_findSafePos;
			} else {
				_position = [_safeZonePos,_safeZoneRadius + 50,_maxDist,_objDist,if (_x isKindOf "Ship") then {2} else {0},0,0,[],[_safeZonePos,_safeZonePos]] call BIS_fnc_findSafePos;
			};
			_x setPos _position;
			[_x,"position"] call server_updateObject;
			if (_unlock && {locked _x}) then {_x setVehicleLock "UNLOCKED"};

			diag_log format ["[SAFEZONE] %1 was moved out of a safe zone to: @%2 %3",typeOf _x,mapGridPosition _position,_position];
		};
	} forEach _nearVehicles;
} forEach DZE_safeZonePosArray;

 

Yes, that looks fine.

The first one will show the safezone postion, the second one will show the vehicle it's currently checking.

Share this post


Link to post
Share on other sites

so heres something weird that i do not understand.

The first "Making Sure" shows up fine the second however does not i even thought of adding another line bellow the second "making sure" with 

	_nearVehicles = _safeZonePos nearEntities [["Air","LandVehicle","Ship"],_safeZoneRadius];
	diag_log format ["[SAFEZONE] Making Sure: %1",_x];
	{
		diag_log format ["[SAFEZONE] Making Sure: %1",_x];
		diag_log format ["[SAFEZONE] Double Sure"];
		if (damage _x > _maxDamage) then {

doubted it wanst displaying because there was no value to display, ideias ?

Share this post


Link to post
Share on other sites

OMG so stupid....

It was something wrong with the DZE_SafeZonePosArray  like you said, only it was not broken i copied trader positions from mission.sqm for some reason that i cant recall, and in the process ended up with really high heights > 100, which is why it was not working.

anyways thx.

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...

  • Similar Content

    • By salival
      Hi guys,
      Quite a few admins asked me to release my Change Code script so here it is, It comes with BattlEye filters, too.
      This will allow players to set the code on placement/upgrade of doors, lockboxes and safes as well as changing them after they are placed.
      https://github.com/oiad/changeCode
    • By Warburgg
      Hello everyone. I would like to ask for help regarding a problem I have been having on my server.
      Items stored in the vault are not being stored in the SQL database.
      I have tested with the safe and the lockbox and both are not working but with the tent it works and saves the items in the database after the server restart.
      ArmA2OA.RPT: https://pastebin.com/X2cT7BBU
      arma2oaserve.RPT: https://pastebin.com/rqFNGbDy
      server_log.txt: https://pastebin.com/ZVWAzgNP
      Please help me. My players do not want to stay on the server because of this and if I remove the safe and leave only the tent (which is what saves the items) they will cry hahaha
    • By xDUKEx
      Sorry if this post is in the wrong area on the forum ... I'm not sure if there would a better place to ask this question.
      The Actual Script can be found here:
      I've added the script and it works perfectly, however, I can't get the signs to populate around the safe zones.  I believe I need to be adding in actual coordinates to the script but I am not sure of the placement.  Can I stick them all within the [   ]'s and use commas to separate them ... or do I need to create a separate entry for each new location?  
      Here is the bit of the script I am using:
       
    • By Z80CPU
      NoKillScript – Prevents any ‘Safe Zone’ killings and damage to player’s vehicles.
      Version:  1.16

      Tested On:  ARMA 3 (should work on ARMA 2, though untested)
      Tested Modes: Single Player, Multiplayer (Dedicated Server)
      Tested Environments:  Standard ARMA SP/MP, Epoch, Exile
      Script Executor:  Client
      Script Host:  Server or Client
      Format:  script, SQS
       
      Description:
      NoKillZone (NKZ), is a script that helps put an end to the notorious ‘safe zone’ killings that plagued MP environments such as Epoch and Exile.
      Simply place a marker on your map, and then put the marker name in the scripts parameters, and that’s it!  It is a simple script to use.  Nothing fancy here.
      Once it starts, it just loops over and over checking to see if player has entered or left the mark area. Matters not if they teleport into the area, fly over it, or respawn in to it – the script will detect all players in the zone regardless how they arrived or left.
      100% client side and consumes almost no resources from the client.
      Runs till client exits the server.
      No triggers are used.
      This script is for players only, it does not detect/react to any AI units.
       
      Uses:
      To mark a ‘safe area’ where players can be safe and not have to worry about being killed by anyone.
      It is possible, if desired for example, to have player protected at 100m and then at 50m, their vehicle protected.  This is done by using 2 scripts.  One with the DISTANCE parameter set to ‘100’ and the other set to ‘50’.

      Usage:
      [MARKER,DISTANCE,TEXT-IN,TEXT-OUT,PROTECTION] exec "NoKillZone.Sqs";
      MARKER = Map marker name - In quotes
      DISTANCE = Radius of protection in meters
      TEXT-IN *  = Text to be shown via Hint when entering the zone - In quotes
      TEXT-OUT *  = Text to be shown via Hint when leaving the zone - In quotes
      PROTECTION *  = Allows you to choose protection for player or player and their vehicle.
      * = Optional parameter
      Example:
      ["CentralSZ",500,"You Have Entered The Central Safe Zone","You Have Left The Central Safe Zone",1] exec "NoKillZone.Sqs"
      Full documentation can be found in the top lines of the script.  Just open it in a text program such as NotePad++ to view.
      For servers, call script from 'INIT.SQF' and/or 'OnPlayerRespawn.Sqf'.
      For SP, you can also call it from the INIT.Sqf or you can activate it via the debug console or other means such as a radio trigger.
      Once launched, you will get a 'confirmation' message showing script is active, what zone, and if vehicle protection is active.

      Other Notes:
      While not ‘optimized’ and the ‘cleanest’ looking script, it does work and work well.  If you wish to spend one to two hours ‘optimizing’ it to save a few milliseconds, be my guest!  ;-)

      Known Issues:
      Script can be run many times for the same location (marker).
      There is no way to exit the script without the player quitting the game.
      Not all parameter errors are detected, though some are
      (The above issues are set to be addressed in the future)
       
      Video Example:  No Kill Zone Example
       
    • By Demellion
      Tested much, and still found the same ways to avoid (EPOCH_Locked) variable state of the vaults. 
      Result: I am still able to violate access of the locked vaults via inventory glitches.
      My advise still to use this fix:
       
       
  • Advertisement
  • Supporters
  • Discord

×
×
  • Create New...