[Release] Drink water directly from ponds / wells

Mamu1234

Member
Drink Water
v1.0
Hi there,

the other day(z) i was chasing through Chernarus in search for something to drink. The only things i have found were some wells but nothing to put the water in. So i got a bit angry about the quite unrealistic fact that i can´t drink directly from the wells. So i tried to fix that and here is my solution.

If someone thinks he/she is able to improve the script ... feel free, just credit me for the idea. It´s nothing special, just a mix of the fillBottle-script and the drink-script.


Requirements
  • Easy = Blue <10
  • dayz_code.pbo
  • mission.pbo
Installation Steps

- Extract your dayz_code.pbo and open dayz_code/init/variables.sqf

- Search for
Code:
dayz_resetSelfActions
and insert
Code:
s_player_drinkWater = -1;
at the bottom of this section right after the last entry. In my case it looks like this :
Code:
.
.
.
    s_player_fillfuel20 = -1;
    s_player_fillfuel5 = -1;
    s_player_drinkWater = -1;
};

- Save and close the variables.sqf

- Open dayz_code/compile/fn_selfactions (or in case your custom fn_selfactions, whereever it is located)
- Insert the following code after the last entry :

Code:
//------------------- Drink Water --------------------------------
private["_playerPos","_canDrink","_isPond","_isWell","_pondPos","_objectsWell","_objectsPond","_display"];
 
_playerPos = getPosATL player;
_canDrink = count nearestObjects [_playerPos, ["Land_pumpa","Land_water_tank"], 4] > 0;
_isPond = false;
_isWell = false;
_pondPos = [];
_objectsWell = [];
 
if (!_canDrink) then {
    _objectsWell = nearestObjects [_playerPos, [], 4];
    {
        //Check for Well
        _isWell = ["_well",str(_x),false] call fnc_inString;
        if (_isWell) then {_canDrink = true};
    } forEach _objectsWell;
};
 
if (!_canDrink) then {
    _objectsPond = nearestObjects [_playerPos, [], 50];
    {
        //Check for pond
        _isPond = ["pond",str(_x),false] call fnc_inString;
        if (_isPond) then {
            _pondPos = (_x worldToModel _playerPos) select 2;
            if (_pondPos < 0) then {
                _canDrink = true;
            };
        };
    } forEach _objectsPond;
};
 
if (_canDrink) then {
        if (s_player_drinkWater < 0) then {
            s_player_drinkWater = player addaction[("<t color=""#0000c7"">" + ("Drink water") +"</t>"),"scripts\drink_water.sqf"];
        };
    } else {
        player removeAction s_player_drinkWater;
        s_player_drinkWater = -1;
    };
 
//-------------------------Drink Water End ----------------------------------------------

- Save and close the fn_selfactions.sqf
- Compress your dayz_code

- Extract your mission.pbo and create a folder "scripts".
- Create a script named drink_Water.sqf and insert the following code into it :

http://pastebin.com/M6PMDK6b

- Save your drink_Water.sqf.
- Compress your mission.pbo, fire up your server and enjoy a cool drink from a well or pond of your choice.
 
Back
Top