Jump to content

[RELEASE]^[SHOWER IN RIVERS]


Recommended Posts

ALLOW PLAYERS TO SHOWER IN RIVER.

When players are near of Lakes they can use Scroll Menu to "Take a Shower in Rivers"

*Add Humanity+450/infection chance/time restriction.

***you will need a custom fn_selfActions.sqf***

1-Create a sqf called showerON.sqf  and put it into MPMISSIONS\YOURINSTANCE\fixes\

paste:

Spoiler

private ["_dis","_sfx","_LastUsedTime","_Time","_infectrand","_welcomeMessage","_camDistance"];
///VARIABLES
_LastUsedTime = 1360;
_Time = time - lastuse;
_infectrand = round(random 10);
_welcomeMessage = format["Nice you take a shower +400Humanity!, %1,",format["%1", name player]];
_camDistance = 60;
///////////////////////////////////
//NEGATIVES


if(_Time < _LastUsedTime) exitWith {
    cutText [format["wait %1 seconds !",(round(_Time - _LastUsedTime))], "PLAIN DOWN"];
};
///////////

//START SCRIPT
lastuse = time;

        _dis = 5;
        _sfx = "fillwater";
        [player,_sfx,0,false,_dis] call dayz_zombieSpeak;
        [player,_dis,true,(getPosATL player)] spawn player_alertZombies;
        [player,+400] call player_humanityChange;
        //RANDOM INFECTION START TO WORK
        if (_infectrand < 4) then {r_player_infected = true;
        cutText [format["%1, you get infected by some kind of virus",name player], "PLAIN DOWN"];
    };
    //CAMERA START
    showCinemaBorder true;
   camUseNVG false;               
   _camera = "camera" camCreate [(position player select 0)-2, position player select 1,(position player select 2)+_camDistance];
   _camera cameraEffect ["internal","back"];
   
   _camera camSetFOV 2.000;
   _camera camCommit 0;
   waitUntil {camCommitted _camera};
   
 
   _camera camSetTarget vehicle player;
   _camera camSetRelPos [0,0,2];
   _camera camCommit 8;
 
   cutText [_welcomeMessage, "PLAIN DOWN"];

   waitUntil {camCommitted _camera};
 
  _camera cameraEffect ["terminate","back"];
  camDestroy _camera;
  sleep 1;


 

2-Now got at bottom of your fn_selfAction.sqf and paste

Spoiler


//SHOWER//
private["_playerPos","_canshower","_isPond","_isWell","_pondPos","_objectsWell","_objectsPond"];

//VARIABLES
 

_playerPos = getPosATL player;
_canshower = count nearestObjects [_playerPos, ["Land_pumpa","Land_water_tank"], 4] > 0;
_isPond = false;
_isWell = false;

_pondPos = [];
_objectsWell = [];

 

 

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


if (!_canshower) 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 {
                _canshower = true;
                if (s_player_shower < 0) then {
                s_player_shower = player addAction [("<t color=""#3399cc"">" + ("SHOWER IN RIVER") + "</t>"), "fixes\showerON.sqf"];};
} else {
player removeAction s_player_shower;
    
            };
        };
    } forEach _objectsPond;
};

3- in fn_selfactions.sqf :

find:

player removeAction s_player_studybody;
s_player_studybody = -1;

add bellow:

player removeAction s_player_shower;
s_player_shower = -1;

Link to comment
Share on other sites

