DayZ Chenarus Auto Refuel! All stations!

For a lot of the dayZ stuff I add a generic item like a flag, save the mission, then edit the saved mission files and change the entries for the building name to one I want.

Reload the mission and they are in. Would also like to know how to have all the dayZ stuff available from the in-game editor.
 
I'm trying to convert this script to work with Namalsk. I have edited in the information to the server's mission.sqm, as well as added the sriptsmz file. It appears to me that your script uses the worldspace to define where the refuel spots are, so really what building is nearby shouldn't matter (correct me if I'm wrong, I'm pretty new to this stuff still). So I used the editor and placed down a mine near one of my desired Namalsk refuel stations, then went into my new saved mission.sqm and copied the worldspace of the mine and replaced one of your chernaurus refueling locations with it. So far it has not worked. Any idea where I am going wrong?
 
The worldspace in the database and the worldspace in the code are different. Essentially the db is [ direction facing,[X,Y,Z]]. Just worry about the X,Y,Z bit for now.

In the Code the worldspace is {X, Z ,Y}.. The small number is always Z (Height), try that.. Don't know why it is different, probably just to confuse us..
 
I saw your message in my emails and got all excited but looks like axeman beat me too it :p
IF you dont come right let me know, and I will take a look for you :)
 
So far I have copied this into my mission sqm, right above Class Markers.

class Sensors
{
items=1;
class Item0
{
position[]={7023.45,-1.9073486e-006,11552.5};
a=10;
b=10;
activationBy="ANY";
repeating=1;
interruptable=1;
age="UNKNOWN";
name="REFUEL";
expCond="this and ((getpos (thislist select 0)) select 2 < 1)";
expActiv="_xhandle= [(thislist select 0)] execVM ""scriptsMZ\MZ_reload.sqf"";";
class Effects
{
};
};

};

Then I put in the scriptsMZ exactly how you have it. I only have the one fuel station set up so far, as I want to see if I can get the one to work before I go about adding in a bunch more. It seems to have a very small area (like maybe 1m) where it will kill the vehicles engine, but does not start refueling. I simply can't seem to figure out what to try next. Maybe my position is too high or low? Or perhaps I missed converting something? Or maybe something else?
 
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;
    };
};
 
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", "_isNearQuad", "_isNearQuadCount", "_veh_up_vector"];
 
   
        _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;
    };
};
i ended up doing something similar to this, just hadnt gotten around to posting it, thanks though cuz this is was i was originally looking for and im sure others would like this also
 
Does anyone know the classname for all the fuel "sheds" with pumps on Namalsk, because it's not "Land_A_FuelStation_Feed"?
 
Looks like it may be Land_Fuel_tank_big.
I'm not 100% sure of this though, going to test it out when I get home from work today (so like 10-12 hours from now).

edit: so this is not the name of the building. I am having no luck figuring this out at this moment in time either.
 
Ok so, I have had no luck with Seven's script yet either. I want to confirm something though, the line [] execVM "Scripts\kh_actions.sqf"; I am placing right over the open { of is dedicated line. So basically it reads:

if (!isDedicated) then {
[] execVM "Scripts\kh_actions.sqf";
if (isClass (configFile >> "CfgBuildingLootNamalsk")) then {
etc. etc.

I am still trying to figure out what the model ID for the fuel tanks on Namalsk are as well. They look A LOT like the Land_Fuel_tank_big, but i'm not sure this is what it is. It's tough to say since I can't get the refuel script to even come up in game though.
 
I think that's the one I need? The fuel tanks you can fill jerry's on in Namalsk looks like the one in the background of this screenshot imgur.com/a/JWIEq#123. The one I have in my code right now is pictures on Arma Tech Squad without the the ladder, but is called Fuel Tank big. So I'm thinking it may be a model not listed on the Arma Tech Squad. Let me know what you think, in any case I may be able to set something up with the codes you gave me.
 
Back
Top