Jump to content

Script Locked Vehicles No Damage?


Shiz

Recommended Posts

Will anyone share with me the setting or script for locked vehicles not to take any damage? Please I would appreciate the help.

 

I am running the R3F heli / towing mod and was able to implement the no towing / lifting of locked vehicles.

 

 

Thanks

Link to comment
Share on other sites

You might be able to do something like this in local_lockUnlock.sqf:

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

if (local _vehicle) then {
	if(_status) then {
		_vehicle setVehicleLock "LOCKED";
vehicle_handleDamage = {};
    vehicle_handleKilled = {};
    (vehicle player) allowDamage false;
    {_x allowdamage false } foreach (nearestObjects [player,['building','LandVehicle','Air'], 400]);
	} else {
		_vehicle setVehicleLock "UNLOCKED";
vehicle_handleDamage = compile preprocessFileLineNumbers "\z\addons\dayz_code\compile\vehicle_handleDamage.sqf";
    vehicle_handleKilled = compile preprocessFileLineNumbers "\z\addons\dayz_code\compile\vehicle_handleKilled.sqf";
    (vehicle player) allowDamage true;
	};
};
Link to comment
Share on other sites

Confirmed Works.. 1st code

if (isNil "fnc_vehicle_handleDamage") then {

fnc_vehicle_handleDamage = vehicle_handleDamage;

};

vehicle_handleDamage = {

private["_unit","_result"];

_unit = _this select 0;

if (locked _unit) exitWith {_unit allowDamage false;};

_unit allowDamage true;

_result = _this call fnc_vehicle_handleDamage;

_result

};

in the init.sqf works like a f*****n charm!

Link to comment
Share on other sites

If you want    LOCKED    vehicles to be invincible you have to add this in your mpmission init.sqf under your compiles:

if (isNil "fnc_vehicle_handleDamage") then {
	fnc_vehicle_handleDamage = vehicle_handleDamage;
};
vehicle_handleDamage = {
	private["_unit","_result"];
	_unit = _this select 0;
	if (locked _unit) exitWith {_unit allowDamage false;};
	_unit allowDamage true;
	_result = _this call fnc_vehicle_handleDamage;
	_result
};

If you want    LOCKABLE    vehicles to be invincible you have to add this in your mpmission init.sqf under your compiles:

if (isNil "fnc_vehicle_handleDamage") then {
	fnc_vehicle_handleDamage = vehicle_handleDamage;
};
vehicle_handleDamage = {
	private["_unit","_result"];
	_unit = _this select 0;
	_id = _unit getVariable ["CharacterID","0"];
	if (_id != "0") exitWith
	{
		_unit allowDamage false;
		if (local _unit) then 
		{
			if (isServer) then
			{
				[_unit, "damage"] call server_updateObject;
			}
			else
			{
				PVDZE_veh_Update = [_unit,"damage"];
				publicVariableServer "PVDZE_veh_Update";
			};
		}
		else
		{
			PVDZE_send = [_unit,"VehHandleDam",_this];
			publicVariableServer "PVDZE_send";
		};
	};
	_unit allowDamage true;
	_result = _this call fnc_vehicle_handleDamage;
	_result
};

For example:

5b27309e39.png

this doesnt work. please help

i used this 

if (isNil "fnc_vehicle_handleDamage") then {
	fnc_vehicle_handleDamage = vehicle_handleDamage;
};
vehicle_handleDamage = {
	private["_unit","_result"];
	_unit = _this select 0;
	if (locked _unit) exitWith {_unit allowDamage false;};
	_unit allowDamage true;
	_result = _this call fnc_vehicle_handleDamage;
	_result
};

but all lockable vehicles are invincible and they take no damage. please help 

Link to comment
Share on other sites

Not sure if this is the proper way to do it but I just added a few lines to the local_lockUnlock.sqf

 

This seems to work for me....

 

private ["_vehicle","_status"];
_vehicle = _this select 0;
_status = _this select 1;
 
if (local _vehicle) then {
if(_status) then {
_vehicle setVehicleLock "LOCKED";
_vehicle setVariable ["R3F_LOG_disabled",true,true];
_vehicle allowDamage false;
_vehicle enableSimulation true;
} else {
_vehicle setVehicleLock "UNLOCKED";
_vehicle setVariable ["R3F_LOG_disabled",false,true];
_vehicle allowDamage true;
 _vehicle enableSimulation true;
};
};
Link to comment
Share on other sites

I would say yes with that code.   I need to dig around to get the code for ifinside veh because I don't want people to be able to do that.

 

_vehicle = vehicle player;
_inVehicle = (_vehicle != player);

 

Is used in selfactions. So maybe like:

if (isNil "fnc_vehicle_handleDamage") then {fnc_vehicle_handleDamage = vehicle_handleDamage;
};
vehicle_handleDamage = {
private["_unit","_result","_vehicle","_inVehicle"];
_unit = _this select 0;
_vehicle = vehicle player;
_inVehicle = (_vehicle != player);
if (locked _unit and !_inVehicle) exitWith {_unit allowDamage false;};
_unit allowDamage true;
_result = _this call fnc_vehicle_handleDamage;
_result
};

Ok this didn't work for me nvm

Link to comment
Share on other sites

couldn't you just add this to your local_lockUnlock.sqf

if you dont have the locked towing protection

 

I would put money on this

 

private ["_vehicle","_status"];
_vehicle = _this select 0;
_status = _this select 1;
 
if (local _vehicle) then {
if(_status) then {
_vehicle setVehicleLock "LOCKED";
_vehicle allowDamage false;
_vehicle enableSimulation true;
} else {
_vehicle setVehicleLock "UNLOCKED";
_vehicle allowDamage true;
        _vehicle enableSimulation true;
};
};
Link to comment
Share on other sites

I've tried a few of these methods without much testing other than hopping on my server and shooting my locked vehicles...  they always take damage.

 

Can anyone confirm what they have tested/working?

when I tested  I had same result  almost gave up and then  tried re-locking vehicle and  then it was in god mode. 

so if its already locked b4 the script was loaded you need to relock it for godmode to take efffect

Link to comment
Share on other sites

Maybe something like this. This won't allow you to lock the vehicle if there is someone inside. Untested.

 

local_lockUnlock.sqf

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 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 removeAllEventHandlers "handleDamage";
                _vehicle addEventHandler ["handleDamage", {true}];
                _vehicle enableSimulation true;
		_vehicle allowDamage true;
		vehicle_handleDamage = compile preprocessFileLineNumbers "\z\addons\dayz_code\compile\vehicle_handleDamage.sqf";
		titleText ["UNLOCKED!","PLAIN DOWN"]; titleFadeOut 4;
		};
	};
Link to comment
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now
  • Advertisement
×
×
  • Create New...