nop, just add in fn_selfAction  and   make the showerON.sqf. (dont need to be put in init.sqf cuz fn_selfaction.sqf are calling the shlowerON.sqf. see : 

Spoiler

 if (s_player_shower < 0) then {
                s_player_shower = player addAction [("<t color=""#3399cc"">" + ("SHOWER IN RIVER") + "</t>"), "fixes\showerON.sqf"];};
} else {
player removeAction s_player_shower;

  do you have a custom fn_selfcation?  u need to go near of a lake, then use the scroll menu and option appear in blue.

check if u copy and paste fine the showerON.sqf  and the code for selfactions.sqf

Link to comment
Share on other sites

5 hours ago, Cherdenko said:

already tripple checked it... doesn´t work anywhere where water is tried it on a lake and ponds also.

iám using Zupas Coin System if that is important

nop, its not important. im using coins too.. but this only add humanity and infection chances, nothing about coins or gold.

Do u have a fn_SelfActions.sqf intoi custom folder?   do you have the call for it from  compiles.sqf or init.sqf?

Link to comment
Share on other sites

46 minutes ago, juandayz said:

nop, its not important. im using coins too.. but this only add humanity and infection chances, nothing about coins or gold.

Do u have a fn_SelfActions.sqf intoi custom folder?   do you have the call for it from  compiles.sqf or init.sqf?

Well yeah i tried the fn_selfactions from zupas coin script and also called my own in the init, but neither of these worked :/

Link to comment
Share on other sites

On 23/6/2016 at 0:14 PM, Cherdenko said:

Well yeah i tried the fn_selfactions from zupas coin script and also called my own in the init, but neither of these worked :/

sorry!!! i forgot add this step.

Go to your fn_selfactions.sqf

find:

player removeAction s_player_studybody;
s_player_studybody = -1;

add bellow:

player removeAction s_player_shower;
s_player_shower = -1;

Link to comment
Share on other sites

1 hour ago, juandayz said:

player removeAction s_player_studybody;
s_player_studybody = -1;

add bellow:

player removeAction s_player_shower;
s_player_shower = -1;

Allright ty. that worked for me. But i still got a problem with the option flickering like in the video shown below.

Also: what pretends players from relogging and doing the same hing again?

is there anyway to make this script server side?

 

Link to comment
Share on other sites

1 minute ago, juandayz said:

well thers a restriction time, like u show in your video... but yes,, its  a problem if pplayer use it, disconect and relog to use again... let me think a possible solution for it.

and you got some idea where that appearing and dissapearing of the button comes from?

if you´re online right now and if you want you could come to my teamspeak.

Link to comment
Share on other sites

30 minutes ago, Cherdenko said:

and you got some idea where that appearing and dissapearing of the button comes from?

if you´re online right now and if you want you could come to my teamspeak.

fn_selfactions.sqf

Spoiler

if (!_canshower) 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 {
                _canshower = true;
                if (s_player_shower < 0) then {
                s_player_shower = player addAction [("<t color=""#3399cc"">" + ("SHOWER IN LAKE") + "</t>"), "custom\fixes\showerON.sqf"];};
} else {
player removeAction s_player_shower;
    
            };
        };
    } forEach _objectsPond;
};

 

Link to comment
Share on other sites

another thing, in the first version i used  call gear_ui_init;  at the top of SHOWER .. in fn_SelfActions.sqf   if ure using   with this call gear_ui_init;  please delete it.

Spoiler

//SHOWER//
private["_playerPos","_canshower","_isPond","_isWell","_pondPos","_objectsWell","_objectsPond"];

//VARIABLES
call gear_ui_init;//DELETE ME

_playerPos = getPosATL player;
_canshower = count nearestObjects [_playerPos, ["Land_pumpa","Land_water_tank"], 4] > 0;
_isPond = false;
_isWell = false;

_pondPos = [];
_objectsWell = [];

And if ure using  right click system ...  u can use your waterbottle to take a quick shower and complement showers in rivers with it:

showerbottle.sqf

Spoiler

private ["_LastUsedTime","_Time","_infectrand","_welcomeMessage","_camDistance","_haswater"];
_LastUsedTime = 1360;
_Time = time - lastuse;
_infectrand = round(random 10);
_welcomeMessage = format["Nice you take a shower +150Humanity!, %1,",format["%1", name player]];
_camDistance = 60;
_haswater = "ItemWaterbottle" in magazines player;

if (!_haswater) exitWith {cutText [format["Needs 1xWaterBottle to take a shower"], "PLAIN DOWN"];};

if(_Time < _LastUsedTime) exitWith {
    cutText [format["wait %1 seconds !",(round(_Time - _LastUsedTime))], "PLAIN DOWN"];
};
 if (_haswater)  then {
  lastuse = time;
  [player,150] call player_humanityChange;
  player removeMagazine "ItemWaterbottle";
  player addMagazine "ItemWaterbottleUnfilled";
  sleep 1;
if (_infectrand < 4) then {r_player_infected = true;
        cutText [format["%1, you get infected by some kind of virus",name player], "PLAIN DOWN"];
    };
 showCinemaBorder true;
   camUseNVG false;               
   _camera = "camera" camCreate [(position player select 0)-2, position player select 1,(position player select 2)+_camDistance];
   _camera cameraEffect ["internal","back"];
   
   _camera camSetFOV 2.000;
   _camera camCommit 0;
   waitUntil {camCommitted _camera};
   playSound "heartbeat_1";
 
   _camera camSetTarget vehicle player;
   _camera camSetRelPos [0,0,2];
   _camera camCommit 8;
 
   cutText [_welcomeMessage, "PLAIN DOWN"];

   waitUntil {camCommitted _camera};
 
  _camera cameraEffect ["terminate","back"];
  camDestroy _camera;
  sleep 1;
 };

in extra_rc.hpp

Spoiler

class ItemWaterbottle {
        class ducha {
            text = "QuickShower";
            script = "execVM 'fixes\showerbottle.sqf'";
        };        
    };   

@Cherdenko

Link to comment
Share on other sites

  • 1 month later...
