Jump to content
Sign in to follow this  
Holmes

Base Protection Script

Recommended Posts

Hello everyone,

Im looking for what the topic says. A Base Protection script. I've tried searching and tried using:

_position = anything here to get the position of where you want it (ie getPos vehicle, getMarkerPos shield, etc)
_shield = "ProtectionZone_Ep1" createVehicleLocal (_position);
_shield setObjectTexture [0,"#(argb,8,8,3)color(0,0,0,0,ca)"];

I've tried both createVehicleLocal and createVehicle neither of which works for me.

I am unable to get it function on our multiplayer server hosted by NFO. I have gotten it to a point where is spawns the red cylinders but does not make them invisible like the script is designed to do.

Below is my init where the script is called and the script itself

init.sqf

if !isDedicated then { startLoadingScreen ["Loading...","RscLoadScreenCustom"]; };
enableSaving [false, false]; 
waitUntil { isServer || !isNull player }; 
waitUntil { !isNil "BIS_MPF_InitDone" }; 
waitUntil { BIS_MPF_InitDone }; 
#include "config.sqf"
[] execFSM "fsm\vehicledrivercheck.fsm";
_ammo = tfor_ammobox createVehicleLocal getMarkerPos "ammoboxes";
_ammo allowDamage false;
_ammo addAction ["<t color='#668AFF'>Save Loadout</t>", "scripts\saveloadout.sqf",[],-99,false,true,"",""];
[_ammo] execVM "scripts\ammocrate_filler.sqf";
res = [] execVM "scripts\ofpec_lightbulbs.sqf";
// Global Variable Init
curTime				= time;    //mission start time
serverLoadHint      = false;   //server load hint message



if (isServer) then {

//Base protection script
nul0 = [] execVM "ST3_Scripts\grief\base_antishoot.sqf";

// ACE Modules
ace_sys_wounds_enabled = true;							publicVariable "ace_sys_wounds_enabled";
ace_sys_wounds_no_rpunish = true;						publicVariable "ace_sys_wounds_no_rpunish";
ace_sys_wounds_auto_assist_any = false;					publicVariable "ace_sys_wounds_auto_assist_any";
ace_sys_wounds_ai_movement_bloodloss = true;			publicVariable "ace_sys_wounds_ai_movement_bloodloss";
ace_sys_wounds_player_movement_bloodloss = true;		publicVariable "ace_sys_wounds_player_movement_bloodloss";
ace_sys_wounds_auto_assist = true;						publicVariable "ace_sys_wounds_auto_assist";
if !(player hasWeapon "ACE_Earplugs") then {player addWeapon "ACE_Earplugs";};
};

if (local player) then { call compile preprocessFileLineNumbers "initclient.sqf"; }; 
if (isServer) then { call compile preprocessFileLineNumbers "initserver.sqf"; };

// Uncomment this line to disable players from manually switching power on and off through the action menu at transformer locations.  True or Nil: enabled.  False: disabled.  Default is enabled.
//AEG_manual = false;

// Uncomment the first line below to allow the CCTV system to use night vision  True: enabled.  False or Nil: disabled.  Default is disabled.  Default times for nightvision can also be customized.
//AEG_NVG = true;
//AEG_dark = 19; // Default time Camera NVG use BEGINS, change to customize as desired.  Does not need to be uncommented to work, only if changed.
//AEG_light 6; // Default time Camera NVG use ENDS, change to customize as desired.  Does not need to be uncommented to work, only if changed.

// Uncomment this line to cause an arc flash explosion every time a circuit breaker is switched.  Change the value to whatever odds of occurence you want an arc flash to occur.  For examples AEG_explode = 4 would cause an arc flash 1 in every 4 times, AEG_explode = 100 would cause an arc flash 1 in every 100 times.
AEG_explode = 4; 

// Comment or delete this line to NOT require a password to logon to the grid control software system.  In the demo on Chernarus a password is required at Elektrozavodsk but NOT at Chernogorsk.
AEG_password = "123456";

// Uncomment the following line to enable the simulation to remain consistent for team switching players in SP and in the editor.
//onTeamSwitch {[_from, _to] execVM "AEG\Scripts\AEG_team.sqf";};

// Debug options for developer only.  Similar code is present in most simulation scripts.
//AEG_DEBUG = true;
//LGD_fnc_debugMessage = compile (preprocessFileLineNumbers "LGD_fnc_debugMessage.sqf"); //DEBUG

if (!isNil "AEG_DEBUG") then {_debug = ["init.sqf: execVM AEG_init.sqf."] call LGD_fnc_debugMessage;}; //DEBUG

base_antishoot.sqf

