Jump to content

HOW TO: Vehicles indestructible within plot area


BigEgg

Recommended Posts

Allright guys ive tested this and it does not seem to work as it should b, since players can still get vehicles to tow and release them inside of the vehicles and they will explode.(also you can use tanks to blow shit up) instead im using a kinda different solution that does not exits the script but does add a eventhandler to the object so its invulnarable.(hows this word written corectly?)

the code:

/*
        Created exclusively for ArmA2:OA - DayZMod.
        Please request permission to use/alter/distribute from project leader (R4Z0R49) AND the author ([email protected])
*/

/***********************************************************
ASSIGN DAMAGE TO A UNIT.
Called by "HandleDamage" vehicle Event Handler
or by "PVCDZ_veh_SH" PV
or by zombie_attack

- Function fnc_veh_handleDam
- [unit, selectionName, damage, source, projectile, broadcast] call fnc_veh_handleDam;
- return : updated damage for that part
broadcast: boolean. if true, then the request will be sent to all players if the vehicle is not local.
************************************************************/
private["_unit","_selection","_strH","_total","_damage","_needUpdate","_totalDmg"];

_unit = _this select 0;
_selection = _this select 1;
_total = _this select 2;
if (((locked _unit && (count(crew _unit)) == 0) && (count(_unit nearEntities["Plastic_Pole_EP1_DZ", 100]) > 0))) then {
_unit addEventHandler ["HandleDamage", {false}];
_unit enableSimulation false;
}else{



if (_selection != "") then {
	_strH = "hit_" + _selection;
	_totalDmg = false;
} else {
	_strH = "totalDmg";
	_totalDmg = true;
};

if (_total >= 0.98) then {
        _total = 1.0;
};

if (local _unit) then {
	if (_total > 0) then {
		if (!_totalDmg) then {
			_unit setVariable [_strH, _total, true];
		};
		_unit setHit [_selection, _total];

		PVDZ_veh_Save = [_unit,"damage",false,_totalDmg];
		if (!isServer) then {
			publicVariableServer "PVDZ_veh_Save";
		} else {
			PVDZ_veh_Save call server_updateObject;
		};
	};
} else {
	//if ( (count _this > 5) AND {(_this select 5)}) then {
		// vehicle is not local to this client, ask the client which vehicle is local to set damage
		//_this resize 5; // delete "broadcast" boolean
		PVDZ_send = [_unit,"VehHandleDam",_this];
		publicVariableServer "PVDZ_send";
	//};
};

// all "HandleDamage event" functions should return the effective damage that the engine will record for that part
_total
};

would be kinda nice if you could mention this somewhere in your original post :) @BigEgg coz i don´t want to start a different topic just because of this

Link to comment
Share on other sites

I've tried this but it does not work for me.

 

 

Spoiler

if (((locked _unit && (count(crew _unit)) == 0) && (count(_unit nearEntities["Plastic_Pole_EP1_DZ", DZE_PlotPole select 100]) > 0))) exitWith {};

 

What I try is that vehicles closed by the map, within safe zone and plot area are not damaged, But I always have to get in the vehicle for this to happen.(i check safezones and change the path)

Link to comment
Share on other sites

39 minutes ago, S4M said:

I've tried this but it does not work for me.

 

 

  Hide contents


if (((locked _unit && (count(crew _unit)) == 0) && (count(_unit nearEntities["Plastic_Pole_EP1_DZ", DZE_PlotPole select 100]) > 0))) exitWith {};

 

What I try is that vehicles closed by the map, within safe zone and plot area are not damaged, But I always have to get in the vehicle for this to happen.(i check safezones and change the path)

_unit = _this select 0;
_selection = _this select 1;
_total = _this select 2;
if (((locked _unit && (count(crew _unit)) == 0))) then {
_unit addEventHandler ["HandleDamage", {false}];
_unit enableSimulation false;
}else{
_unit addEventHandler ["HandleDamage", {true}];
_unit enableSimulation true;

};

u could try this.

it should make all the vehicles indestructible if they are locked.

@S4M

