Follow along with the video below to see how to install our site as a web app on your home screen.
Note: This feature may not be available in some browsers.
greetings, sorry TorZar, i had no time to answer your pm last dayz -.-
can you explain what is happening when you veh leaves the trigger, still no damage handling and allowdamage false ?
is this triggered on local or server side ?
_BaseTrigger1 setTriggerStatements["{_x isKindOf 'AllVehicles'} count thisList > 0","{_x removeEventHandler ['Killed', 0]; _x removeEventHandler ['HandleDamage', 0]; _x allowDamage false;} foreach thisList;","{_this spawn vehicle_handleDamage; ; _this spawn vehicle_handleKilled; _x allowDamage true;} foreach thisList;"]; //FAIL
_BaseTrigger1 setTriggerStatements["{_x iskindof 'LandVehicle' || _x isKindOf 'Air'} count thislist > 0","_this removeEventHandler ['Killed', 0]; _this removeEventHandler ['HandleDamage', 0]; _this allowDamage false;","_this addEventHandler ['Killed', { _this call vehicle_handleKilled }]; _this addEventHandler ['HandleDamage', { _this call vehicle_handleDamage }]; _this allowDamage true;"]; //FAIL
_BaseTrigger1 setTriggerStatements["{_x iskindof 'LandVehicle' || _x isKindOf 'air'} count thislist > 0","_this removeEventHandler ['Killed', 0]; _this removeEventHandler ['HandleDamage', 0]; _this allowDamage false;","_x addEventHandler ['Killed', { _x call vehicle_handleKilled }]; _x addEventHandler ['HandleDamage', { _x call vehicle_handleDamage }]; _this allowDamage true;"]; //FAIL
_BaseTrigger1 setTriggerStatements["{_x iskindof 'LandVehicle' || _x isKindOf 'Air'} count thislist > 0","_this removeEventHandler ['Killed', 0]; _this removeEventHandler ['HandleDamage', 0]; _this allowDamage false;","{_x setVariable["vehicle_handleDamage","\z\addons\dayz_code\compile\vehicle_handleDamage.sqf",true]; _x setVariable["vehicle_handleKilled","\z\addons\dayz_code\compile\vehicle_handleKilled.sqf",true];} forEach thisList; _this allowDamage true;"]; //FAIL
Still workin on this here and there. Just getting a couple other projects outa the way
Just to let you know, I've already built the safe zone in Panthera(Not an easy task, with so many hills and slopes and Arma engine being finicky at its best). The server is currently closed as I add the finishing touches.
US 947 DayZ Private Hive
173.192.200.117:3204
If you want access pm me for the password.
No, I don't have the same scripting knowledge as TorZar does. I simply built the area where the script will be used. I'm waiting for him to release the script so the safe zone can really be...a safe zoneDid you manage to enable safe zones by humanity levels or just overall immunity for anyone in that location?
i tested it with this code :
Code:_args = _this; if(!isNull _args) then { _args setVehicleInit "this allowDamage true"; processInitCommands; };
and runs great for veh's and players
if(isServer) then {
[FONT=Consolas] "triggerDamageOff" addPublicVariableEventHandler {
private ["_args"];
_args = _this select 1; //_this = the val of "triggerDamageOff"
diag_log format["Server: Damage Off for %1",_args];
_args setVehicleInit "this allowDamage false";
processInitCommands;
};
"triggerDamageOn" addPublicVariableEventHandler {
private ["_args"];
_args = _this select 1; //_this = the val of "triggerDamageOff"
diag_log format["Server: Damage On for %1",_args];
_args setVehicleInit "this allowDamage true";
processInitCommands;
}; [/FONT]
};
triggerDamageOff= vehicle player;
publicVariableServer "triggerDamageOff";
_radius = 100; //shield range
_enemy_Base = "ColorRed"; //set enemy color
_friendly_Base = "ColorGreen"; //set friendly color
// creating array with available shields
_Baseshields = [];
{
_Baseshields set [count _Baseshields,_x];
} forEach (allMissionObjects "Sign_Checkpoint"); //this is my base shield ;)
if ((count _Baseshields) < 1) exitwith {}; // no shields = no need to run this script
waitUntil {{!isNull(_x) && ((getPosATL(_x) distance [0,0,0]) > 100)} count _Baseshields == count _Baseshields};
{
_unit = _x;
_ShieldID = parseNumber(_unit getVariable["ObjectID","0"]); //get Object ID (located in the Database of my Custom Hive)
_playerbaseID = player getVariable["BaseID",-1]; //get Player BaseID (located in the Database of my Custom Hive)
//create local Markers (green = friendly base, red = enemy base)
_markerName = format["Base_zone_%1",_ShieldID];
deleteMarkerLocal _markerName;
_marker = createMarkerLocal [_markerName, getPosATL _unit];
_markerName setMarkerShapeLocal "ELLIPSE";
if (_ShieldID == _playerbaseID) then
{
_markerName setMarkerColorLocal _friendly_Base;
} else {
_markerName setMarkerColorLocal _enemy_Base;
};
_markerName setMarkerSizeLocal [_radius, _radius];
_markerName setMarkerBrushLocal "Border";
_markerName setMarkerAlphaLocal 0.5;
_markerName = format["marker_base_desc_%1",_ShieldID];
deleteMarkerLocal _markerName;
_pos = getPosATL _unit;
_pos set [1, (_pos select 1) - (round(_radius / 2))];
_marker = createMarkerLocal [_markerName, _pos];
_markerName setMarkerShapeLocal "ICON";
_markerName setMarkerTypeLocal "mil_dot";
_markerName setMarkerSizeLocal [1.8,1.8];
if (_ShieldID == _playerbaseID) then {
_markerName setMarkerColorLocal _friendly_Base;
_markerName setMarkerTextLocal "This is Your Base";
} else {
_markerName setMarkerColorLocal _enemy_Base;
_markerName setMarkerTextLocal "This is an Enemy Base";
};
_markerName setMarkerAlphaLocal 0.5;
} forEach _Baseshields;
// Switch
if (isNil "activateBaseShields") then {
activateBaseShields = true;
} else {
activateBaseShields = !activateBaseShields;
};
// one Loop per sec
while {activateBaseShields} do {
private["_ShieldID","_unit","_playerbaseID","_positionPlayer","_setNewPos","_isAdmin","_nearShield"];
_nearShield = (getPosATL vehicle player) nearEntities ["Sign_Checkpoint",_radius];
if((count _nearShield) > 0) then {
{
_unit = _x;
_ShieldID = parseNumber(_unit getVariable["ObjectID","0"]); //get Object ID (located in the Database of my Custom Hive)
_playerbaseID = player getVariable["BaseID",-1]; //get Player BaseID (located in the Database of my Custom Hive)
_isAdmin = player getVariable["isAdmin",false];
if (_isAdmin) exitWith{}; //i'm sure there is no need to explain this ;p
if(_ShieldID == _playerbaseID) exitWith { //if this is players base disable damage and exit 'forEach _Baseshields'
if (vehicle player getVariable["allowDamage",true]) then { //check damage state
triggerDamageOff = vehicle player;
publicVariable "triggerDamageOff";
vehicle player setVariable["allowDamage",false,true]; //set object variable to check damage state
cutText ["AllowDamage: " + str(typeOf vehicle player) + " = " + str(vehicle player getVariable "allowDamage"), "PLAIN DOWN"]; //debug hints
};
};
_directionto = [_unit, vehicle player] call BIS_fnc_dirTo; //BIS Function to get the direction to the Object entering the Zone
if(_directionto < 0) then {_directionto = _directionto + 360}; //negative direction to positive
_positionPlayer = getposATL vehicle player;
_setNewPos = [getposATL _unit,_directionto,(_radius + 1),true] call FindPosition; //Custom Script to find the Position outside the Zone in direction of the entering Object
_setNewPos set [2,(_positionPlayer select 2)]; //adding height
//cutText ["Enemy Base: " + str(_ShieldID) + " PlayerBaseID: " + str(_playerbaseID) + " DirectionTo: " + str(_directionto) + " NewPos: " +str(_setNewPos), "PLAIN DOWN"];
cutText ["The Baseshield of this Enemy Base is stronger then you! >_<", "PLAIN DOWN"]; //Info to player
vehicle player setPos _setNewPos; //kick out not allowed player or vehicle the player is in
// Check for Damage is allowed
if (!(vehicle player getVariable["allowDamage",false])) then { //check damage state
triggerDamageOn = vehicle player;
publicVariable "triggerDamageOn";
vehicle player setVariable["allowDamage",true,true]; //set object variable to check damage state
cutText ["AllowDamage: " + str(typeOf vehicle player) + " = " + str(vehicle player getVariable "allowDamage"), "PLAIN DOWN"]; //debug hints
};
}forEach _nearShield;
}else {
// allow Damage if player leaves the zone
if (!(vehicle player getVariable["allowDamage",false])) then { //check damage state
triggerDamageOn = vehicle player;
publicVariable "triggerDamageOn";
vehicle player setVariable["allowDamage",true,true]; //set object variable to check damage state
cutText ["AllowDamage: " + str(typeOf vehicle player) + " = " + str(vehicle player getVariable "allowDamage"), "PLAIN DOWN"]; //debug hints
};
};
sleep 1;
};