Jump to content
nova

[Outdated] New safezone script and a.i remover from safezone (works with dzai and dzms) (works for 1.0.6.2)

Recommended Posts

This is a new version of a safezone script and an a.i/a.i vehicle remover. To be used in conjunction with the 1061 safezone script. So say your safe zone is being bombarded with roaming a.i and you are tired of going to safe zones to delete them this will do it automatically when you go within 350 meters of an roaming a.i while in a safezone. The distance is customizable. The new safezone script allows you to receive god mode for 20 secs after you leave the safe zone IF you have stayed in the safezone long enough. This will avoid players from touching the safe zone and taking off for a way to avoid combat from other players. All credits go to @juandayz for this. Uploaded with his permission. 

 

1- into mpmission\your instance\scripts\  create a new folder called "safezone"

2-into this folder create this sqf:

safezone_ai_remover.sqf

Spoiler
  1. //SAFEZONES UNITS AND VEHICLES REMOVER FROM SAFEZONES BY NOVA AND JUANDAYZ
  2.  
  3. private ["_playerpos","_ai_to_be_removed","_Safezone_radio","_all_nearest_veh"];
  4.  
  5.  
  6. while {true} do {
  7.  
  8. waitUntil {isInTraderCity};
  9.  
  10. _playerpos = getPos (vehicle player);
  11. _player = player;
  12. _ai_to_be_removed = _playerpos nearEntities ["Man",350];
  13. _Safezone_radio = 350;
  14. _all_nearest_veh = _playerpos nearEntities [["LandVehicle","Helicopter","Plane","Ship"],_Safezone_radio];
  15.  
  16. {
  17. if ((_x in allunits) and !(_x in serverTraders) and !(_x in playableunits))then{
  18.  
  19. _x setdamage 1;
  20. deletevehicle _x;
  21. };
  22.  
  23. } forEach _ai_to_be_removed;
  24.  
  25. {
  26. if (vehicle _x getVariable ["aiveh",0] == 1) then {
  27. if (_player == driver _x) then {
  28. _x setVariable ["aiveh",0];
  29. }else{
  30. deletevehicle _x;
  31. _vehicleID = _x getVariable ["ObjectID", "0"];
  32. _vehicleUID = _x getVariable ["ObjectUID", "0"];
  33. [_vehicleID,_vehicleUID] call server_deleteObj;
  34. PVDZ_obj_Destroy = [_vehicleID,_vehicleUID,_x];
  35. publicVariableServer "PVDZ_obj_Destroy";
  36. };
  37. };
  38. } forEach _all_nearest_veh;
  39.  
  40. uiSleep 5;
  41. };

 

3-open your init.sqf

Spoiler

find :

if (DZE_R3F_WEIGHT) then {execVM "\z\addons\dayz_code\external\R3F_Realism\R3F_Realism_Init.sqf";};

below paste:

// REMOVE AI FROM Safe Zones 
    [] execVM "scripts\safezone\safezone_ai_remover.sqf";

 

4-Now if ure using DZAI:

Spoiler

open DZAI\init\dzai_functions.sqf  then find lines in red and add lines in blue:

DZAI_protectObject = {
    private ["_objectMonitor","_object"];
    _object = _this;
    
    _objectMonitor = missionNamespace getVariable [DZAI_serverObjectMonitor,[]];
    _objectMonitor set [count _objectMonitor,_object];
    DZAI_monitoredObjects set [count DZAI_monitoredObjects,_object];
    _object setVariable ["ObjectID",""];
    _object setVariable ["ObjectUID",""];
  
  _object setvariable ["aiveh",1,true]; 
    true
};

 

5-If ure using DZMS then do the same:

Spoiler

Open DZMS\DZMSFunctions.sqf  then find lines in red and add lines in blue:

