TheSeventhSense
New Member
Yea im not sure where the mission.pbo is. Im in my file manager and there are like 5 different files marked with chernarus.
Follow along with the video below to see how to install our site as a web app on your home screen.
Note: This feature may not be available in some browsers.
why is everyone making this so hard for them selves having to add extra objects to their mission file. I use a script that brings a refuel scroll wheel option up when you are near a pump, all it requires is a single line added to the init.sqf. I could easily modify it to be automatic.
add this code after "if (!isDedicated) then {" in your missions init.sqf
PHP:[] execVM "Scripts\kh_actions.sqf";
Then make a folder called "Scripts" and add these two files
kh_actions.sqf
PHP:private ["_vehicle", "_vehicle_refuel_id"]; //Awesomely Edited by Seven _vehicle = objNull; diag_log "Running ""kh_actions""."; while {true} do { if (!isNull player) then { private ["_currentVehicle", "_isNearFeed"]; _currentVehicle = vehicle player; _isNearFeed = count ((position _currentVehicle) nearObjects ["Land_A_FuelStation_Feed", 10]) > 0; if (_vehicle != _currentVehicle) then { if (!isNull _vehicle) then { _vehicle removeAction _vehicle_refuel_id; _vehicle = objNull; }; if (_currentVehicle != player && _isNearFeed) then { _vehicle = _currentVehicle; _vehicle_refuel_id = _vehicle addAction ["Refuel", "Scripts\kh_vehicle_refuel.sqf", [], -1, false, false, "", "vehicle _this == _target && local _target"]; }; }; if (!_isNearFeed) then { _vehicle removeAction _vehicle_refuel_id; _vehicle = objNull; }; }; sleep 2; }
kh_vehicle_refuel.sqf
PHP:private ["_target", "_caller", "_id", "_isNearFeed"]; _target = _this select 0; _caller = _this select 1; _id = _this select 2; if (isNil "ib_refueling_in_progress") then { ib_refueling_in_progress = false; }; if (!ib_refueling_in_progress) then { _isNearFeed = count ((position _caller) nearObjects ["Land_A_FuelStation_Feed", 10]) > 0; if (!_isNearFeed) then { titleText ["You must be near a fuel station pump.", "PLAIN DOWN", 3]; titleFadeOut 3; } else { ib_refueling_in_progress = true; titleText ["Refueling", "PLAIN", 3]; while {(vehicle _caller == _target) and (local _target)} do { private ["_velocity", "_cfcust"]; _velocity = velocity _target; _cfcust = fuel _target; if ((_velocity select 0 > 1) or (_velocity select 1 > 1) or (_velocity select 2 > 1)) exitWith { }; if (_cfcust >= 1.0) exitWith { }; sleep 0.5; _cfcust = _cfcust + 0.005; if (_cfcust >= 1.0) then { _cfcust = 1.0; }; _target setFuel _cfcust; }; titleFadeOut 1; ib_refueling_in_progress = false; }; };
Firstly, if I understand this, you need to be near Land_A_FuelStation_Feed to refuel. I don't understand what that is. I've found other Land_A_FuelStation but not with _Feed at the end.
Secondly, if the auto-refuel works only near a station, how do I make it possible near a fuel tank too.
Finally, what number in this code represents the speed of refuel?
I modified the script that Seven posted to work with all the fuel tanks you can use with jerry cans and the gas pumps. I removed some code that wasn't needed and added messages for when the vehicle moves while fueling and when fueling is done. Added some variables to the kh_actions.sqf file (lines 6 & 7) for distance from tanks/pumps and amount of fuel per loop so it can be changed easily.
kh_actions.sqf - http://pastebin.com/rCW8sWCC
kh_vehicle_refuel.sqf - http://pastebin.com/6AmSQB8w
Thank you so much!If you look at the post attached below(post #99 in this thread).. I modified Seven's script to work with pumps and all tanks you can fill jerrycans at. There is also variables in the kh_actions.sqf file to change settings.
why is everyone making this so hard for them selves having to add extra objects to their mission file. I use a script that brings a refuel scroll wheel option up when you are near a pump, all it requires is a single line added to the init.sqf. I could easily modify it to be automatic.
add this code after "if (!isDedicated) then {" in your missions init.sqf
PHP:[] execVM "Scripts\kh_actions.sqf";
Then make a folder called "Scripts" and add these two files
kh_actions.sqf
PHP:private ["_vehicle", "_vehicle_refuel_id"]; //Awesomely Edited by Seven _vehicle = objNull; diag_log "Running ""kh_actions""."; while {true} do { if (!isNull player) then { private ["_currentVehicle", "_isNearFeed"]; _currentVehicle = vehicle player; _isNearFeed = count ((position _currentVehicle) nearObjects ["Land_A_FuelStation_Feed", 10]) > 0; if (_vehicle != _currentVehicle) then { if (!isNull _vehicle) then { _vehicle removeAction _vehicle_refuel_id; _vehicle = objNull; }; if (_currentVehicle != player && _isNearFeed) then { _vehicle = _currentVehicle; _vehicle_refuel_id = _vehicle addAction ["Refuel", "Scripts\kh_vehicle_refuel.sqf", [], -1, false, false, "", "vehicle _this == _target && local _target"]; }; }; if (!_isNearFeed) then { _vehicle removeAction _vehicle_refuel_id; _vehicle = objNull; }; }; sleep 2; }
kh_vehicle_refuel.sqf
PHP:private ["_target", "_caller", "_id", "_isNearFeed"]; _target = _this select 0; _caller = _this select 1; _id = _this select 2; if (isNil "ib_refueling_in_progress") then { ib_refueling_in_progress = false; }; if (!ib_refueling_in_progress) then { _isNearFeed = count ((position _caller) nearObjects ["Land_A_FuelStation_Feed", 10]) > 0; if (!_isNearFeed) then { titleText ["You must be near a fuel station pump.", "PLAIN DOWN", 3]; titleFadeOut 3; } else { ib_refueling_in_progress = true; titleText ["Refueling", "PLAIN", 3]; while {(vehicle _caller == _target) and (local _target)} do { private ["_velocity", "_cfcust"]; _velocity = velocity _target; _cfcust = fuel _target; if ((_velocity select 0 > 1) or (_velocity select 1 > 1) or (_velocity select 2 > 1)) exitWith { }; if (_cfcust >= 1.0) exitWith { }; sleep 0.5; _cfcust = _cfcust + 0.005; if (_cfcust >= 1.0) then { _cfcust = 1.0; }; _target setFuel _cfcust; }; titleFadeOut 1; ib_refueling_in_progress = false; }; };
So I've been trying to get this to work for a few hours now with no luck. I'm inserting the scripts exactly as the appear and making the folder in the mission.pbo but whenever I start up the server it tells me that it cannot locate the "scripts\kh_actions.sqf". I've tried sticking the 'scripts' folder into the pbo, into my A2OA folder, tried sticking the files into the pbo without the folder...
I've even tried moving the script around in the init file. Can anyone please help me out?
if (!isDedicated) then {[] execVM "Scripts\kh_actions.sqf";
//Conduct map operations
0 fadeSound 0;
waitUntil {!isNil "dayz_loadScreenMsg"};
dayz_loadScreenMsg = (localize "STR_AUTHENTICATING");
5 setFuel !"\"setFuel\"," !"z\addons\dayz_code\compile\local_setFuel.sqf" !"\"dayzSetFuel\"" !"dayzSetFuel_code" !"dayzSetFuel = _val;" !"Scripts\kh_actions.sqf" !"Scripts\kh_vehicle_refuel.sqf"
Everyone getting kicked for script restriction #44 change the following:
Scripts.txt -
Change line 46 to the following:
PHP:5 setFuel !"\"setFuel\"," !"z\addons\dayz_code\compile\local_setFuel.sqf" !"\"dayzSetFuel\"" !"dayzSetFuel_code" !"dayzSetFuel = _val;" !"Scripts\kh_actions.sqf" !"Scripts\kh_vehicle_refuel.sqf"