//protection zone approx radius 50m, will overlap
_pos1 = (getMarkerPos "pzone1");
_pos2 = (getMarkerPos "pzone2");
_pos3 = (getMarkerPos "pzone3");
_pos4 = (getMarkerPos "pzone4");
_pos5 = (getMarkerPos "pzone5");
_pos6 = (getMarkerPos "pzone6");
_pos7 = (getMarkerPos "pzone7");
_pos8 = (getMarkerPos "pzone8");
_pos9 = (getMarkerPos "pzone9");
_pos10 = (getMarkerPos "pzone10");
_pos11 = (getMarkerPos "pzone11");
_pos12 = (getMarkerPos "pzone12");
_pos13 = (getMarkerPos "pzone13");
_pos14 = (getMarkerPos "pzone14");
_pos15 = (getMarkerPos "pzone15");
_pos16 = (getMarkerPos "pzone16");
_pos17 = (getMarkerPos "pzone17");
_pos18 = (getMarkerPos "pzone18");
_pos19 = (getMarkerPos "pzone19");
_pos20 = (getMarkerPos "pzone20");
_pos21 = (getMarkerPos "pzone21");
_pos22 = (getMarkerPos "pzone22");

_pzone1 = "ProtectionZone_Ep1" createVehicle (_pos1);
//following makes it invisible
_pzone1 setObjectTexture [0,"#(argb,8,8,3)color(0,0,0,0,ca)"];


_pzone2 = "ProtectionZone_Ep1" createVehicle (_pos2);
//following makes it invisible
_pzone2 setObjectTexture [0,"#(argb,8,8,3)color(0,0,0,0,ca)"];

_pzone3 = "ProtectionZone_Ep1" createVehicle (_pos3);
//following makes it invisible
_pzone3 setObjectTexture [0,"#(argb,8,8,3)color(0,0,0,0,ca)"];

_pzone4 = "ProtectionZone_Ep1" createVehicle (_pos4);
//following makes it invisible
_pzone4 setObjectTexture [0,"#(argb,8,8,3)color(0,0,0,0,ca)"];

_pzone5 = "ProtectionZone_Ep1" createVehicle (_pos5);
//following makes it invisible
_pzone5 setObjectTexture [0,"#(argb,8,8,3)color(0,0,0,0,ca)"];

_pzone6 = "ProtectionZone_Ep1" createVehicle (_pos6);
//following makes it invisible
_pzone6 setObjectTexture [0,"#(argb,8,8,3)color(0,0,0,0,ca)"];

_pzone7 = "ProtectionZone_Ep1" createVehicle (_pos7);
//following makes it invisible
_pzone7 setObjectTexture [0,"#(argb,8,8,3)color(0,0,0,0,ca)"];

_pzone8 = "ProtectionZone_Ep1" createVehicle (_pos8);
//following makes it invisible
_pzone8 setObjectTexture [0,"#(argb,8,8,3)color(0,0,0,0,ca)"];

_pzone9 = "ProtectionZone_Ep1" createVehicle (_pos9);
//following makes it invisible
_pzone9 setObjectTexture [0,"#(argb,8,8,3)color(0,0,0,0,ca)"];

_pzone10 = "ProtectionZone_Ep1" createVehicle (_pos10);
//following makes it invisible
_pzone10 setObjectTexture [0,"#(argb,8,8,3)color(0,0,0,0,ca)"];

_pzone11 = "ProtectionZone_Ep1" createVehicle (_pos11);
//following makes it invisible
_pzone11 setObjectTexture [0,"#(argb,8,8,3)color(0,0,0,0,ca)"];

_pzone12 = "ProtectionZone_Ep1" createVehicle (_pos12);
//following makes it invisible
_pzone12 setObjectTexture [0,"#(argb,8,8,3)color(0,0,0,0,ca)"];

_pzone13 = "ProtectionZone_Ep1" createVehicle (_pos13);
//following makes it invisible
_pzone13 setObjectTexture [0,"#(argb,8,8,3)color(0,0,0,0,ca)"];

_pzone14 = "ProtectionZone_Ep1" createVehicle (_pos14);
//following makes it invisible
_pzone14 setObjectTexture [0,"#(argb,8,8,3)color(0,0,0,0,ca)"];

_pzone15 = "ProtectionZone_Ep1" createVehicle (_pos15);
//following makes it invisible
_pzone15 setObjectTexture [0,"#(argb,8,8,3)color(0,0,0,0,ca)"];

_pzone16 = "ProtectionZone_Ep1" createVehicle (_pos16);
//following makes it invisible
_pzone16 setObjectTexture [0,"#(argb,8,8,3)color(0,0,0,0,ca)"];