Link to comment
Share on other sites

These are my files on this subject :

veh_handleDam:

Spoiler

/*
        Created exclusively for ArmA2:OA - DayZMod.
        Please request permission to use/alter/distribute from project leader (R4Z0R49) AND the author ([email protected])
*/

/***********************************************************
ASSIGN DAMAGE TO A UNIT.
Called by "HandleDamage" vehicle Event Handler
or by "PVCDZ_veh_SH" PV
or by zombie_attack

- Function fnc_veh_handleDam
- [unit, selectionName, damage, source, projectile, broadcast] call fnc_veh_handleDam;
- return : updated damage for that part
broadcast: boolean. if true, then the request will be sent to all players if the vehicle is not local.
************************************************************/
private["_unit","_selection","_strH","_total","_damage","_needUpdate","_totalDmg"];

_unit = _this select 0;
_selection = _this select 1;
_total = _this select 2;
if (((locked _unit && (count(crew _unit)) == 0))) then {
_unit addEventHandler ["HandleDamage", {false}];
_unit enableSimulation false;
}else{
_unit addEventHandler ["HandleDamage", {true}];
_unit enableSimulation true;

};

if (_selection != "") then {
    _strH = "hit_" + _selection;
    } else {
            _strH = "totalDmg";
    };

if (_total >= 0.98) then {
        _total = 1.0;
    };

if (local _unit) then {
    if ( _total>0 ) then {
    
            _unit setVariable [_strH,_total,true];
        _unit setHit [_selection, _total];

            if (isServer) then {
                [_unit, "damage"] call server_updateObject;
            } else {
                PVDZE_veh_Update = [_unit,"damage"];
                publicVariableServer "PVDZE_veh_Update";
            };
    };
} else {
    //if ( (count _this > 5) AND {(_this select 5)}) then {
        // vehicle is not local to this client, ask the client which vehicle is local to set damage
        //_this resize 5; // delete "broadcast" boolean
        PVDZ_send = [_unit,"VehHandleDam",_this];
        publicVariableServer "PVDZ_send";
    //};
};

// all "HandleDamage event" functions should return the effective damage that the engine will record for that part
_total

 

local_lockUnlock:

Spoiler

private ["_vehicle","_status"];
_vehicle = _this select 0;
_status = _this select 1;

if (local _vehicle) then {
    if(_status) then {
    if (count crew _vehicle == 0) then {
        _vehicle setVehicleLock "LOCKED";
        _vehicle setVariable ["R3F_LOG_disabled",true,true];
        _vehicle removeAllEventHandlers "handleDamage";
        _vehicle addEventHandler ["handleDamage", {false}];
        _vehicle enableSimulation false;
        _vehicle allowDamage false;
        titleText ["LOCKED! Can not be damaged!","PLAIN DOWN"]; titleFadeOut 4;
    } else {
        titleText ["You can't lock while there is someone inside!","PLAIN DOWN"]; titleFadeOut 4;
        };
    } else {
        _vehicle setVehicleLock "UNLOCKED";
        _vehicle setVariable ["R3F_LOG_disabled",false,true];
        _vehicle removeAllEventHandlers "handleDamage";
        _vehicle addEventHandler ["handleDamage", {true}];
        _vehicle enableSimulation true;
        _vehicle allowDamage true;
        fnc_veh_handleDam = compile preprocessFileLineNumbers "custom\veh_handleDam.sqf";
        titleText ["UNLOCKED!","PLAIN DOWN"]; titleFadeOut 4;
        };
    };

SafeZones:

Spoiler

 


