Jump to content
Sign in to follow this  

[Release] Take a break script (useless script)

Recommended Posts

Hi all


Need to pee during gunfight ? Or are you often disturbed? In short, you don't want to die a cowardly death?

Install go_away_from_keyboard on your server !


Seriously :


This script is inspired by the "Take a break" mode in Left 4 Dead, which is present in the pause menu. (in L4D, the name of the console command is go_away_from_keyboard, hence its name)


Its purpose is to give control of the player to an AI if the player is AFK (after 30 or 60 seconds) or by simple menu action, or both.

The player can retake control by pressing the "reload" key.


There is no real way to give control to the AI while remaining the "player". With the exception of the Intro/Outro scenarios

So I emulated that with a player change and a camera change.
This is the beginning of a solution (functional as is) but has a drawback:
If the bot (who control the player) is killed, it doesn't respawn, even after the return of the player, to overcome this, I had to "allowDamage false" (During all the time that the player will be a bot) until a viable solution.


AI and mission creators may find their use in this script (to debug decision trees/FSM, for example)


Credits :

Thanks to tpw for basecode :

Script to Check for Idle Player - ARMA 3 - MISSION EDITING & SCRIPTING - Bohemia Interactive Forums



//											CONFIG													//

//Activation Methode
_ActivationByAction = true;
_ActivationByIdle = true;
_IdleTimeLimit = 60;

//											END CONFIG												//

time_to_idle = time + _IdleTimeLimit;
(findDisplay 46) displayAddEventHandler ["keyDown", "_this call fnc_key"];

fnc_key = 
time_to_idle = time + _IdleTimeLimit;

fnc_idle =
	_Player = _this;
	_Player setSkill 1;
	_Player allowDamage false; //the AIs does not respawn, if AI is dead, the respawn is broken (waiting for a solution)
	_FakeGroup = createGroup side _this;

	_FakePlayer = _FakeGroup createUnit ["VirtualCurator_F", position player, [], 0, "NONE"];
	_FakePlayer allowDamage false;
	_FakePlayer attachTo [_Player, [0,0,0]]; //To avoid problems with scripts that use player position

	selectPlayer _FakePlayer;
	switchCamera _Player;

	_PlayerGroup = group _Player;
	_PlayerGroup onMapSingleClick "for '_i' from count waypoints _this - 1 to 0 step -1 do {deleteWaypoint [_this, _i];}; _this addWaypoint [_pos, 0]"; //On map click, set waypoints to yourself (move the bot)

	hint "Press 'Reload' button for retake control";
	waitUntil{_FakePlayer attachTo [_Player, [0,0,0]];inputAction "reloadMagazine" > 0};

	selectPlayer _Player;
	switchCamera _Player;
    _Player allowDamage true;
	deleteVehicle _FakePlayer;
	deleteGroup _FakeGroup;
	_PlayerGroup onMapSingleClick "";

if(_ActivationByAction) then
		_x addAction ["Go away from keyboard", {_this#1 call _this#3;}, fnc_idle];
	} forEach allPlayers;

if(_ActivationByIdle) then
	while {true} do
		if (time > time_to_idle) then
			player call fnc_idle;
			time_to_idle = time + _IdleTimeLimit;
	sleep 5;	


  • Like 3
  • Thanks 1
  • Haha 1

Share this post

Link to post
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in

Sign In Now
Sign in to follow this