Jump to content

[Release] Autorun


Shawn

Recommended Posts

By pressing 0, it lets the player run without the need to hold W. It automatically exits the script if the player walks into water, has a broken leg, or becomes either unconscious or dead.

1. Create a file called AutoRun.sqf

2. Open it, and paste the following:

if (player != vehicle player) exitWith {};
if (surfaceIsWater (getPosASL player)) exitWith {systemChat('Autorun currently unavailable.');};
if (r_fracture_legs or r_player_unconscious or deathHandled) exitWith {};
if (autoRunActive == 0) then {
	autoRunActive = 1;
	systemChat('Autorun Activated');
	systemChat('Check for missions or obstacles you may run into');
	autoRunThread = [] spawn 
	{
		while {autoRunActive == 1} do 
		{
			if ((player != vehicle player) or (surfaceIsWater (getPosASL player)) or 
			r_fracture_legs or r_player_unconscious or deathHandled) exitWith {call autoRunOff; systemChat('Autorun Deactivated');};
			player playAction "FastF";
			uiSleep 0.5;
		};
	};
} else {
	call autoRunOff;
	systemChat('Autorun Deactivated');
};
_handled = true;

3. Open up compiles.sqf and find:

dze_surrender_off = {
	player setVariable ["DZE_Surrendered", false, true];
	DZE_Surrender = false;
};

4. Paste the following directly below it:

autoRunOff = {
	autoRunActive = 0;
	terminate autoRunThread;
	player playActionNow "Stop";
};

5. Open up variables.sqf and find:

DZE_SaveTime = 30;

6. Paste this line underneath:

autoRunActive = 0;

7. Finally open up dayz_spaceInterrupt.sqf and find:

// Disable ESC after death
if (_dikCode == 0x01 && r_player_dead) then {
	_handled = true;
};

8. Insert directly below:

if (_dikCode == 0x0B) then {
	[]execVM "Path\To\AutoRun.sqf";
};

Remember, it does not have to be 0 to activate the script. You can change 0 by replacing 0x0B in the dayz_spaceInterrupt.sqf edit you made. Here is a link for other DIK KeyCodes:

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

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

×
×
  • Create New...