/*
   by: http://infiSTAR.de || http://DayzAntiHack.com
   *updated on 13.12.2016 by juandayz for epoch 1.6 community
    //all credits for infi
    
    Instructions:
    1. Copy paste this pastebin code into a file called SafeZone.sqf - save the file.
    2. Now extract your mpmission pbo and put the SafeZone.sqf into mpmissioms\custom\
    3. Open the init.sqf of the mpmission.
    4. At the bottom of the file add
    [] execVM "custom\safezone.sqf";
    5. Save the init.sqf, repack your mpmission, upload it to your gameserver and restart your server
*/
USE_CANBUILD = false;        // if you don't want to define your own positions
USE_TraderCity = false;    //    if you don't want to define your own positions (Epoch 1.0.5)
USE_POSITIONS = true;    // to use own positions and radius
USE_AI_REMOVER = true;    // use this to remove Missionbots (AI) within 100m of a player if the player is in a SafeZone
USE_AntiSteal = true;    // use this to block opening gear if another player is within 3m!
USE_SPEEDLIMIT = true;    // very secret function, nobody is supposed to find out what it does.
    SPEEDLIMIT = 25;        // Only used if USE_SPEEDLIMIT is true.
USE_SIGNS = false;        // use this to build signs around the SafeZone
LOG_EnterLeave = true;    // This will log to your .rpt when a player enters or leaves a SafeZone! (only works with infiSTAR.de Admintools / AntiHack)
/* You can use USE_CANBUILD or/and (works together) the custom positions below (USE_POSITIONS) [position or zone,radius] */
_infiSZ =
[
    [[6325.6772,7807.7412,0],150,true],//stary
    [[4063.4226,11664.19,0],150,true],//bash
    [[11447.472,11364.504,0],150,true],//klen
    [[1606.6443,7803.5156,0],150,true],//bandit
    [[12944.227,12766.889,0],150,true],//hero
    [[4361.4937,2259.9526,0],50,true],//wholesalerSouth
    [[12060,12640,0],200,true]//air dealear
];

{
    DZE_SafeZonePosArray set [(count DZE_SafeZonePosArray), [(_x select 0), (_x select 1)]];
} forEach _infiSZ;

if (isServer) exitWith