DZMSProtectObj = {
    private ["_object","_objectID"];
    _object = _this select 0;
    
    _objectID = str(round(random 999999));
    _object setVariable ["ObjectID", _objectID, true];
    _object setVariable ["ObjectUID", _objectID, true];
    _object setVectorUp surfaceNormal position _object;
 
   _object setvariable ["aiveh",1,true];
    
    if (_object isKindOf "ReammoBox") then {
        // PermaLoot on top of ObjID because that "arma logic"
        _object setVariable ["permaLoot",true];
    };

    if (DZMSEpoch) then {
        PVDZE_serverObjectMonitor set [count PVDZE_serverObjectMonitor, _object];
    } else {
        dayz_serverObjectMonitor set [count dayz_serverObjectMonitor, _object];
    };
    
    if (!((typeOf _object) in ["USVehicleBox","USLaunchersBox","AmmoBoxSmall_556","AmmoBoxSmall_762","MedBox0","USBasicWeaponsBox","USBasicAmmunitionBox","RULaunchersBox"]) || DZMSSceneryDespawnLoot) then {
        _object setVariable["DZMSCleanup",true];
    };
    true
};

 

6-If you are using some kind of other script that spawns enemy ai vehicles then add the same variable.. for example:

Spoiler

Example A:

Spoiler

_carrier =  createVehicle [_plane_class, [(_positionp select 0) + 50, (_positionp select 1) + 50],[], 0, "FLY"];
_carrier         setVehicleVarName "heli";
_carrier         setFuel 1;
_carrier         engineOn true;

{_carrier removeWeapon _x} forEach weapons _carrier;
_carrier addweapon "M230";
_carrier addmagazine "1200Rnd_30x113mm_M789_HEDP";
//_carrier addweapon "M240_veh";
//_carrier addmagazine "1200Rnd_762x51_M240";
_carrier         setVehicleAmmo 1;
_carrier         flyInHeight 150;
_carrier        limitSpeed 60;
_carrier         setVehicleLock "LOCKED";
_carrier         addEventHandler ["GetOut",{(_this select 0) setFuel 0;(_this select 0) setDamage 1;}];
dayz_serverObjectMonitor set [count dayz_serverObjectMonitor,_carrier];

_carrier setvariable ["aiveh",1,true];

Example b:

Spoiler

_vehicle_11 = objNull;
if (true) then
{
  _this = createVehicle ["BAF_Offroad_W", [(_pos select 0) - 4.5, (_pos select 1) - 5,-0.012], [], 0, "CAN_COLLIDE"];
  _vehicle_11 = _this;

dayz_serverObjectMonitor set [count dayz_serverObjectMonitor,_this];
  _this setvariable ["aiveh",1,true];
};

 

7- If you are using WAI, in wai\compile\vehicle_patrol.sqf find:

Spoiler

_vehicle = createVehicle [_veh_class, [(_startingpos select 0),(_startingpos select 1), 0], [], 0, "CAN_COLLIDE"];
_vehicle setFuel 1;
_vehicle engineOn true;
_vehicle setVehicleAmmo 1;
_vehicle addEventHandler ["GetOut",{(_this select 0) setFuel 0;(_this select 0) setDamage 1;}];
_vehicle allowCrewInImmobile true; 
_vehicle lock true;
     
dayz_serverObjectMonitor set [count dayz_serverObjectMonitor,_vehicle];
 

 

add  _vehicle setvariable ["aiveh",1,true];

 

Share this post


Link to post
Share on other sites

Replace all lines in safezone_ai_remover.sqf with

