Jump to content

[RELEASE] Vehicle Godmode in Plotpoles & Safezones & Everywhere Locked 2.0


Zupa

Recommended Posts

Can someone test this for me? i wont be on anarma pc in 7 hours.

 

So the normal shizzle +

 

compiles:

fnc_usec_damageVehicle =		compile preprocessFileLineNumbers "\z\addons\dayz_code\compile\fn_damageHandlerVehicle.sqf";		//Event handler run on damage

to

fnc_usec_damageVehicle =		compile preprocessFileLineNumbers "custom\fn_damageHandlerVehicle.sqf";		//Event handler run on damage

then make "fn_damageHandlerVehicle.sqf" iin a folder "custom":  !!!!!!!!!!!!!!!! Change the config to the same as your other damage handler !!!!!!!!!!! Will make this universal later

scriptName "Functions\misc\fn_damageHandler.sqf";
/***********************************************************
	PROCESS DAMAGE TO A UNIT
	- Function
	- [unit, selectionName, damage, source, projectile] call fnc_usec_damageHandler;
************************************************************/
private ["_unit","_hit","_damage","_total"];
_unit = _this select 0;
_hit = _this select 1;
_damage = _this select 2;
//_source = _this select 3;
//_ammo = _this select 4;
_total = _damage;
_state = true;

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

_godmodeVechilesEverywhere = false; // Godmode on all locked vehicles
_onlyLockedVehicles = true; //Plotarea: Godmode for Only locked vehicles (true) or locked and unlocked(false)
_safeZoneGodVehicle = true; // Godmode vehicles in safezones. (or specific zone's)

// donator plotpole only works with PLOT FOR LIFE, set FALSE if you dont have it.
_donatorsPlots = false; // True = only godmode vehicles for donaters in the list, False = godmode for every guy.
_plotDonators = ["76561198101253426","505"]; // 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 = [ 
    [[5070.75,9729.54],100,"Air"],
    [[1606.6443,7803.5156],100,"Bandit"],
    [[4063.4226,11664.19],100,"Bash"],
    [[12944.227,12766.889],100,"Hero"],
    [[11447.472,11364.504],100,"Klen"],
    [[6315.88,7791.3],100,"Stary"] // [[x,y],distance,"just name"]
];

//***END Config ****//


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

systemChat "locked or all";
};

if(_state)then{
if(_safeZoneGodVehicle )then{
{if ((_unit distance (_x select 0)) < 120) then {_state = false;
systemChat "safezone";
};} forEach _safezones;
};
};


if(_state)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 ((locked _unit || !(_onlyLockedVehicles) ) && (count (crew _unit)) < 1 && (  !(_donatorsPlots) || (_plotOwner in _plotDonators))) then {_state = false;
systemChat "plot";
};
};
};



//diag_log ("DAMAGE VEH: " + typeof(_unit) + " / " + str(_hit) + " / " + str(_damage) + " / " + str(getDammage _unit));

if (local _unit && _state) then {
	_total = [_unit,_hit,_damage] call object_setHitServer;
};
_total
Link to comment
Share on other sites

 

Can someone test this for me? i wont be on anarma pc in 7 hours.

 

So the normal shizzle +

 

compiles:

fnc_usec_damageVehicle =		compile preprocessFileLineNumbers "\z\addons\dayz_code\compile\fn_damageHandlerVehicle.sqf";		//Event handler run on damage

to

fnc_usec_damageVehicle =		compile preprocessFileLineNumbers "custom\fn_damageHandlerVehicle.sqf";		//Event handler run on damage

then make "fn_damageHandlerVehicle.sqf" iin a folder "custom":  !!!!!!!!!!!!!!!! Change the config to the same as your other damage handler !!!!!!!!!!! Will make this universal later

scriptName "Functions\misc\fn_damageHandler.sqf";
/***********************************************************
	PROCESS DAMAGE TO A UNIT
	- Function
	- [unit, selectionName, damage, source, projectile] call fnc_usec_damageHandler;
************************************************************/
private ["_unit","_hit","_damage","_total"];
_unit = _this select 0;
_hit = _this select 1;
_damage = _this select 2;
//_source = _this select 3;
//_ammo = _this select 4;
_total = _damage;
_state = true;

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

_godmodeVechilesEverywhere = false; // Godmode on all locked vehicles
_onlyLockedVehicles = true; //Plotarea: Godmode for Only locked vehicles (true) or locked and unlocked(false)
_safeZoneGodVehicle = true; // Godmode vehicles in safezones. (or specific zone's)