{
    if (USE_SIGNS) then
    {
        {
            _center = _x select 0;
            _radius = _x select 1;
            _lSign = _x select 2;
            if (_lSign) then
            {
                for '_i' from 0 to 360 step (270 / _radius)*2 do
                {
                    _location = [(_center select 0) + ((cos _i) * _radius), (_center select 1) + ((sin _i) * _radius),0];
                    _dir = ((_center select 0) - (_location select 0)) atan2 ((_center select 1) - (_location select 1));
                    _object = createVehicle ['Sign_sphere100cm_EP1', _location, [], 0, 'CAN_COLLIDE'];
                    //    _object = createVehicle ['SignM_FARP_Winchester_EP1', _location, [], 0, 'CAN_COLLIDE'];
                    //    _object setVehicleInit 'this setObjectTexture [0,''Addons\SafeZones\sign.paa''];';
                    _object setDir _dir;
                };
            };
        } forEach _infiSZ;
    };
};
waitUntil {((!isNil 'dayz_animalCheck') || (!isNil 'dayz_medicalH') || (!isNil 'dayz_slowCheck') || (!isNil 'dayz_gui'))};
if (isNil 'inSafeZone') then { inSafeZone = false; } else { if (typename inSafeZone != 'BOOL') then { inSafeZone = false; }; };
[_infiSZ] spawn {
    _infiSZ = _this select 0;
    _startSafeZone =
    {
        if (isNil 'outNow') then
        {
            _msg = 'You entered a Safe Zone!';
            hint _msg;
            taskHint [_msg, [0,1,0,1], 'taskDone'];
            inNow = nil;
            outNow = true;
            
            if (LOG_EnterLeave) then
            {
                PVDZ_send = [player,'SafeZoneState',[1]];
                publicVariableServer 'PVDZ_send';
            };
        };
        player_fired = {
            deleteVehicle (nearestObject [_this select 0,_this select 4]);
            cutText ['You can not fire in a SafeZone!','WHITE IN'];
        };
        //wild_spawnZombies = {};
        zombie_generate = {};
        
        fnc_usec_damageHandler = {};
        player removeAllEventHandlers 'handleDamage';
        player addEventHandler ['handleDamage', {false}];
        player allowDamage false;
        _veh = vehicle player;
        _szs = _veh getVariable ['inSafeZone',0];
        if (_szs == 0) then
        {
            _veh setVariable ['inSafeZone',1,true];
            if (player != _veh) then
            {
                _veh removeAllEventHandlers 'Fired';
                _veh addEventHandler ['Fired', {_this call player_fired;}];
                {
                    _x removeAllEventHandlers 'Fired';
                    _x addEventHandler ['Fired', {_this call player_fired;}];
                } forEach (crew _veh);
                fnc_veh_handleDam = {false};
                _veh removeAllEventHandlers 'HandleDamage';
                _veh addeventhandler ['HandleDamage',{ _this call fnc_veh_handleDam } ];
                _veh allowDamage false;
            };
        };
        _notInSafeZone =
        [
    
            'MAAWS','RPG7V','M136','RPG18','STINGER',
            'MeleeBaseball','MeleeHatchet','MeleeCrowbar','MeleeMachete','MeleeFishingPole','MeleeSledge',
            'MeleeBaseBallBatNails','MeleeBaseBallBatBarbed','MeleeBaseBallBat'
        ];
        _cwep = currentWeapon player;
        if (_cwep in _notInSafeZone) then
        {
            _swep = '';
            {
                if ((getNumber (configFile >> 'CfgWeapons' >> _x >> 'Type')) == 2) exitWith
                {
                    _swep = _x;
                };
            } forEach (weapons player);
            if (_swep == '') then
            {
                player playActionNow 'PutDown';
                _iPos = getPosATL player;
                _radius = 1;
                _removed = ([player,_cwep,1] call BIS_fnc_invRemove);
                if (_removed == 1) then
                {
                    _item = createVehicle ['WeaponHolder', _iPos, [], _radius, 'CAN_COLLIDE'];
                    _item addWeaponCargoGlobal [_cwep,1];
                };
            }
            else
            {
                player selectweapon _swep;
            };
        };
    };
    _endSafeZone =
    {
        if (isNil 'inNow') then
        {
            if (str fnc_usec_damageHandler == '{}') then
            {
                _msg = 'You left the Safe Zone!';
                hint _msg;
                taskHint [_msg, [1,0,0.1,1], 'taskFailed'];
            };
            inNow = true;
            outNow = nil;
            
            if (LOG_EnterLeave) then
            {
                PVDZ_send = [player,'SafeZoneState',[0]];
                publicVariableServer 'PVDZ_send';
            };
        };
        //wild_spawnZombies = compile preprocessFileLineNumbers '\z\addons\dayz_code\compile\wild_spawnZombies.sqf';
        zombie_generate = compile preprocessFileLineNumbers "\z\addons\dayz_code\compile\zombie_generate.sqf";
        //
        
        player_fired = {
            _this call compile preprocessFileLineNumbers '\z\addons\dayz_code\compile\player_fired.sqf';
            _unit = _this select 0;
            _weapon = _this select 1;
            _muzzle = _this select 2;
            _mode = _this select 3;
            _ammo = _this select 4;
            _magazine = _this select 5;
            _projectile = _this select 6;
            _screenToWorld = screenToWorld [0.5,0.5];
            _near = _screenToWorld nearEntities ['AllVehicles',100];
            {
                if (isPlayer _x) then
                {
                    _szs = _x getVariable ['inSafeZone',0];
                    if (_szs == 1) then
                    {
                        deleteVehicle (nearestObject [_unit,_ammo]);
                    };
                };
            } forEach _near;
        };
        
        fnc_usec_unconscious = compile preprocessFileLineNumbers '\z\addons\dayz_code\compile\fn_unconscious.sqf';
        object_monitorGear = compile preprocessFileLineNumbers '\z\addons\dayz_code\compile\object_monitorGear.sqf';
        fnc_veh_handleDam = compile preprocessFileLineNumbers 'custom\veh_handleDam.sqf';
        
        _veh = vehicle player;
        _szs = _veh getVariable ['inSafeZone',0];
        if (_szs == 1) then
        {
            _veh setVariable ['inSafeZone',0,true];
            if (player != _veh) then
            {
                _veh removeAllEventHandlers 'HandleDamage';
                _veh addeventhandler ['HandleDamage',{ _this call fnc_veh_handleDam } ];
                _veh allowDamage true;
            };
        };
        
        _end = false;
        if (isNil 'gmadmin') then
        {
            _end = true;
        }
        else
        {
            if (gmadmin == 0) then
            {
                _end = true;
            };
        };
        if (_end) then
        {
            player allowDamage true;
            fnc_usec_damageHandler = compile preprocessFileLineNumbers '\z\addons\dayz_code\compile\fn_damageHandler.sqf';
            player removeAllEventHandlers 'HandleDamage';
            player addeventhandler ['HandleDamage',{_this call fnc_usec_damageHandler;} ];
        };
    };
    while {1 == 1} do
    {
        if (isNil 'inSafeZone') then { inSafeZone = false; } else { if (typename inSafeZone != 'BOOL') then { inSafeZone = false; }; };
        _state = false;
        if (isNil 'USE_POSITIONS') then { USE_POSITIONS = false; } else { if (typename USE_POSITIONS != 'BOOL') then { USE_POSITIONS = false; }; };
        if (USE_POSITIONS) then
        {
            {
                _z = _x select 0;
                _r = _x select 1;
                if ((vehicle player) distance _z < _r) then {_state = true;};
            } forEach _infiSZ;
        };
        if (isNil 'USE_CANBUILD') then { USE_CANBUILD = true; } else { if (typename USE_CANBUILD != 'BOOL') then { USE_CANBUILD = true; }; };
        if (USE_CANBUILD) then
        {
            if (isNil 'canbuild') then { canbuild = true; } else { if (typename canbuild != 'BOOL') then { canbuild = true; }; };
            if (!canbuild) then {_state = true;};
        };
        if (isNil 'USE_TraderCity') then { USE_TraderCity = true; } else { if (typename USE_TraderCity != 'BOOL') then { USE_TraderCity = true; }; };
        if (USE_TraderCity) then
        {
            if (isNil 'isInTraderCity') then { isInTraderCity = false; } else { if (typename isInTraderCity != 'BOOL') then { isInTraderCity = false; }; };
            if (isInTraderCity) then {_state = true;};
        };
        if (_state) then
        {
            inSafeZone = true;
            call _startSafeZone;
            {
                if (!isNull _x) then
                {
                    if !(isPlayer _x) then
                    {
                        deletevehicle _x;
                    };
                };
            } forEach ((vehicle player) nearEntities ['zZombie_Base',50]);
            
            if (isNil 'USE_AI_REMOVER') then { USE_AI_REMOVER = false; } else { if (typename USE_AI_REMOVER != 'BOOL') then { USE_AI_REMOVER = false; }; };
            if (USE_AI_REMOVER) then
            {
                {
                    if ((!isNull group _x) && (getPlayerUID _x == '')) then
                    {
                        deleteVehicle _x;
                    };
                } forEach (player nearEntities ['Man',100]);
            };
        }
        else
        {
            inSafeZone = false;
        };
        uiSleep 2;
        if (!inSafeZone) then
        {
            call _endSafeZone;
        };
    };
};
if ((USE_AntiSteal) || (USE_SPEEDLIMIT)) then
{
    [] spawn {
        _USE_AntiSteal = USE_AntiSteal;
        _USE_SPEEDLIMIT = USE_SPEEDLIMIT;
        _speedlimit = SPEEDLIMIT;
        while {1 == 1} do
        {
            if (inSafezone) then
            {
                if (_USE_AntiSteal) then
                {
                    _cnt = {isPlayer _x && _x != player} count (player nearEntities [['CAManBase'],4]);
                    if ((_cnt > 0) && (!isNull (findDisplay 106))) then
                    {
                        (findDisplay 106) closedisplay 0;
                        closeDialog 0;closeDialog 0;closeDialog 0;
                        _log = format['%1 You are not allowed to open Gear while near another player!',name player];
                        cutText [_log,'PLAIN'];
                        hint _log;
                    };
                };
                if (_USE_SPEEDLIMIT) then
                {
                    _obj = vehicle player;
                    if !(_obj isKindOf 'Plane') then
                    {
                        _speed = abs speed _obj;
                        if ((_obj != player) && (_speed > _speedlimit)) then
                        {
                            _vel = velocity _obj;
                            _x = 0.8;
                            if (_speed > 50) then {_x = 0.1;};
                            _velNew = [(_vel select 0) * _x, (_vel select 1) * _x,(_vel select 2) * _x];
                            _obj SetVelocity _velNew;
                        };
                    };
                };
            }
            else
            {
                uiSleep 2;
            };
            uiSleep .01;
        };
    };
};

 

 

 