Spoiler
  1. //SAFEZONES UNITS AND VEHICLES REMOVER FROM SAFEZONES BY NOVA AND JUANDAYZ
  2.  
  3. private ["_playerpos","_ai_to_be_removed","_Safezone_radio","_all_nearest_veh"];
  4.  
  5.  
  6. while {true} do {
  7.  
  8. waitUntil {isInTraderCity};
  9.  
  10. _playerpos = getPos (vehicle player);
  11. _player = player;
  12. _ai_to_be_removed = _playerpos nearEntities ["Man",350];
  13. _Safezone_radio = 350;
  14. _all_nearest_veh = _playerpos nearEntities [["LandVehicle","Helicopter","Plane","Ship"],_Safezone_radio];
  15.  
  16. {
  17. if ((_x in allunits) and !(_x in serverTraders) and !(_x in playableunits))then{
  18.  
  19. _x setdamage 1;
  20. deletevehicle _x;
  21. };
  22.  
  23. } forEach _ai_to_be_removed;
  24.  
  25. {
  26. if (vehicle _x getVariable ["aiveh",0] == 1) then {
  27. if (_player == driver _x) then {
  28. _x setVariable ["aiveh",0];
  29. }else{
  30. deletevehicle _x;
  31. _vehicleID = _x getVariable ["ObjectID", "0"];
  32. _vehicleUID = _x getVariable ["ObjectUID", "0"];
  33. [_vehicleID,_vehicleUID] call server_deleteObj;
  34. PVDZ_obj_Destroy = [_vehicleID,_vehicleUID,_x];
  35. publicVariableServer "PVDZ_obj_Destroy";
  36. };
  37. };
  38. } forEach _all_nearest_veh;
  39.  
  40. uiSleep 5;
  41. };

this should work for ya. also updated main post with this

Share this post


Link to post
Share on other sites

OP said " To be used in conjunction with the 1061 safezone script".  

Could someone point me in the direction of the mod he is referring to. it's underlined like it should be a hyperlink but it does not work.

Thanks.

Share this post


Link to post
Share on other sites
19 hours ago, G2K said:

OP said " To be used in conjunction with the 1061 safezone script".  

Could someone point me in the direction of the mod he is referring to. it's underlined like it should be a hyperlink but it does not work.

Thanks.

It doesn't matter what kind of safezone script you are using because this script uses the positions of the trader zones (with this check waitUntil {isInTraderCity};". You can use any safezone script you want.

Share this post


Link to post
Share on other sites
6 hours ago, nova said:

ya works with any safezone script really as @Relentless says

Ok, thanks for the reply. a little off topic but is there a way to use this code so it is not tied to a safe zone but just a 'zone' where if any AI (plus vehicles)go into said zone they will delete?  I'm running a Tavi server and the DZAI vehicle patrols love the big bridge. they go there and have big AI parties on the ends of the bridge, Making it a dangerous place for players.  I currently have 16 patrols and 75% of them hang out at the bridge. so i was thinking if I could make an AI delete zone on either side the bridge then they will respawn and traverse the map.

Either way thinks for your and Relentless's help.

Share this post


Link to post
Share on other sites

To be honest, i'm not sure if you can. I haven't worked with arma 2 in a long time now haha. I can suggest maybe try to add in black lists zones for the bridge in the DZAI to see if that works. However if someone knows how then someone can edit this script and share. The more options the better I say. 

Share this post


Link to post
Share on other sites

Hi guys,

I'm using this script with 106.2 and although it appears to be working I'm getting an undefined variable showing up in my RPT.

Any idea how I can fix this please?

Here is the RPT snippet:

