mirror of
https://github.com/SMVampire/Vamp-Vehicle-Degradation.git
synced 2024-08-30 16:42:11 +00:00
Initial Commit - Version 1
This commit is contained in:
parent
37cee7dfb2
commit
ee71978c81
30
README.md
30
README.md
@ -1,2 +1,28 @@
|
||||
# Vamp-Vehicle-Degredation
|
||||
A script to slowly degrade driven vehicles in Arma 3 Epoch
|
||||
**Vampire's Vehicle Degradation**
|
||||
================
|
||||
A script for Arma 3: Epoch that causes driven vehicles to degrade over time.
|
||||
|
||||
Current Version is v1.0
|
||||
|
||||
--------------------------
|
||||
Installation
|
||||
--------------------------
|
||||
1. Add this line to your init.sqf outside of any brackets:
|
||||
|
||||
```[] ExecVM "VAMP_vehDegrade.sqf";```
|
||||
|
||||
2. Add the file "VAMP_vehDegrade.sqf" to your mission.pbo.
|
||||
|
||||
3. (Optionally) Configure the HitPoints inside of "VAMP_vehDegrade.sqf".
|
||||
|
||||
--------------------------
|
||||
Current Developers
|
||||
--------------------------
|
||||
* Vampire - Developer - http://epochmod.com/forum/index.php?/user/11819-thevampire/
|
||||
|
||||
--------------------------
|
||||
License
|
||||
--------------------------
|
||||
All the code and information provided here is provided under an Attribution Non-Commercial ShareAlike 4.0 Commons License.
|
||||
|
||||
http://creativecommons.org/licenses/by-nc-sa/4.0/
|
||||
|
116
VAMP_vehDegrade.sqf
Normal file
116
VAMP_vehDegrade.sqf
Normal file
@ -0,0 +1,116 @@
|
||||
/* Script written by Vampire (vampuricgaming.net)
|
||||
Idea by KPABATOK & Moist_Pretzels on EpochMod.com */
|
||||
|
||||
if !(isDedicated) then {
|
||||
/* is a Client */
|
||||
VAMP_degradePlayer = player;
|
||||
publicVariableServer "VAMP_degradePlayer";
|
||||
} else {
|
||||
/* is a Server */
|
||||
"VAMP_degradePlayer" addPublicVariableEventHandler {
|
||||
_player = param [1,objNull];
|
||||
|
||||
if (_player isEqualTo objNull) exitWith {};
|
||||
|
||||
[_player] spawn {
|
||||
private ["_player","_blackList","_damPnts"];
|
||||
|
||||
_player = param [0,objNull];
|
||||
|
||||
if (_player isEqualTo objNull) exitWith {};
|
||||
|
||||
/* Add Classnames to Blacklist, Adjust Hit Locations in Damage Points */
|
||||
_blackList = [];
|
||||
_damPnts = [
|
||||
"HitHull","HitGear","HitEngine","HitTransmission","HitLTrack","HitRTrack","HitLFWheel","HitLF2Wheel",
|
||||
"HitRFWheel","HitRF2Wheel","HitLMWheel","HitRMWheel","HitLAileron","HitRAileron","HitLCRudder",
|
||||
"HitLCElevator","HitRElevator","HitHRotor","HitVRotor"
|
||||
];
|
||||
|
||||
while {alive _player} do {
|
||||
uiSleep 60; /* How often we check that they got into a vehicle in seconds */
|
||||
|
||||
/* Check Player in Vehicle and is Vehicle Running and not blacklisted */
|
||||
if ((vehicle _player != _player) && (isEngineOn (vehicle _player)) && !(typeOf _veh in _blackList)) then {
|
||||
/* Player in Vehicle */
|
||||
|
||||
_veh = (vehicle _player);
|
||||
uiSleep 600; /* Time to wait before checking they are still in the same veh - 600 = 10 Minutes */
|
||||
|
||||
/* If Still in Same Vehicle and Engine is On We are gonna presume they've been driving for 10mins */
|
||||
if ((vehicle _player == _veh) && (isEngineOn _veh)) then {
|
||||
/* Slight Damage */
|
||||
switch (true) do {
|
||||
case (_veh isKindOf "Tank"): {
|
||||
{
|
||||
_dam = _veh getHitPointDamage _x;
|
||||
if !(isNil "_dam") then {
|
||||
_hit = _dam;
|
||||
if (_dam < 1) then {
|
||||
_hit = ((random 0.02) + _dam);
|
||||
};
|
||||
if (_x in ["HitHull","HitGear","HitEngine","HitTransmission","HitEngine2","HitEngine3"]) then {
|
||||
/* Engine, Hull, etc should degrade slower */
|
||||
_hit = (0.005 + _dam);
|
||||
};
|
||||
_veh setHitPointDamage [_x, _hit, false];
|
||||
};
|
||||
} forEach _damPnts;
|
||||
};
|
||||
case (_veh isKindOf "Land"): {
|
||||
{
|
||||
_dam = _veh getHitPointDamage _x;
|
||||
if !(isNil "_dam") then {
|
||||
_hit = _dam;
|
||||
if (_dam < 1) then {
|
||||
_hit = ((random 0.02) + _dam);
|
||||
};
|
||||
if (_x in ["HitHull","HitGear","HitEngine","HitTransmission","HitEngine2","HitEngine3"]) then {
|
||||
/* Engine, Hull, etc should degrade slower */
|
||||
_hit = (0.005 + _dam);
|
||||
};
|
||||
_veh setHitPointDamage [_x, _hit, false];
|
||||
};
|
||||
} forEach _damPnts;
|
||||
};
|
||||
case (_veh isKindOf "Air"): {
|
||||
{
|
||||
_dam = _veh getHitPointDamage _x;
|
||||
if !(isNil "_dam") then {
|
||||
_hit = _dam;
|
||||
if (_dam < 1) then {
|
||||
_hit = ((random 0.02) + _dam);
|
||||
};
|
||||
if (_x in ["HitHull","HitGear","HitEngine","HitTransmission","HitEngine2","HitEngine3"]) then {
|
||||
/* Engine, Hull, etc should degrade slower */
|
||||
_hit = (0.005 + _dam);
|
||||
};
|
||||
_veh setHitPointDamage [_x, _hit, false];
|
||||
};
|
||||
} forEach _damPnts;
|
||||
};
|
||||
case (_veh isKindOf "Sea"): {
|
||||
{
|
||||
_dam = _veh getHitPointDamage _x;
|
||||
if !(isNil "_dam") then {
|
||||
_hit = _dam;
|
||||
if (_dam < 1) then {
|
||||
_hit = ((random 0.02) + _dam);
|
||||
};
|
||||
if (_x in ["HitHull","HitGear","HitEngine","HitTransmission","HitEngine2","HitEngine3"]) then {
|
||||
/* Engine, Hull, etc should degrade slower */
|
||||
_hit = (0.005 + _dam);
|
||||
};
|
||||
_veh setHitPointDamage [_x, _hit, false];
|
||||
};
|
||||
} forEach _damPnts;
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
VAMP_degradePlayer = nil;
|
||||
};
|
||||
};
|
Loading…
Reference in New Issue
Block a user