Link to comment
Share on other sites

u don´t need the lock/unlock.sqf if u use my veh_damagehandler.

also there should be nothing wrong with the safezones

Spoiler

/*
        Created exclusively for ArmA2:OA - DayZMod.
        Please request permission to use/alter/distribute from project leader (R4Z0R49) AND the author ([email protected])
*/

/***********************************************************
ASSIGN DAMAGE TO A UNIT.
Called by "HandleDamage" vehicle Event Handler
or by "PVCDZ_veh_SH" PV
or by zombie_attack

- Function fnc_veh_handleDam
- [unit, selectionName, damage, source, projectile, broadcast] call fnc_veh_handleDam;
- return : updated damage for that part
broadcast: boolean. if true, then the request will be sent to all players if the vehicle is not local.
************************************************************/
private["_unit","_selection","_strH","_total","_damage","_needUpdate","_totalDmg"];

_unit = _this select 0;
_selection = _this select 1;
_total = _this select 2;
if (((locked _unit && (count(crew _unit)) == 0))) then {
_unit addEventHandler ["HandleDamage", {false}];
_unit enableSimulation false;
}else{
_unit addEventHandler ["HandleDamage", {true}];
_unit enableSimulation true;

};

if (_selection != "") then {
	_strH = "hit_" + _selection;
	_totalDmg = false;
} else {
	_strH = "totalDmg";
	_totalDmg = true;
};

