Jump to content

Autorun Scripts


Ghostrider-GRG

Recommended Posts

2 hours ago, natoed said:

@Ghostrider-DbD-

Can still autorun underwater lol it is funny in away

When in the water you can not autorun but you can autorun into the water and keep going.

I'll record a video for shits n giggles

 

Quite amusing. I'll have to look into that when I have a chance. Does anyone have thoughts on a solution?

Link to comment
Share on other sites

I tried adding any check to stopAutoRun.sqf but i can't get it to work, autorun keeps going and can't be stop, error's out or locks up my test server lol

https://community.bistudio.com/wiki/underwater  is no good btw

have been trying with

https://community.bistudio.com/wiki/getPosASL

I'll have another crack when i have the time.

/*
  Adapted from code written by Exile Mod team.
 By Ghostrider-DbD-
 For DeathBeforeDishonorClan  
 * This work is licensed under the Creative Commons Attribution-NonCommercial-NoDerivatives 4.0 International License. 
 * To view a copy of this license, visit http://creativecommons.org/licenses/by-nc-nd/4.0/.
*/

if (DBD_AutorunOn) then
{
	DBD_AutorunOn = false;
	if ((vehicle player) isEqualTo player) then 			// checks if player is a vehicle	
	{
		if (alive player) then
		{
			hint "Autorun De-activated"; 	
			player switchMove "";
		};
	};
};
true

			// ASLtoATL getPosASL player
			// getPosasl player
			
/*	if ((vehicle player) isEqualTo player) then 			// checks if player is a vehicle
		else
		if ((getPosasl player) select 2 < -0.5) then		// checks if player in 0.5 meter in water

 

Link to comment
Share on other sites

2 hours ago, natoed said:

I tried adding any check to stopAutoRun.sqf but i can't get it to work, autorun keeps going and can't be stop, error's out or locks up my test server lol

https://community.bistudio.com/wiki/underwater  is no good btw

have been trying with

https://community.bistudio.com/wiki/getPosASL

I'll have another crack when i have the time.


/*
  Adapted from code written by Exile Mod team.
 By Ghostrider-DbD-
 For DeathBeforeDishonorClan  
 * This work is licensed under the Creative Commons Attribution-NonCommercial-NoDerivatives 4.0 International License. 
 * To view a copy of this license, visit http://creativecommons.org/licenses/by-nc-nd/4.0/.
*/

if (DBD_AutorunOn) then
{
	DBD_AutorunOn = false;
	if ((vehicle player) isEqualTo player) then 			// checks if player is a vehicle	
	{
		if (alive player) then
		{
			hint "Autorun De-activated"; 	
			player switchMove "";
		};
	};
};
true

			// ASLtoATL getPosASL player
			// getPosasl player
			
/*	if ((vehicle player) isEqualTo player) then 			// checks if player is a vehicle
		else
		if ((getPosasl player) select 2 < -0.5) then		// checks if player in 0.5 meter in water

 

The check for whether/when to stop autorun is done in the canrun.sqf script. I would add any check for being in water etc. there. 

Link to comment
Share on other sites

19 hours ago, natoed said:

I looking at the Example 2: _isUnderwater = eyePos player select 2 < 0;

https://community.bistudio.com/wiki/underwater

 

I see if i can come up with something tonight

 

 

in canrun.sqf try changing:

_canRun = (vehicle player == player && !(surfaceIsWater (getPos player)) && !((damage player) >= 0.5) && !(_injured) );

to 

private _underwater = (underwater player || eyePos player select 2 < 0 || surfaceIsWater (getPos player));

_canRun = (vehicle player == player && !(_underwater) && !((damage player) >= 0.5) && !(_injured) );

Link to comment
Share on other sites

Had a little play around with the code, will stop autorunning if the player enters water and changed hints to the new Epoch messages

autoRun.sqf

if (!DBD_AutorunOn) then
{
	_canRun = call DBD_canRun;
	if (_canRun) then
	{
		DBD_AutorunOn = true;
		["Autorun Activated", 3] call Epoch_message;
	};
}
else
{
	call DBD_stopAutoRun;
	player switchMove "";
};

canRun.sqf

private["_legsHit","_canRun","_allHitPointsDamage","_index"];
_legsHit = (vehicle player) getHitPointDamage "HitLegs";
_abdHit = (vehicle player) getHitPointDamage "HitAbdomen";
_diaphragmHit = (vehicle player) getHitPointDamage "HitDiaphragm";
_injured = if (_legsHit > 0.25 || _abdHit > 0.25 || _diaphragmHit > 0.25) then {true} else {false};
_overWater = !(position player isFlatEmpty  [-1, -1, -1, -1, 2, false] isEqualTo []);
_canRun = (vehicle player == player && !(_overWater) && !((damage player) >= 0.5) && !(_injured));
_canRun

stopAutoRun.sqf

if (DBD_AutorunOn) then
{
	DBD_AutorunOn = false;
	if ((vehicle player) isEqualTo player) then
	{
		if (alive player) then
		{
			["Autorun deactivated", 3] call Epoch_message;
			player switchMove "";
		};
	};
};
true

EPOCH_custom_OnEachFrame.sqf

if (DBD_AutorunOn) then {
	private _OK_toRun = call DBD_canRun;
	if (_OK_toRun) then 
	{
		player playAction "FastF";
	} else {
		DBD_AutorunOn = false;
		player switchMove "";
	};
};

 

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...