Grahame Posted March 17, 2018 Report Share Posted March 17, 2018 I got certain configs updated in the EpochCore client files allowing a few extra nice features to be deployed in A3/Epoch, and I'll start off by posting the information to set up portable generators to allow fuel pumps to be used for refueling vehicles if auto-refueling is turned off on your server. Installation Instructions (1) Add the portable generator "kit" to your loot tables and trader price lists. The class name is KitGenerator (2) Add the files in this downloadable archive to a folder in your mission called, for example, sounds: https://www.dropbox.com/s/75gq2rezy1tcbe2/generator_sounds.zip?dl=0 The license file is required! It is a Creative Commons Attribution Only license for the sound file. (3) Add the following lines to your mission file's custom description.ext (replacing the path for the generator1.ogg sound with the location in which you put it): // Portable Generator Sounds class CfgSFX { class Generator { sounds[] = {"Generator"}; name = "Generator"; Generator[] = {"sounds\generator1.ogg","db+10",1,200,1,0,0,0}; Empty[] = {"",0,0,0,0,0,0,0}; }; }; class CfgVehicles // NOTE: CfgVehicles definitions are only permitted in description.ext for sound sources. It cannot be used for CfgVehicles customizations { class PortableGenerator { sound = "Generator"; }; }; (4) Create a file in the folder of your mission file where you store your own scripts, e.g. custom called PortableGenerator.sqf and paste the following code into it: Spoiler private ["_generator","_action","_fueled","_running","_sound","_fuelPumps"]; _generator = _this select 0; _action = _this select 1; _fueled = _generator getVariable ["GeneratorFueled",false]; _running = _generator getVariable ["GeneratorRunning",false]; switch _action do { case 0: { // Turn off generator player playMove 'AinvPknlMstpSnonWrflDnon_medic0'; player playMove 'AinvPknlMstpSnonWrflDnon_medicEnd'; _generator setVariable ["GeneratorRunning",false,true]; _sound = _generator getVariable ["GeneratorSound", objNull]; deleteVehicle _sound; _fuelPumps = nearestObjects [_generator, ["Land_fs_feed_F","Land_FuelStation_Feed_F","Land_FuelStation_01_pump_F","Land_FuelStation_02_pump_F","Land_FuelStation_01_pump_malevil_F"],10]; {_x setFuelCargo 0;} foreach _fuelPumps; }; case 1: { // Turn on generator // Play animation for starting the generator player playMove 'AinvPknlMstpSnonWrflDnon_medic0'; player playMove 'AinvPknlMstpSnonWrflDnon_medicEnd'; _generator setVariable ["GeneratorRunning",true,true]; _sound = createSoundSource ["PortableGenerator", getPosATL _generator, [], 0]; _generator setVariable ["GeneratorSound",_sound,true]; _fuelPumps = nearestObjects [_generator, ["Land_fs_feed_F","Land_FuelStation_Feed_F","Land_FuelStation_01_pump_F","Land_FuelStation_02_pump_F","Land_FuelStation_01_pump_malevil_F"],10]; {_x setFuelCargo (random 1);} foreach _fuelPumps; }; case 2: { // Refuel generator if ("jerrycan_epoch" in (magazines player)) then { player removeMagazine "jerrycan_epoch"; player addMagazine "jerrycanE_epoch"; // Play animation for refueling closeDialog 0; player playMove 'AinvPknlMstpSnonWrflDnon_medic0'; player playMove 'AinvPknlMstpSnonWrflDnon_medicEnd'; _generator setVariable ["GeneratorFueled",true,true]; } else { ["You need a full jerry can to refuel the generator", 5] call Epoch_message; }; }; default { ["Nothing to do", 5] call Epoch_message; }; }; (5) Add the following lines to your mission's init.sqf (replacing the path with whatever you used in step (4)): if(hasInterface) then{ PortableGenerator = compileFinal preprocessFileLineNumbers "custom\PortableGenerator.sqf"; }; (6) Add the following to epoch_config/Configs/CfgItemInteractions.hpp: class KitGenerator : Item_Build_base { buildClass = "Generator_EPOCH"; }; (7) Add the following to epoch_config/Configs/CfgBaseBuilding.hpp: class Generator_EPOCH : Default { removeParts[] = {{"KitGenerator",1}}; GhostPreview = "Generator_Ghost_EPOCH"; staticClass = "Generator_EPOCH"; simulClass = "Generator_SIM_EPOCH"; limitNearby = 2; bypassJammer = 1; }; class Generator_SIM_EPOCH : Generator_EPOCH { removeParts[] = {}; }; class Generator_Ghost_EPOCH : Generator_SIM_EPOCH {}; (8) Add the following code to epoch_config/Configs/CfgActionMenu/cfgActionMenu_target.hpp: // Portable Generators class generator_refill { condition = "((dyna_cursorTarget isKindOf 'Generator_EPOCH') && !(dyna_cursorTarget getVariable [""GeneratorFueled"",false]) && !(dyna_cursorTarget getVariable [""GeneratorRunning"",false]))"; action = "[dyna_cursorTarget, 2] call PortableGenerator;"; icon = "x\addons\a3_epoch_code\Data\UI\buttons\vehicle_refuel.paa"; tooltip = "Refuel generator"; }; class generator_start { condition = "((dyna_cursorTarget isKindOf 'Generator_EPOCH') && (dyna_cursorTarget getVariable [""GeneratorFueled"",false]) && !(dyna_cursorTarget getVariable [""GeneratorRunning"",false]))"; action = "[dyna_cursorTarget, 1] call PortableGenerator;"; icon = "x\addons\a3_epoch_code\Data\UI\buttons\Replace_Engine.paa"; tooltip = "Start generator"; }; class generator_stop { condition = "((dyna_cursorTarget isKindOf 'Generator_EPOCH') && (dyna_cursorTarget getVariable [""GeneratorRunning"",false]))"; action = "[dyna_cursorTarget, 0] call PortableGenerator;"; icon = "x\addons\a3_epoch_code\Data\UI\buttons\Remove_Engine.paa"; tooltip = "Stop generator"; }; RePBO your mission file and upload it to the server. That should be it. Kenobi, BlackhatEspeed, Ghostrider-GRG and 4 others 7 Link to comment Share on other sites More sharing options...
Grahame Posted March 17, 2018 Author Report Share Posted March 17, 2018 Just thought of one more thing that should be added - not a big thing but you should be not able to remove the generator and get the kit back if it is still running. Not a big thing cause the pumps do get zeroed at restart with autorefueling disabled but it would be important immersion wise Will test code and update when I can (soon) Ghostrider-GRG and natoed 2 Link to comment Share on other sites More sharing options...
Ghostrider-GRG Posted May 14, 2018 Report Share Posted May 14, 2018 Looks like a great addition ! I will be adding this to our server once it is sorted out. Link to comment Share on other sites More sharing options...
BlackhatEspeed Posted August 14, 2018 Report Share Posted August 14, 2018 Looks like a really good idea, I'm definitely installing this one. Link to comment Share on other sites More sharing options...
Recommended Posts
Please sign in to comment
You will be able to leave a comment after signing in
Sign In Now