// donator plotpole only works with PLOT FOR LIFE, set FALSE if you dont have it.
_donatorsPlots = false; // True = only godmode vehicles for donaters in the list, False = godmode for every guy.
_plotDonators = ["76561198101253426","505"]; // 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 = [ 
    [[5070.75,9729.54],100,"Air"],
    [[1606.6443,7803.5156],100,"Bandit"],
    [[4063.4226,11664.19],100,"Bash"],
    [[12944.227,12766.889],100,"Hero"],
    [[11447.472,11364.504],100,"Klen"],
    [[6315.88,7791.3],100,"Stary"] // [[x,y],distance,"just name"]
];

//***END Config ****//


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

systemChat "locked or all";
};

if(_state)then{
if(_safeZoneGodVehicle )then{
{if ((_unit distance (_x select 0)) < 120) then {_state = false;
systemChat "safezone";
};} forEach _safezones;
};
};


if(_state)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 ((locked _unit || !(_onlyLockedVehicles) ) && (count (crew _unit)) < 1 && (  !(_donatorsPlots) || (_plotOwner in _plotDonators))) then {_state = false;
systemChat "plot";
};
};
};



//diag_log ("DAMAGE VEH: " + typeof(_unit) + " / " + str(_hit) + " / " + str(_damage) + " / " + str(getDammage _unit));

if (local _unit && _state) then {
	_total = [_unit,_hit,_damage] call object_setHitServer;
};
_total

Tested that, no change.

Link to comment
Share on other sites

Tested that, no change.

 

Try the following, it will be like a dafuq, didnt i think of that earlier solution=

 

take the 2 compile lines =

fnc_usec_damageVehicle =		compile preprocessFileLineNumbers "custom\fn_damageHandlerVehicle.sqf";		//Event handler run on damage
vehicle_handleDamage = compile preprocessFileLineNumbers "custom\vehicle_handleDamage.sqf";

and place them on the bottom of the compiles, right above the 

initialized = true;
Link to comment
Share on other sites

Edited: Disregard. I didn't see the configs in each file. Set them both the same and seems to be working fine so far. Will continue testing.... thanks!

 

------original post below---------------

 

You're getting there.... After restart, locked vehicle in plot zone takes no damage. Unlocked and drove vehicle outside plotzone and locked it... still takes no damage. Unlocked it... takes damage. Drove back into plotzone and locked it... takes no damage. Unlocked it... takes damage.

 

So it's still indestructible after leaving the plotzone and locked again. Locked vehicles outside the plotzone after server restart take damage as intended.

Link to comment
Share on other sites

Put this in tonight.  Seems to be working really well.  I'm so bummed I spent about 4 hours trying to get a plot pole for life working as I love the idea of intergrating the two, however in the end I just couldn't get it working.  Something to do with snap building vectors and PPFL, but I couldn't get my head around it.

 

Thanks for this script Zupa.  It will def stop alot of griefing.

Link to comment
Share on other sites

With new script i have to add the new and not replace this old lines?

fnc_usec_damageVehicle =		compile preprocessFileLineNumbers "\z\addons\dayz_code\compile\fn_damageHandlerVehicle.sqf";		//Event handler run on damage
vehicle_handleDamage    = 		compile preprocessFileLineNumbers "\z\addons\dayz_code\compile\vehicle_handleDamage.sqf";

So all 4 lines are in compiles.sqf ?

 

Add or replace? ^^

 

If i dont replace it will use the day_code files and custom files simultaneously? oO I'm confused :D

Link to comment
Share on other sites

I tested this with Heli's and it seems to be working fine?

Hmm... not sure what I've done wrong then lol. The only changes I made to the files were for the coords (Tavi vs. Cherno) but while running a car into a car works fine (no damage to either vehicle), for some reason running a car into a heli causes damage to the heli only. I'll try re-installing, see if that helps.

Thanks :)

Link to comment
Share on other sites

Edit// Okay seems like I got it working actually. Files didn't have same config settings. But the safe-zone area detection is still slightly off.

If anyone wants vehicle god-mode to be activated in the actual area not just 120 meters around given coordinates then do this:

 

Find:

{if ((_unit distance (_x select 0)) < 120) then {_state = false;

Replace it with:

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

And do this for both files.

 

 

So now when you look at your array:

[[6315.88,7791.3],100,"Stary"]

The "100" there is the radius of the safe zone and that's the area where vehicle godmode is now active.

 

 

Edit// Zupa has now edited the first post, no need to do this anymore ^

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
×
×
  • Create New...