2 hours ago, JohnnyBravo666 said:

Just change the _LastUsedTime variable to your restart cycle. so if you have a 3 hour restart cycle, change it to 10800.

mmm no jhonny  this is not the way.    U can put any number in _lastusedTime.. 10800 as you say for 3hs or 60 for a 60 sec restriction, any way if player logout and reconect again this _LastUsedTime return to 0.

Link to comment
Share on other sites

4 minutes ago, juandayz said:

mmm no jhonny  this is not the way.    U can put any number in _lastusedTime.. 10800 as you say for 3hs or 60 for a 60 sec restriction, any way if player logout and reconect again this _LastUsedTime return to 0.

So is there a way that you can think of @juandayz?

 

Wouldn't there have to be some kind of database interaction to keep track of when each player last showered?

Link to comment
Share on other sites

not sure, its not tested but change the code in your selfactions.sqf by- (try it annd dst work)

Spoiler

 


//SHOWER//
private["_playerPos","_canshower","_isPond","_isWell","_pondPos","_objectsWell","_objectsPond"];

//VARIABLES

_playerPos = getPosATL player;
_canshower = count nearestObjects [_playerPos, ["Land_pumpa","Land_water_tank"], 4] > 0;
_isPond = false;
_isWell = false;

_pondPos = [];
_objectsWell = [];

 

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

_LastUsedTime = 1360;
_Time = time - lastuse;

if (!_canshower) 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 {
                _canshower = true;
                if (_Time > _LastUsedTime) then {
                if (s_player_shower < 0) then {
                s_player_shower = player addAction [("<t color=""#3399cc"">" + ("SHOWER IN RIVER") + "</t>"), "fixes\showerON.sqf"];};

};
} else {
player removeAction s_player_shower;
    
            };
        };
    } forEach _objectsPond;
};

 

and showerON.sqf

Spoiler

private ["_dis","_sfx","_infectrand","_welcomeMessage","_camDistance"];
///VARIABLES

_infectrand = round(random 10);
_welcomeMessage = format["Nice you take a shower +400Humanity!, %1,",format["%1", name player]];
_camDistance = 60;
///////////////////////////////////
//NEGATIVES



///////////

//START SCRIPT
lastuse = time;

        _dis = 5;
        _sfx = "fillwater";
        [player,_sfx,0,false,_dis] call dayz_zombieSpeak;
        [player,_dis,true,(getPosATL player)] spawn player_alertZombies;
        [player,+400] call player_humanityChange;
        //RANDOM INFECTION START TO WORK
        if (_infectrand < 4) then {r_player_infected = true;
        cutText [format["%1, you get infected by some kind of virus",name player], "PLAIN DOWN"];
    };
    //CAMERA START
    showCinemaBorder true;
   camUseNVG false;               
   _camera = "camera" camCreate [(position player select 0)-2, position player select 1,(position player select 2)+_camDistance];
   _camera cameraEffect ["internal","back"];
   
   _camera camSetFOV 2.000;
   _camera camCommit 0;
   waitUntil {camCommitted _camera};
   
 
   _camera camSetTarget vehicle player;
   _camera camSetRelPos [0,0,2];
   _camera camCommit 8;
 
   cutText [_welcomeMessage, "PLAIN DOWN"];

   waitUntil {camCommitted _camera};
 
  _camera cameraEffect ["terminate","back"];
  camDestroy _camera;
  sleep 1;

 

 

Link to comment
Share on other sites

@chi

the only thing that i can thing at this moment to prevent this it  is add a watterbottle unfilled requiered to shower. and removee it once the player take a shower.  Also modify the humanity change +400 by +100

so in your showerON.sqf

Spoiler

 private ["_dis","_sfx","_LastUsedTime","_Time","_infectrand","_welcomeMessage","_camDistance","_has"];
///VARIABLES
_LastUsedTime = 1360;
_Time = time - lastuse;
_infectrand = round(random 10);
_welcomeMessage = format["Nice you take a shower +100Humanity!, %1,",format["%1", name player]];
_camDistance = 60;
_has = "ItemWaterbottleUnfilled" in magazines player;
///////////////////////////////////
//NEGATIVES


if(_Time < _LastUsedTime) exitWith {
    cutText [format["wait %1 seconds !",(round(_Time - _LastUsedTime))], "PLAIN DOWN"];
};
///////////