if (_total >= 0.98) then {
        _total = 1.0;
};

if (local _unit) then {
	if (_total > 0) then {
		if (!_totalDmg) then {
			_unit setVariable [_strH, _total, true];
		};
		_unit setHit [_selection, _total];

		PVDZ_veh_Save = [_unit,"damage",false,_totalDmg];
		if (!isServer) then {
			publicVariableServer "PVDZ_veh_Save";
		} else {
			PVDZ_veh_Save call server_updateObject;
		};
	};
} else {
	//if ( (count _this > 5) AND {(_this select 5)}) then {
		// vehicle is not local to this client, ask the client which vehicle is local to set damage
		//_this resize 5; // delete "broadcast" boolean
		PVDZ_send = [_unit,"VehHandleDam",_this];
		publicVariableServer "PVDZ_send";
	//};
};

// all "HandleDamage event" functions should return the effective damage that the engine will record for that part
_total

 

 

Link to comment
Share on other sites

37 minutes ago, Cherdenko said:

u don´t need the lock/unlock.sqf if u use my veh_damagehandler.

also there should be nothing wrong with the safezones

  Reveal hidden contents


/*
        Created exclusively for ArmA2:OA - DayZMod.
        Please request permission to use/alter/distribute from project leader (R4Z0R49) AND the author ([email protected])
*/

/***********************************************************
ASSIGN DAMAGE TO A UNIT.
Called by "HandleDamage" vehicle Event Handler
or by "PVCDZ_veh_SH" PV
or by zombie_attack

- Function fnc_veh_handleDam
- [unit, selectionName, damage, source, projectile, broadcast] call fnc_veh_handleDam;
- return : updated damage for that part
broadcast: boolean. if true, then the request will be sent to all players if the vehicle is not local.
************************************************************/
private["_unit","_selection","_strH","_total","_damage","_needUpdate","_totalDmg"];

