Jump to content
  • 0

placing working wells


Birgitte

Question

5 answers to this question

Recommended Posts

  • 0

@Birgitte  also you can get more info into \@DayZ_Epoch\addons\dayz_code\actions\player_drinkWater.sqf

Spoiler

private ["_playerPos","_canFill","_isPond","_isWell","_pondPos","_objectsWell","_onLadder","_hasbottleitem","_config","_item","_text","_objectsPond","_qty","_dis","_sfx","_isInfected","_bodiesNear","_chance","_itemorignal","_well"];

call gear_ui_init;
closeDialog 0;
_item = _this;
_playerPos = getPosATL player;
_canFill = count nearestObjects [_playerPos, ["Land_pumpa","Land_water_tank"], 4] > 0;
_isPond = false;
_isWell = false;
_isInfected = false;
_pondPos = [];
_objectsWell = [];

_onLadder = (getNumber (configFile >> "CfgMovesMaleSdr" >> "States" >> (animationState player) >> "onLadder")) == 1;
if (_onLadder) exitWith {localize "str_player_21" call dayz_rollingMessages;};

_itemorignal = _this;
//diag_log(str(_itemorignal));

if (!dayz_isSwimming) then {
    player playActionNow "PutDown";
};

if (!_canFill) then {
    _objectsWell = nearestObjects [_playerPos, [], 4];
    {
        //Check for Well
        _isWell = ["_well",str(_x),false] call fnc_inString;
        if (_isWell) then {_canFill = true};
    } forEach _objectsWell;
};

if (!_canFill) then {
    _objectsPond = nearestObjects [_playerPos, [], 100];
    {
        //Check for pond
        _isPond = ["pond",str(_x),false] call fnc_inString;    
        //Check for Dead Bodies
        _bodiesNear = ["dead",str(_x),false] call fnc_inString;
        if (!_bodiesNear) then {
            _bodiesNear = ["massgrave",str(_x),false] call fnc_inString;
        };
        if (_bodiesNear) then {
            _isInfected = true;
        };
        if (_isPond) then {    
            _pondPos = (_x worldToModel _playerPos) select 2;
            if (_pondPos < 0) then {
                _canFill = true;
            };
        };
    } forEach _objectsPond;
};

if (_canFill) then {
    _chance = 0.1;
    
    if (_itemorignal in boil_tin_cans) then {
        _chance = 0.06;
        ["FoodDrink",0,[0,0,300,0]] call dayz_NutritionSystem; //[Energy,food,water,temp]
    } else {
        _chance = 0.03;
        ["FoodDrink",0,[0,0,150,0]] call dayz_NutritionSystem; //[Energy,food,water,temp]
    };
    
    [player,"drink",0,false,5] call dayz_zombieSpeak;
    [player,10,true,(getPosATL player)] call player_alertZombies;
    
    if(!_isWell) then {
        if (_isInfected) then {
            r_player_infected = true;
            player setVariable["USEC_infected",true,true];
        } else {
            if ([_chance] call fn_chance) then {
                r_player_infected = true;
                player setVariable["USEC_infected",true,true];
            };
        };
    };
    localize "str_drinkwithhands" call dayz_rollingMessages;
} else {
    localize "str_player_32" call dayz_rollingMessages;
};

if u wanna make some change on it.. you need drop this file out of dayz_code.pbo

and change the path in a custom fn_selfactions.sqf

s_player_Drinkfromhands = player addAction [localize "STR_ACTIONS_DRINK2", "\z\addons\dayz_code\actions\player_drinkWater.sqf",player, 0.5, false, true];

 

Link to comment
Share on other sites

  • 0

if you're wanting to add the ones from gem crafting, these are the ones you need to add

, "Map_pumpa","Land_Misc_Well_C_EP1","Land_Misc_Well_L_EP1","MAP_Misc_Well","MAP_Misc_WellPump"

to this block like so. In your fm_selfactions.sqf

Spoiler

_canDoThis=false;
if (_canDo && !_inVehicle && !dayz_isSwimming) then {
    {
        _waterHoles = if (typeOf _x == "waterHoleProxy") then {nearestObjects [_x, [], 1];} else {[_x];};
        {
            _w2m = _x worldToModel (getPosATL player);
            _bb = (boundingbox _x) select 1;
            _dir = [player, _x] call BIS_fnc_relativeDirTo; if (_dir > 180) then {_dir = _dir - 360};
            if (((abs _dir < 45) && {(_x distance player < 2.22)})  // wells, kasna, pumpa
                or {((("" == typeOf _x) && ((_w2m select 2) < 0.05)) && {((abs(_w2m select 0) < (_bb select 0)) && (abs(_w2m select 1) < (_bb select 1)))})}) exitWith { // ponds
                _canDoThis = true;
            };
        } count _waterHoles;
        if (_canDoThis) exitWith {
            if (s_player_Drinkfromhands < 0) then {
                s_player_Drinkfromhands = player addAction [localize "STR_ACTIONS_DRINK2", "\z\addons\dayz_code\actions\player_drinkWater.sqf",player, 0.5, false, true];
            };
        };
    } foreach nearestObjects [player, ["waterHoleProxy", "Land_pumpa", "Map_pumpa","Land_Misc_Well_C_EP1","Land_Misc_Well_L_EP1","MAP_Misc_Well","MAP_Misc_WellPump"], 50];
};

 

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Discord

×
×
  • Create New...