Origins Vehicle Upgrades

what it does?
This is the vehicle upgrade Script from the Origins Mod for the Origins Vehicles.
Note: This version lets you upgrade everything with one scrap metal. I will release and update soon where you can decide what materials and tools are required for each upgrade.
Also, since i dont have too much time on scripting, this version will be without trader support and is only for Origins Mod 1.7.9! This also will be covered in the next update, or till someone else tried to get this done, but till then this version is only for spawned vehicles through database!
What you need?
files:
variables
compiles
fn_selfactions
object_setFixServer
server_monitor
server_updateObject
server_publishVehicle
I'm not very good at making noob frienldy tutorials and I assume you know how to merge files or redirect them.
Lets Start:
Mission FIles:
variables.sqf
search for
Code:
// update objects
Code:
Ori_VehiclesList = ["ori_ScrapBuggy","ori_survivorBus","ori_vil_lada_2105_rust","ori_poldek_black","ori_poldek","ori_rth_originsmod_bathmobile","ori_transit","ori_vil_originsmod_lublin_truck","ori_vil_originsmod_truck_civ","ori_vil_originsmod_truck_civ","ori_originsmod_pickupoldfuel","ori_p85_originsmod_cucv_pickup","ori_originsmod_pickupold"];
Ori_VehicleUpgrades = ["pluhPredni","kolaOchrana","oknaOchrana","predniOknoOchrana"];
compiles.sqf
redirect:
Code:
object_setFixServer
Code:
private ["_unit","_selection","_strH","_damage","_upgrades"];
_unit = _this select 0;
_selection = _this select 1;
_damage = _this select 2;
if (_selection != "" && local _unit) then {
if (_selection in Ori_VehicleUpgrades) then {
_unit setVariable [_selection,_damage,true];
PVDZE_veh_Update = [_unit,"repair"];
} else {
_strH = "hit_" + (_selection);
_unit setHit[_selection,_damage];
_unit setVariable [_strH,_damage,true];
if (_damage == 0) then {
PVDZE_veh_Update = [_unit,"repair"];
} else {
PVDZE_veh_Update = [_unit,"damage"];
};
};
if (isServer) then {
PVDZE_veh_Update call server_updateObject;
} else {
publicVariableServer "PVDZE_veh_Update";
};
};
search for:
Code:
s_player_repairActions set [count s_player_repairActions,_menu1];
Code:
if (_typeOfCursorTarget in Ori_VehiclesList) then {
_cfg = configFile >> "CfgVehicles" >> _typeOfCursorTarget >> "AnimationSources";
_tc = count _cfg;
_part = "ItemArmor3";
for "_mti" from 0 to _tc-1 do {
_mt = (_cfg select _mti);
_st = configName(_mt);
_anim_array = Ori_VehicleUpgrades;
if (_st in _anim_array) then {
_statuss = _cursorTarget getVariable [_st,1];
if (_statuss == 1) then {
_num = _anim_array find _st;
_upgrade = _anim_array select _num;
_upgradeName = "";
switch _upgrade do {
case "pluhPredni" : {_upgradeName = "Front Plow";};
case "kolaOchrana" : {_upgradeName = "Wheel Guards";};
case "oknaOchrana" : {_upgradeName = "Window Guards";};
case "predniOknoOchrana" : {_upgradeName = "Windshield Guards";};
};
_color = "color='#ff0000'";
_stname = format["Upgrade %1",_upgradeName];
_string = format["<t %2>%1</t>", _stname,_color];
_handle = dayz_myCursorTarget addAction [_string, "PathTo\ori_upgrade.sqf",[_cursorTarget,_part,_st], 0, false, true, "",""];
s_player_repairActions set [count s_player_repairActions,_handle];
};
};
};
};
create a file called ori_upgrade.sqf and place it whereever you like (dont forget to set this path to your fn_selfactions) with this inside:
http://pastebin.com/3uhbCNDH
Server Files
server_monitor.sqf
search for
Code:
if (_selection in dayZ_explosiveParts && _dam > 0.8) then {_dam = 0.8};
[_object,_selection,_dam] call object_setFixServer;
Code:
if (_selection in Ori_VehicleUpgrades) then {
_object animate [_selection,_dam];
_object setVariable [_selection,_dam,true];
} else {
if (_selection in dayZ_explosiveParts and _dam > 0.8) then {_dam = 0.8};
[_object,_selection,_dam] call object_setFixServer;
};
all of this is in the _object_damage = { ...}; section!
search for:
Code:
_selection = getText (configFile >> "CfgVehicles" >> (typeOf _object) >> "HitPoints" >> _x >> "name");
add right after
Code:
if (_selection in Ori_VehicleUpgrades) then {_dam = 0;}; //prevent double writtings
after this:
Code:
} count _hitpoints;
Code:
if (typeOf _object in Ori_VehiclesList) then {
_cfg = configFile >> "CfgVehicles" >> (typeOf _object) >> "AnimationSources";
_tc = count _cfg;
for "_mti" from 0 to _tc-1 do {
_mt = (_cfg select _mti);
_st = configName(_mt);
if (_st in Ori_VehicleUpgrades) then {
_hit = _object getVariable [_st,1];
_object animate [_st,_hit];
_array set [count _array,[_st,_hit]];
};
};
};
search for:
Code:
_selection = getText(configFile >> "cfgVehicles" >> _class >> "HitPoints" >> _x >> "name");
Code:
if (_selection in Ori_VehicleUpgrades) then {_dam = 0;}; //prevent double writtings
under this
Code:
} count _hitpoints;
Code:
if (typeOf _object in Ori_VehiclesList) then {
_cfg = configFile >> "CfgVehicles" >> _class >> "AnimationSources";
_tc = count _cfg;
for "_mti" from 0 to _tc-1 do {
_mt = (_cfg select _mti);
_st = configName(_mt);
if (_st in Ori_VehicleUpgrades) then {
_hit = 1;
_object setVariable [_st,_hit,true];
_object animate [_st,_hit];
_array set [count _array,[_st,_hit]];
};
};
};
Add the Origins Vehicles to your dynamic_vehicles.sqf and have fun with it.
Code:
["ori_ScrapBuggy",3],["ori_survivorBus",3],["ori_vil_lada_2105_rust",3],["ori_poldek_black",3],["ori_poldek",3],["ori_rth_originsmod_bathmobile",3],["ori_transit",3],["ori_vil_originsmod_lublin_truck",3],["ori_vil_originsmod_truck_civ",3],["ori_vil_originsmod_truck_civ",3],["ori_originsmod_pickupoldfuel",3],["ori_p85_originsmod_cucv_pickup",3],["ori_originsmod_pickupold",3]
Credits:
Evangelium aka Relict for sponsoring my work
MajorPainage for Origins Files
ElDubya for the communtiy idea: http://epochmod.com/forum/index.php?/topic/33620-originsoverpochins/
Rotzloch for his Origins-Releases: http://epochmod.com/forum/index.php...gins-buildingsystem-for-epoch-origins-server/
PS: I may have forgotten something, try to isntall this and tell me the results
Also i ask for every critic to get this script a better one
If you like my work, how about spending me some coffe?

Last edited: