maca134
Well-Known Member
What the script does is give the player godmode within the safe zones and also disables weapons.
Create new file called safezone.sqf and paste this:
Then goto your mission.sqm and find the 'Sensors' section and add at the bottom:
(Were ItemN should be like Item10, if the previous sensor is Item9)
The expCond line, the number 75, this is the distance the safezone triggers
Position, is the position on the map
name needs to be unique and pasted into the expcond line.
The you will need to increment the Items=N line again at the top of the sensors section.
Lastly, open init.sqf and add the following
to
If you want to add a marker, you add the following into mission.sqm in the markers section:
Again, you will have to change the relevant bits.
The a and b, set this to the distance set in the sensor, name needs to be unique and set the position to the same as the sensor previously. The you will need to increment the Items=N line again at the top of the markers section.
Hope this help and Im sorry for my poor explanation skill.
BE Filters (Not copy and paste, needs adding to your filters):
Edit:
I have attached the safezone.sqf and my mission.sqm files
Create new file called safezone.sqf and paste this:
Code:
Private ["_EH_Fired"];
if (isNil "inSafezone") then {
inSafezone = false;
};
while {true} do {
waitUntil { inSafeZone };
titleText [format["Entering Safe Zone. Your weapons have been deactivated."],"PLAIN DOWN"]; titleFadeOut 4;
waitUntil { player == vehicle player };
thePlayer = vehicle player;
_EH_Fired = thePlayer addEventHandler ["Fired", {
titleText ["You can not fire your weapon in a safe zone.","PLAIN DOWN"]; titleFadeOut 4;
NearestObject [_this select 0,_this select 4] setPos[0,0,0];
}];
player_zombieCheck = {};
fnc_usec_damageHandler = {};
fnc_usec_unconscious = {};
thePlayer removeAllEventHandlers "handleDamage";
thePlayer addEventHandler ["handleDamage", {false}];
thePlayer allowDamage false;
waitUntil { !inSafeZone };
titleText [format["Exiting Safe Zone. Your weapons have been reactivated."],"PLAIN DOWN"]; titleFadeOut 4;
thePlayer removeEventHandler ["Fired", _EH_Fired];
player_zombieCheck = compile preprocessFileLineNumbers "\z\addons\dayz_code\compile\player_zombieCheck.sqf";
fnc_usec_damageHandler = compile preprocessFileLineNumbers "\z\addons\dayz_code\compile\fn_damageHandler.sqf";
fnc_usec_unconscious = compile preprocessFileLineNumbers "\z\addons\dayz_code\compile\fn_unconscious.sqf";
thePlayer addEventHandler ["handleDamage", {true}];
thePlayer removeAllEventHandlers "handleDamage";
thePlayer allowDamage true;
};
Then goto your mission.sqm and find the 'Sensors' section and add at the bottom:
Code:
class ItemN
{
position[]={4053.8501,364.76645,11668.645};
activationBy="ANY";
repeating=1;
interruptable=1;
age="UNKNOWN";
name="zonebash_safezone";
expCond="(player distance zonebash_safezone) < 75;";
expActiv="inSafeZone = true;";
expDesactiv="inSafeZone = false;";
class Effects
{
};
};
The expCond line, the number 75, this is the distance the safezone triggers
Position, is the position on the map
name needs to be unique and pasted into the expcond line.
The you will need to increment the Items=N line again at the top of the sensors section.
Lastly, open init.sqf and add the following
Code:
[] execVM "safezone.sqf";
Code:
if (!isDedicated) then {
//Conduct map operations
0 fadeSound 0;
waitUntil {!isNil "dayz_loadScreenMsg"};
dayz_loadScreenMsg = (localize "STR_AUTHENTICATING");
//Run the player monitor
_id = player addEventHandler ["Respawn", {_id = [] spawn player_death;}];
_playerMonitor = [] execVM "\z\addons\dayz_code\system\player_monitor.sqf";
[] execVM "safezone.sqf";
};
Code:
class ItemN
{
position[]={4053.8501,364.76645,11668.645};
name="bash_safezone";
text="Safe Zone";
markerType="ELLIPSE";
type="Empty";
colorName="ColorOrange";
a=75;
b=75;
};
The a and b, set this to the distance set in the sensor, name needs to be unique and set the position to the same as the sensor previously. The you will need to increment the Items=N line again at the top of the markers section.
Hope this help and Im sorry for my poor explanation skill.
BE Filters (Not copy and paste, needs adding to your filters):
Code:
5 setDammage !"safezone.sqf","
Edit:
I have attached the safezone.sqf and my mission.sqm files