_unit = _this select 0;
_selection = _this select 1;
_total = _this select 2;
if (((locked _unit && (count(crew _unit)) == 0))) then {
_unit addEventHandler ["HandleDamage", {false}];
_unit enableSimulation false;
}else{
_unit addEventHandler ["HandleDamage", {true}];
_unit enableSimulation true;

};

if (_selection != "") then {
	_strH = "hit_" + _selection;
	_totalDmg = false;
} else {
	_strH = "totalDmg";
	_totalDmg = true;
};

if (_total >= 0.98) then {
        _total = 1.0;
};

if (local _unit) then {
	if (_total > 0) then {
		if (!_totalDmg) then {
			_unit setVariable [_strH, _total, true];
		};
		_unit setHit [_selection, _total];

		PVDZ_veh_Save = [_unit,"damage",false,_totalDmg];
		if (!isServer) then {
			publicVariableServer "PVDZ_veh_Save";
		} else {
			PVDZ_veh_Save call server_updateObject;
		};
	};
} else {
	//if ( (count _this > 5) AND {(_this select 5)}) then {
		// vehicle is not local to this client, ask the client which vehicle is local to set damage
		//_this resize 5; // delete "broadcast" boolean
		PVDZ_send = [_unit,"VehHandleDam",_this];
		publicVariableServer "PVDZ_send";
	//};
};

// all "HandleDamage event" functions should return the effective damage that the engine will record for that part
_total

 

 

I did this and the same thing happens to me, I have to get in the driver's seat to take effect :sad:I'm sorry for my English

Link to comment
Share on other sites

Look this is

Spoiler

if (isServer) then {
    diag_log "Loading custom server compiles";    
};

if (!isDedicated) then {
    diag_log "Loading custom client compiles";
    
    fnc_usec_selfactions = compile preprocessFileLineNumbers "dayz_code\compile\fn_selfActions.sqf";
    player_humanityMorph = compile preprocessFileLineNumbers "dayz_code\compile\player_humanityMorph.sqf"; // This line can be removed when Epoch 1.0.6.2 comes out.
    compile preprocessFileLineNumbers "overwrites\click_actions\init.sqf";
    fnc_veh_handleDam = compile preprocessFileLineNumbers "custom\veh_handleDam.sqf";
    
    //cold
    player_temp_calculation = compile preprocessFileLineNumbers "custom\fn_temperatur.sqf";

};

 

Link to comment
Share on other sites


if (isServer) then {
    diag_log "Loading custom server compiles";    
};

if (!isDedicated) then {
    diag_log "Loading custom client compiles";
    
    fnc_usec_selfactions = compile preprocessFileLineNumbers "dayz_code\compile\fn_selfActions.sqf";
    player_humanityMorph = compile preprocessFileLineNumbers "dayz_code\compile\player_humanityMorph.sqf"; // This line can be removed when Epoch 1.0.6.2 comes out.
    compile preprocessFileLineNumbers "overwrites\click_actions\init.sqf";
    
    //cold
    player_temp_calculation = compile preprocessFileLineNumbers "custom\fn_temperatur.sqf";

};
    fnc_veh_handleDam = compile preprocessFileLineNumbers "custom\veh_handleDam.sqf"; //belongs here not in the section above

 

Link to comment
Share on other sites

You shouldn't need to add an eventhandler to the object. The script merely checks to see if the vehicle is near a plot and if it's locked and the vehicle has no crew, and if it finds that, it just exits the damage applying script. Don't see how adding a damage handler changes anything.

Link to comment
Share on other sites

5 hours ago, BigEgg said:

You shouldn't need to add an eventhandler to the object. The script merely checks to see if the vehicle is near a plot and if it's locked and the vehicle has no crew, and if it finds that, it just exits the damage applying script. Don't see how adding a damage handler changes anything.

well it seemed to work on my server so i posted it,

as  player(very creative players i have to admit that) towed a bus and untowed it in other vehicles and they exploded.

thats why i created this new way

Link to comment
Share on other sites

  • 1 month later...
  • 1 month later...