_pzone17 = "ProtectionZone_Ep1" createVehicle (_pos17);
//following makes it invisible
_pzone17 setObjectTexture [0,"#(argb,8,8,3)color(0,0,0,0,ca)"];

_pzone18 = "ProtectionZone_Ep1" createVehicle (_pos18);
//following makes it invisible
_pzone18 setObjectTexture [0,"#(argb,8,8,3)color(0,0,0,0,ca)"];

_pzone19 = "ProtectionZone_Ep1" createVehicle (_pos19);
//following makes it invisible
_pzone19 setObjectTexture [0,"#(argb,8,8,3)color(0,0,0,0,ca)"];

_pzone20 = "ProtectionZone_Ep1" createVehicle (_pos20);
//following makes it invisible
_pzone20 setObjectTexture [0,"#(argb,8,8,3)color(0,0,0,0,ca)"];

_pzone21 = "ProtectionZone_Ep1" createVehicle (_pos21);
//following makes it invisible
_pzone21 setObjectTexture [0,"#(argb,8,8,3)color(0,0,0,0,ca)"];

_pzone22 = "ProtectionZone_Ep1" createVehicle (_pos22);
//following makes it invisible
_pzone22 setObjectTexture [0,"#(argb,8,8,3)color(0,0,0,0,ca)"];

Edited by Holmes

Share this post


Link to post
Share on other sites

I'm sorry to dig this topic up after it's been more than a couple of months, but I am having this same exact problem. For some reason I cannot get this to work on a dedicated server. This is the only thing that protects my base from damage.

protected_zone.sqf

//spawn at markers pzone1 - pzone10
_pzone1 = "ProtectionZone_Ep1" createVehicleLocal (getMarkerPos "pzone1");
_pzone2 = "ProtectionZone_Ep1" createVehicleLocal (getMarkerPos "pzone2");
_pzone3 = "ProtectionZone_Ep1" createVehicleLocal (getMarkerPos "pzone3");
_pzone4 = "ProtectionZone_Ep1" createVehicleLocal (getMarkerPos "pzone4");
_pzone5 = "ProtectionZone_Ep1" createVehicleLocal (getMarkerPos "pzone5");
_pzone6 = "ProtectionZone_Ep1" createVehicleLocal (getMarkerPos "pzone6");
_pzone7 = "ProtectionZone_Ep1" createVehicleLocal (getMarkerPos "pzone7");
_pzone8 = "ProtectionZone_Ep1" createVehicleLocal (getMarkerPos "pzone8");
_pzone9 = "ProtectionZone_Ep1" createVehicleLocal (getMarkerPos "pzone9");
_pzone10 = "ProtectionZone_Ep1" createVehicleLocal (getMarkerPos "pzone10");

//make them invisible to eye
_pzone1 setObjectTexture [0,"#(argb,8,8,3)color(0,0,0,0,ca)"];
_pzone2 setObjectTexture [0,"#(argb,8,8,3)color(0,0,0,0,ca)"];
_pzone3 setObjectTexture [0,"#(argb,8,8,3)color(0,0,0,0,ca)"];
_pzone4 setObjectTexture [0,"#(argb,8,8,3)color(0,0,0,0,ca)"];
_pzone5 setObjectTexture [0,"#(argb,8,8,3)color(0,0,0,0,ca)"];
_pzone6 setObjectTexture [0,"#(argb,8,8,3)color(0,0,0,0,ca)"];
_pzone7 setObjectTexture [0,"#(argb,8,8,3)color(0,0,0,0,ca)"];
_pzone8 setObjectTexture [0,"#(argb,8,8,3)color(0,0,0,0,ca)"];
_pzone9 setObjectTexture [0,"#(argb,8,8,3)color(0,0,0,0,ca)"];
_pzone10 setObjectTexture [0,"#(argb,8,8,3)color(0,0,0,0,ca)"];

For anybody that does not know what this does exactly, it basically prevents any kind of damage from being done within a 50 meter radius of the object. Placing a bunch inside your base, about 25 meters distance apart, will protect your base from anything from bullets and c4, to artillery and plane crashes. Basically it protects your base from idiots.

I read somewhere that it needs to be run on each client, so what would be the best way to do that?

I haven't been able to test this further, but this is what I am guessing...

init.sqf (wrong?):

if (isServer) then {
null = [] execVM "protected_zone.sqf";
};

init.sqf (would one of these be correct?):

[player] execVM "protected_zone.sqf";

[] execVM "protected_zone.sqf";

execVM "protected_zone.sqf";

Edited by A-SUICIDAL

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  

×