if (_has) then {
player removeMagazine "ItemWaterbottleUnfilled";
//START SCRIPT
lastuse = time;

        _dis = 5;
        _sfx = "fillwater";
        [player,_sfx,0,false,_dis] call dayz_zombieSpeak;
        [player,_dis,true,(getPosATL player)] spawn player_alertZombies;
        [player,+100] call player_humanityChange;
        //RANDOM INFECTION START TO WORK
        if (_infectrand < 4) then {r_player_infected = true;
        cutText [format["%1, you get infected by some kind of virus",name player], "PLAIN DOWN"];
    };
    //CAMERA START
    showCinemaBorder true;
   camUseNVG false;               
   _camera = "camera" camCreate [(position player select 0)-2, position player select 1,(position player select 2)+_camDistance];
   _camera cameraEffect ["internal","back"];
   
   _camera camSetFOV 2.000;
   _camera camCommit 0;
   waitUntil {camCommitted _camera};
   
 
   _camera camSetTarget vehicle player;
   _camera camSetRelPos [0,0,2];
   _camera camCommit 8;
 
   cutText [_welcomeMessage, "PLAIN DOWN"];

   waitUntil {camCommitted _camera};
 
  _camera cameraEffect ["terminate","back"];
  camDestroy _camera;
  sleep 1;
  };

at bottom of your selfactions.sqf

Spoiler

//SHOWER//
private["_playerPos","_canshower","_isPond","_isWell","_pondPos","_objectsWell","_objectsPond"];

//VARIABLES
 

_playerPos = getPosATL player;
_canshower = count nearestObjects [_playerPos, ["Land_pumpa","Land_water_tank"], 4] > 0;
_isPond = false;
_isWell = false;

_pondPos = [];
_objectsWell = [];

 

 

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


if (!_canshower) 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 {
                _canshower = true;
                if (s_player_shower < 0) then {
                s_player_shower = player addAction [("<t color=""#3399cc"">" + ("SHOWER IN RIVER") + "</t>"), "fixes\showerON.sqf"];};
} else {
player removeAction s_player_shower;
    
            };
        };
    } forEach _objectsPond;
};

again in your selfactions.sqf

Spoiler

find:

player removeAction s_player_studybody;
s_player_studybody = -1;

add bellow:

player removeAction s_player_shower;
s_player_shower = -1;

 

Link to comment
Share on other sites

You might have a issue with the relogging thing, because even epoch devs had the same issue with the bloodbags and such.  Bloodbags in the early dayz stages didnt fill you up to 12000 blood.  So you needed to take more than one most of the time. there was a time restriction between them also, if you relogged, restriction was gone.

Like Chi said, the only way to do this will be to add something in the database when the shower is taken.

Then also a script to check for this "new item" if someone tries to take a shower more than once.

and you would need a cleanup script removing that new item added on each restart so on the next restart players can shower again.

This is how i think it could work. but im far from a being a scripter lol

 

Link to comment
Share on other sites

Try the following. Right now, that might make it work only once per restart as I have looked at how the bank robbery script went as I knew they had a restriction coded in for once a restart. But I pulled a piece of that code out so this might work. Give this a try, otherwise you'll have to try a workaround on this.

 

Spoiler

private ["_dis","_sfx","_LastUsedTime","_Time","_infectrand","_welcomeMessage","_camDistance"];
///VARIABLES

// Checks if script is active, thanks Halvhjearne <3
if(isNil "script_in_progress")then{
        script_in_progress = false;
};
 
if(script_in_progress)exitwith{
        systemChat "This script is only useable once (untill restart)!";
};
script_in_progress = true;

_infectrand = round(random 10);
_welcomeMessage = format["Nice you take a shower +400Humanity!, %1,",format["%1", name player]];
_camDistance = 60;
///////////////////////////////////
//NEGATIVES

///////////

//START SCRIPT
lastuse = time;

        _dis = 5;
        _sfx = "fillwater";
        [player,_sfx,0,false,_dis] call dayz_zombieSpeak;
        [player,_dis,true,(getPosATL player)] spawn player_alertZombies;
        [player,+400] call player_humanityChange;
        //RANDOM INFECTION START TO WORK
        if (_infectrand < 4) then {r_player_infected = true;
        cutText [format["%1, you get infected by some kind of virus",name player], "PLAIN DOWN"];
    };
    //CAMERA START
    showCinemaBorder true;
   camUseNVG false;               
   _camera = "camera" camCreate [(position player select 0)-2, position player select 1,(position player select 2)+_camDistance];
   _camera cameraEffect ["internal","back"];
   
   _camera camSetFOV 2.000;
   _camera camCommit 0;
   waitUntil {camCommitted _camera};
   
 
   _camera camSetTarget vehicle player;
   _camera camSetRelPos [0,0,2];
   _camera camCommit 8;
 
   cutText [_welcomeMessage, "PLAIN DOWN"];

   waitUntil {camCommitted _camera};
 
  _camera cameraEffect ["terminate","back"];
  camDestroy _camera;
  sleep 1;

 

Link to comment
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now
  • Discord

×
×
  • Create New...