Jump to content
  • 0

Drink water script


BetterDeadThanZed

Question

I'm trying to install this script on a new Epoch server: http://opendayz.net/threads/release-drink-water-v2-0.13493/

I am not getting the option in the scroll menu to drink water. Is this script still compatible with Epoch 1.0.5.1?

I wonder if something in this fn_selfaction.sqf code is old and not compatible?

private["_playerPos","_canDrink","_isPond","_isWell","_pondPos","_objectsWell","_objectsPond","_display"];
 
_playerPos = getPosATL player;
_canDrink = count nearestObjects [_playerPos, ["Land_pumpa","Land_water_tank","Land_Barrel_water"], 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"">" + (localize "STR_action_drink") +"</t>"),"custom\drink_water\drink_water.sqf"];
        };
    } else {
        player removeAction s_player_drinkWater;
        s_player_drinkWater = -1;
    };

 

Link to comment
Share on other sites

13 answers to this question

Recommended Posts

  • 0

I had this installed, it worked, used it for a while. Players complained about slow trader access.  Did a bit of research and one thread mentioned that, that script caused the slow traders. So i removed it for fun and sure enough it went from 15-20 seconds to almost instantly.  This was version 1

I just installed this on my test server and it does the same thing.  Traders are incredibly slow.  And the only way i got the scroll wheel to show the action "drink water" was to replace the player addaction line in the fn_selfactions to this

s_player_drinkWater = player addAction ["<t color=""#0000c7"">Drink Water</t>","custom\drink_water\drink_water.sqf","",5,false,true,"",""];

Of course change the path

(localize "STR_action_drink") <<< is what i removed from that line.  All it does is tell you that you had water with text  i also added "",5,false,true,"","". Not sure if that has anything to do with it.

would like to know what the numbers and true/false means lol

If you can fix the trader menu lag let me know, i would like to run this script

Link to comment
Share on other sites

  • 0

Bit of a stab in the dark by bumping this topic after a while. Does anyone know where a copy of these files for the drink water script v2.0 by clark17 could be found. His github link returns a 404. So im just hoping someone has a copy of the files. Im trying to get V1 by manu to work but doesnt seem to be working for me in Epoch even with following everything to the word. So if anyone knows anywhere else the files can be downloaded I would really appreciate this. Alternately, IF someone happens to still have a copy of the files maybe attaching them in a reply, again i would really appreciate it. If my knowldge of sqf was way better id attempt to create a fully working compatible script for Epoch myself but it isnt so i wont attempt that as id make a fool of myself :)

Link to comment
Share on other sites

  • 0
1 hour ago, leegreaves said:

Bit of a stab in the dark by bumping this topic after a while. Does anyone know where a copy of these files for the drink water script v2.0 by clark17 could be found. His github link returns a 404. So im just hoping someone has a copy of the files. Im trying to get V1 by manu to work but doesnt seem to be working for me in Epoch even with following everything to the word. So if anyone knows anywhere else the files can be downloaded I would really appreciate this. Alternately, IF someone happens to still have a copy of the files maybe attaching them in a reply, again i would really appreciate it. If my knowldge of sqf was way better id attempt to create a fully working compatible script for Epoch myself but it isnt so i wont attempt that as id make a fool of myself :)

 

i not sure if uare looking for it but this is the drink of any source sqf

Spoiler
private["_playerPos","_canDrink","_isPond","_isWell","_pondPos","_objectsWell","_objectsPond","_display"];
 
call gear_ui_init;
_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 ((floor (random 100) < 25)) then {
 
player playActionNow "PutDown";
r_player_infected = true;
player setVariable["USEC_infected",true,true];
player setVariable ["messing",[dayz_hunger,dayz_thirst],true];
 
dayz_lastDrink = time;
dayz_thirst = 0;
 
//Ensure Control is visible
_display = uiNamespace getVariable 'DAYZ_GUI_display';
(_display displayCtrl 1302) ctrlShow true;
//cutText ["Das Wasser ist lauwarm und schmeckt irgendwie komisch, aber dein Durst ist gestillt.", "PLAIN DOWN"];
cutText ["The water is warm and tastes kinda strange, but your thirst is quenched.", "PLAIN DOWN"];
 
} else {
 
player playActionNow "PutDown";
dayz_lastDrink = time;
dayz_thirst = 0;
 
//Ensure Control is visible
_display = uiNamespace getVariable 'DAYZ_GUI_display';
(_display displayCtrl 1302) ctrlShow true;
//cutText ["Das Wasser ist kühl und schmeckt etwas schal, aber dein Durst ist gestillt.", "PLAIN DOWN"];
cutText ["The water is cool and tastes a bit stale, but your thirst is quenched.", "PLAIN DOWN"];
};
 

};

 

Link to comment
Share on other sites

  • 0

also you can try at buttom of your custom fn_selfActions.sqf

Spoiler
//------------------- 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>"),"custom\drink_water.sqf"];
};
} else {
player removeAction s_player_drinkWater;
s_player_drinkWater = -1;

};

drink_water.sqf  (mpmissions\instance\custom\ )

Spoiler
private["_playerPos","_canDrink","_isPond","_isWell","_pondPos","_objectsWell","_objectsPond","_display"];
 
call gear_ui_init;
_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 ((floor (random 100) < 25)) then {
 
player playActionNow "PutDown";
r_player_infected = true;
player setVariable["USEC_infected",true,true];
player setVariable ["messing",[dayz_hunger,dayz_thirst],true];
 
dayz_lastDrink = time;
dayz_thirst = 0;
 
//Ensure Control is visible
_display = uiNamespace getVariable 'DAYZ_GUI_display';
(_display displayCtrl 1302) ctrlShow true;
//cutText ["Das Wasser ist lauwarm und schmeckt irgendwie komisch, aber dein Durst ist gestillt.", "PLAIN DOWN"];
cutText ["The water is warm and tastes kinda strange, but your thirst is quenched.", "PLAIN DOWN"];
 
} else {
 
player playActionNow "PutDown";
dayz_lastDrink = time;
dayz_thirst = 0;
 
//Ensure Control is visible
_display = uiNamespace getVariable 'DAYZ_GUI_display';
(_display displayCtrl 1302) ctrlShow true;
//cutText ["Das Wasser ist kühl und schmeckt etwas schal, aber dein Durst ist gestillt.", "PLAIN DOWN"];
cutText ["The water is cool and tastes a bit stale, but your thirst is quenched.", "PLAIN DOWN"];
};
 

};

 

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
  • Advertisement
  • Discord

×
×
  • Create New...