So I'm having this issue, Locked vehicles no matter where they are on the map even outside plots, as long as no one gets in them are Auto-healing anytime they take damage. I tested by shooting a locked ural with a DMR and as I shot the tires they keep healing. How do I fix this so Only vehicles on plot have god like the script says? Here is my veh_handledamage.sqf

private["_unit","_selection","_strH","_total","_damage","_needUpdate","_totalDmg","_state"];

//***Zupa Config ****//

_godmodeVechilesEverywhere = false; // Godmode on all locked vehicles
_onlyLockedVehicles = true; //Plotarea: Godmode for Only locked vehicles (true) or locked and unlocked(false)
_onlyVehicleWithoutGear = true; // Only godmode on vehicles that hold no gear.
_safeZoneGodVehicle = false; // Godmode vehicles in safezones. (or specific zone's)
_donatorsPlots = false; // True = only godmode vehicles for donaters in the list, False = godmode for every guy.
_plotDonators = ["0"]; // PUID's of poeple who donated for plotpole

// Chernarus safezone area's - change these to other coordinates for other maps. ( You can also add specific locations on the map.
_safezones = [
    [[11806.7,12688.7],50,"Air"],
    [[1606.6443,7803.5156],50,"Bandit"],
    [[4063.4226,11664.19],50,"Bash"],
    [[11397.4,5513.73],20,"Msta"],
    [[11447.472,11364.504],50,"Klen"],
    [[4762.63,6267.55],50,"Pog"] // [[x,y],distance,"just name"]
];
//***END Config ****//
_unit = _this select 0;
_selection = _this select 1;
_total = _this select 2;
if (((locked _unit && (count(crew _unit)) == 0) && (count(_unit nearEntities["Plastic_Pole_EP1_DZ", DZE_PlotPole select 0]) > 0))) exitWith {};
_state = true;
_HPBefore = -1;

if (_selection != "") then {
_strH = "hit_" + _selection;
_HPBefore = [_unit,_strH] call object_getHit;


    _totalDmg = false;
} else {
_strH = "totalDmg";
_totalDmg = true;
_HPBefore = getDammage _unit;

};

if(_total > _HPBefore)then{

if((locked _unit && _godmodeVechilesEverywhere  && (count (crew _unit)) < 1))then{_state = false;
};

if(_state)then{
if(_safeZoneGodVehicle )then{
{if ((_unit distance (_x select 0)) < (_x select 1)) then {_state = false;
};} forEach _safezones;
};
};

if(_state)then{
_gearCount = 0;
if(_onlyVehicleWithoutGear)then{
};
_plots = nearestObjects [_unit, ["Plastic_Pole_EP1_DZ"], DZE_PlotPole select 0];    
if((count(_plots) > 0))then{        
    _thePlot = _plots select 0;
    _plotOwner = _thePlot getVariable ["ownerPUID",0];
if ( (_gearCount == 0) &&(locked _unit || !(_onlyLockedVehicles) ) && (count (crew _unit)) < 1 && (  !(_donatorsPlots) || (_plotOwner in _plotDonators))) then {_state = false;

};
};
};

}; //fix
if(_state)then{


if (_total >= 0.98) then {
        _total = 1.0;
};


if (local _unit) then {
if (_total > 0) then {


        if (!_totalDmg) then {
_unit setVariable [_strH, _total, true];
        };
_unit setHit [_selection, _total];


        PVDZ_veh_Save = [_unit,"damage",false,_totalDmg];
if (isServer) then {

            publicVariableServer "PVDZ_veh_Save";
} else {
PVDZ_veh_Save call server_updateObject;

};
};
} else {
// vehicle is not local to this client, ask the client which vehicle is local to set damage
/* PVS/PVC - Skaronator */
PVDZ_send = [_unit,"VehHandleDam",_this];
publicVariableServer "PVDZ_send";
};


}else{
_total = _HPBefore;
};
// all "HandleDamage event" functions should return the effective damage that the engine will record for that part


_total

Link to comment
Share on other sites

  • 4 months later...
Guest
This topic is now closed to further replies.
  • Advertisement
  • Discord

×
×
  • Create New...