Error in expression <D", "0"];
[_vehicleID,_vehicleUID] call server_deleteObj;
PVDZ_obj_Destroy = [_v>
  Error position: <server_deleteObj;
PVDZ_obj_Destroy = [_v>
  Error Undefined variable in expression: server_deleteobj
File mpmissions\__CUR_MP.Panthera2\scripts\safezone\safezone_ai_remover.sqf, line 33

 

Share this post


Link to post
Share on other sites

That I can't be too sure of :/ I haven't touched arma for so long I have forgotten. However does it spam the rpt over and over? If not and if it still works then I wouldn't worry about it too much. But if it becomes a problem then perhaps someone else knows a fix for it. If so i'll add it to the main post.

Share this post


Link to post
Share on other sites
On 5/8/2020 at 1:15 AM, nova said:

That I can't be too sure of :/ I haven't touched arma for so long I have forgotten. However does it spam the rpt over and over? If not and if it still works then I wouldn't worry about it too much. But if it becomes a problem then perhaps someone else knows a fix for it. If so i'll add it to the main post.

I haven't yet solved the problem but I will eventually. It's no big deal really and doesn't spam the RPT but I'd prefer a nice clean RPT log. I might even try and remove or divert the AI in some other way using blacklisting or something. Thanks for taking the time to answer though, much appreciated! 

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 Harkness
      Please consider joining our custom Epoch | DayZ | Expansion | Namalsk or Takistan servers, we have 2 long term Admins on both UK/US continents and run our servers completely for charity and from 100% clean and renewable energy too!
      Click here to join our Discord for more information
      DayZSA Expansion Namalsk     |     DayZSA Expansion Takistan     |     A2 DayZ Epoch Namalsk
      86.10.6.13:2402            |     86.10.6.13:2602             |          86.10.6.13:2302
      Custom Content:

      - Armed Roaming / Dynamic AI Bandit Patrols
      - Custom Land and Air Trader Camps
      - Banking and Wallets
      - Customization Land Rovers
      - Advanced Weaponry
      - No Vehicle Crash Damage & Fix Vehicle Positions
      - More weapons packs, loot+, vehicles+, custom clothing & backpacks
      - Bounty Hunting
      - Unlimited Stamina
      - PvP & Raiding
      - Modular Vests
      - Igloo Crafting
      Thanks we hope to see you there!
      CPU: Xeon-X5690 @ 3.46GHz
      RAM: 16GB
      Storage: SSD
      Additional Features:
      ATM Banking | More Weapons | More Cars | More Loot | Namalsk Igloo | Light Saber Mod | No-Vehicle-Crash-Damage | Trader Wallet - Money/Item Storage | Custom Namalsk Spawn Selection | Custom Trader Cities | All items added to traders |Namalsk Airdrops | | Notification System | Territories System | Auto-run System | No Stamina System | Safezone System | Mission System | Skin System | Map UI and 2D/3D Markers System | KillFeed System | Towing System | Player Attachment | Custom lighting | Custom interiors | Custom ocean | Working Street lights | Builderitems | Gravecross | KillFeed | Notifications | Gravecross | Horn | Autorun | No stamina | MoreGuns | Street lights | Car Keys | CodeLock | Map UI and 2D/3D Markers | Global/Transport/Party Chat | Book (Server Info, Rules, player stats | party management | territory management) System
    • By Sp4rkY
      Title:                 SPK_ESVP
      Author:            Sp4rkY (Github)
      Description:   Extended Safezones with Vehicle Protection for Arma 3 Epoch
      Version:           0.9
      Required:        Arma 3 1.66+ / Epoch 0.4+
      Credits:            IT07 (Thx for many brain) (Github)
                                |V.I.P.| CH!LL3R (Thx for thoughts & testing!)

      DOWNLOAD & INSTALL INSTRUCTIONS:
      >>> >> > CLICK ME < << <<<
      Edit by EpochMod - 2019-11-08:
      There came some issues up with the Arma 1.96 update.
      Unfortunately @Sp4rkY currently seems to be not active here, so we have added a pull request for his GitHub files.
      So if you want to use this addon, check / add this changes:
      https://github.com/SPKcoding/A3_Epoch_ESVP/pull/2/files

      FEATURES:
      * Fully customizable
      * Works with all maps
      * Works for players and vehicles
      * No more `"ProtectionZone_Invisible_F"` is needed (usually found in map config in a3_epoch_server_settings.pbo)
      * Fired bullets will automatically be deleted in safezones
      * (optional) Teleport players out of safezones after restart
      * (optional) Teleport players away from the parking place (if used) after restart
      * Protection from idiots trying to drive over other players (including traders)
      * Check vehicle ownership of bought vehicles
      * (optional) Teleport vehicles out of safezones at server restart to:
          - (optional) a given distance from the respective safezone
          - (optional) a static parking place (you can use your own map addition and define as many parking lots you want)
      * (optional) Restricted vehicle´s access in safezones (only the owner(s) can enter the vehicle)
      * (optional) Restricted vehicle´s gear-access in safezones (only the owner(s) can access the vehicle´s inventory)
      * (optional) Protection for lifted vehicle´s
          - If using this feature, there will be also a check for the owner, so stealing is not possible
      * (optional) Unlock teleported vehicles
      * 2 ways of info messages (depends on if vehicle protection is used or not)
      * (optional) Vehicle Access Menu:
          - "Refresh" button to update the player-list while menu is open
          - "Registered" listing to see which players are added to your vehicle
          - "Clear" button to remove the added players
      * (optional) restrict access to driver seat for primary vehicle owner
      * slingload check for bought vehicles (you can not steal cars or ships)
      * (optional) info messages for prohibited lifting
      * (optional) Prevent spawning of antagonists (UAV, Sappers, Snakes, Cultists) in safezones
      * (optional) Allow/disallow to chop/sledge/chainsaw anything in safezones
      * (optional) Feature to set map markers directly from this script (no need to define them anywhere else)
      * If using the "vehicle teleporting WITHOUT Parking Place" - function:
          - the vehicles get teleported to a random position within the given radius out of the safezones
      * If using the "vehicle teleporting WITH Parking Place" - function, it will works like this:
          - server restarts, vehicles in safezones will be teleported to a parking place
          - vehicles which are present at the parking place are getting teleported to a random location on the map, new vehicles (in safezones) are ported to the parking place
      * If the respective safezone contains water, ships are treated like this:
          - if ships are located at water surface, they gets teleported close to the safezone´s shore at given radius
          - if ships are located at terrain surface because of lifting or simliar, they gets ported random at the maps shore
      * If not using "vehicle teleporting" - function, remaining vehicles in safezones are indestructible after restart
      * Debug option for better determine errors (client & server)
       
      Enjoy this stuff and have fun!
      cheers
    • By Rezusty
      Hi !!
      I've made a custom safezone on my server, and I want to disable loot spawning in this area, how can I do that ?
      Thanks
    • By BoleParty
      I removed the standard Epoch spawns and static traders within the spawns and and replaced everything with new spawns and traders.
      By default the spawns have a safe zone included but in case you want to have a bigger diameter of it, i attached Friendlys "Extended Safe Zone Script" and an edited version of the mission.sqm.
      In each spawn i placed either one or two boxes which can be used as a temporary storage. If you purchase items and you dont have enough space in your inventory you can put them into the storage.
      All items will be gone after a restart tho.
      Additional in each spawn i placed an atm and phone boxes so that players are able to access their bank accounts.
       
      Download here:
      https://github.com/BoleParty/NewSpawnZones
       
       
      Locations:
      Central: Between Katalaki and Neochori
      West: Stadium
      East: SW Paros
       
      Overview:
       

       
      Central Spawn:
       




       
      West Spawn:
       





       
      East Spawn:
       




       
      Regards
      BoleParty
    • By ReDBaroN
      Hi, would anyone know how to add a check to this file to prevent sappers and UAV's being spawned in the safezones? The file below is EPOCH_server_triggerEvent.sqf which, I'm guessing is the best place to add a check for the player being in a safezone...
      params ["_target", "_type"]; if (!isNull _target) then { switch (_type) do { case "UAV": { "I_UAV_01_F" remoteExec ['EPOCH_unitSpawnIncrease',_target]; }; case "Cloak": { if (sunOrMoon < 1) then { "Epoch_Cloak_F" remoteExec ['EPOCH_unitSpawnIncrease',_target]; } else { "Epoch_Sapper_F" remoteExec ['EPOCH_unitSpawnIncrease',_target]; }; }; case "Sapper": { "Epoch_Sapper_F" remoteExec ['EPOCH_unitSpawnIncrease',_target]; }; case "GreatWhite": { "GreatWhite_F" remoteExec ['EPOCH_unitSpawnIncrease',_target]; }; case "SapperB": { "Epoch_SapperB_F" remoteExec ['EPOCH_unitSpawnIncrease',_target]; }; case "PHANTOM": { "PHANTOM" remoteExec ['EPOCH_unitSpawnIncrease',_target]; }; }; }; Any help on this would be greatly appreciated.
      Thanks 
  • Advertisement
  • Supporters
  • Discord

×
×
  • Create New...