Jump to content
Sign in to follow this  
Coolinator

How to take out the stamina for soldiers or make it infinite stamina?

Recommended Posts

How to take out the stamina for soldiers or make it infinite stamina?

It's really annoying when playing as AT soldier, carrying launcher with 4 missiles. I was running really slow couldnt catch up with my other teammates. :(

Share this post


Link to post
Share on other sites

There's also this shitty hack.

while {true} do {
   player setFatigue 0;
   sleep 1;
};

Share this post


Link to post
Share on other sites

My addon (requires CBA). You can control maximum possible fatigue with it by setting CH_maxFatigue parameter from 0 to 1.

CH_maxFatigue = 0, will disable fatigue all together;

CH_maxFatigue = 1, will reset fatigue to vanilla value.

By default it set to 0.33.

Share this post


Link to post
Share on other sites
There's also this shitty hack.

while {true} do {
   player setFatigue 0;
   sleep 1;
};

Do i put that to a character initialization field or init.sqf? sorry im still not sure how to initialize it lol T_T ALso does it work on dedicated server?

like execVM "stamina.sqf"

stamina.sqf

while {true} do {
   player setFatigue 0;
   sleep 1;
};

---------- Post added at 01:13 ---------- Previous post was at 01:09 ----------

You could apply this command to all units.

Does the command work for multiplayer dedicated server? like when i respawn, the code still activated?

Share this post


Link to post
Share on other sites

"enableFatigue" not very reliable, you'll be better off using Iceman's method.

You can run it from wherever you like, but pay attention none of the code after that loop will be executed. Because loop is infinite.

Share this post


Link to post
Share on other sites
... stamina.sqf ...

If you are going to use a loop then this should suffice.

init.sqf

execVM "stamina.sqf"

stamina.sqf

if (isDedicated) exitWith {};
waitUntil {!(isNull player)};
while {!(isNull player)} do {
   player setFatigue 0;
   sleep 5;
};

---------- Post added at 16:36 ---------- Previous post was at 16:31 ----------

If you want to make it an optional lobby parameter

description.ext

class Params 
{
class Fatigue 
{ // paramsArray select 0
           title = "Fatigue:";
           values[] = {0,1};
    default = 0;
           texts[] = {"OFF","ON"};
};
};

init.sqf

if ((paramsArray select 0) == 0) then {execVM "fatigue.sqf";};

Share this post


Link to post
Share on other sites

I heard multiple people (myself included) report "while" conditions being unreliable and fail to trigger sometimes. So I would stay away from that. Just saying.

Share this post


Link to post
Share on other sites

to OP:

find the file "onPlayerRespawn.sqf" in your mission directory. If it does not exist, then create it.

Inside "onPlayerRespawn.sqf", deposit this code:

player enableFatigue FALSE;

...

enableFatigue appears unreliable to some, but that is because it does not carry over to the new player object after respawning. So it must be applied on each respawn to the new player object.

an alternative method, using your own Respawn EH. Put the below line in "init.sqf".

if (!isDedicated) then {
ehRespawn = player addEventHandler ["Respawn",{player enableFatigue FALSE;}];
};

^ Both have the same desired result.

Share this post


Link to post
Share on other sites

Okay so incase while conditions are unreliable, then any loop will suffice. Or..

["OEF_Fatigue_ID", "onEachFrame", {
   player setFatigue 0; 
}] call BIS_fnc_addStackedEventHandler; 

Share this post


Link to post
Share on other sites
Hmm. I've never encountered this. Anyone else confirm this?
Some people on this forum were saying the same, other than that I haven't been looking for evidence.

Share this post


Link to post
Share on other sites

Oops, semi-ninaj'd by MDCC with a probable working solution (given if the command is unreliable). I'd just use the command myself if I could. Even if it takes an EH. Take a loom at MDCC's code. Cheers.

Share this post


Link to post
Share on other sites
Okay so incase while conditions are unreliable, then any loop will suffice. Or..

["OEF_Fatigue_ID", "onEachFrame", {
   player setFatigue 0; 
}] call BIS_fnc_addStackedEventHandler; 

I mean conditions inside {}. You can just replace that with "if (conditions) exitWith {}". Pretty much same thing and works like a charm.

Share this post


Link to post
Share on other sites
Some people on this forum were saying the same, other than that I haven't been looking for evidence.

Ahh okay. Was just wondering, since I use them frequently. Eek.. :p

---------- Post added at 16:48 ---------- Previous post was at 16:47 ----------

I mean conditions inside {}. You can just replace that with "if (conditions) exitWith {}". Pretty much same thing and works like a charm.

Ahh, so true works. But "actual" conditions fail sometimes? Gotcha (I think). In that case, a simple exitwith would work.

Share this post


Link to post
Share on other sites
Ahh, so true works. But "actual" conditions fail sometimes?
Yeah, thats what I've seen.

Share this post


Link to post
Share on other sites

@ Coolinator -- LOL okay so... if you're not going to use the better EH solution by MDCC, and still want to use a loop then here's a run down of it all!! Phew! :)

init.sqf

if ((paramsArray select 0) == 0) then {execVM "fatigue.sqf";};

description.ext

class Params 
{
class Fatigue 
{ // paramsArray select 0
           title = "Fatigue:";
           values[] = {0,1};
    default = 0;
           texts[] = {"OFF","ON"};
};
};

fatigue.sqf

if (isDedicated) exitWith {};
waitUntil {!(isNull player)};
while {true} do {
   if (isNull player) exitWith {};
   player setFatigue 0;
   sleep 5;
};

Share this post


Link to post
Share on other sites

would this work

in your mission.SQF

if (local player) then {

player enableFatigue false;

player addMPEventhandler ["MPRespawn", {player enableFatigue false}];

};

Share this post


Link to post
Share on other sites
If you are going to use a loop then this should suffice.

init.sqf

execVM "stamina.sqf"

stamina.sqf

if (isDedicated) exitWith {};
waitUntil {!(isNull player)};
while {!(isNull player)} do {
   player setFatigue 0;
   sleep 5;
};

---------- Post added at 16:36 ---------- Previous post was at 16:31 ----------

If you want to make it an optional lobby parameter

description.ext

class Params 
{
class Fatigue 
{ // paramsArray select 0
           title = "Fatigue:";
           values[] = {0,1};
    default = 0;
           texts[] = {"OFF","ON"};
};
};

init.sqf

if ((paramsArray select 0) == 0) then {execVM "fatigue.sqf";};

okay thank you so much iceman!! your the best!!!! :)

Share this post


Link to post
Share on other sites

A loop isn't necessarily a bad idea, as it gives some control over Fatigue rather than just disabling. Example is the below block, an edited version of the above by iceman.

This block simulates a ghetto morale system. Within 50m of their squad leader, the soldiers will have a lower max fatigue value. If the group leader has more than 3 soldiers in his command, he gets a little fatigue boost.

In this manner you can use Fatigue as a small reward for players who stay with their squad leader, and for fireteam leaders to lead more players. :)

if (!isDedicated) then {
waitUntil {!(isNull player)};

private ["_maxF","_max1","_max2","_max3"];

_maxF = 0;
_max1 = 0.5;		// base max fatigue value
_max2 = 0.25;		// morale boost fatigue value
_max3 = 0.33;		// squad leader fatigue value

while {true} do {

	if (player == (leader (group player))) then {
		if ((count units group player) > 4) then {
			_maxF = _max2;
		} else {
			_maxF = _max3;
		};
	} else {
		if ((player distance (leader (group player))) < 50) then {
			_maxF = _max2;
		} else {
			_maxF = _max1;
		};
	};

	if ((getFatigue player) > _maxF) then {
		player setFatigue _maxF;
	};
	sleep 5;
};
};

Share this post


Link to post
Share on other sites
I heard multiple people (myself included) report "while" conditions being unreliable and fail to trigger sometimes. So I would stay away from that. Just saying.

I have never encountered unreliability with while loop conditions

_position = [0,0,0];
while {surfaceIsWater _position} do
{
_position set [0, random 30000];
_position set [1, random 30000];
};

I'm using this in the first mission I've ever made (for Arma 3), and it hasn't let me down. Always spawned on land

Share this post


Link to post
Share on other sites
@ Coolinator -- LOL okay so... if you're not going to use the better EH solution by MDCC, and still want to use a loop then here's a run down of it all!! Phew! :)

init.sqf

if ((paramsArray select 0) == 0) then {execVM "fatigue.sqf";};

description.ext

class Params 
{
class Fatigue 
{ // paramsArray select 0
           title = "Fatigue:";
           values[] = {0,1};
    default = 0;
           texts[] = {"OFF","ON"};
};
};

fatigue.sqf

if (isDedicated) exitWith {};
waitUntil {!(isNull player)};
while {true} do {
   if (isNull player) exitWith {};
   player setFatigue 0;
   sleep 5;
};

okay thank you much!!

I didn't really understand the conversation going on, its like reading another language lol >_< thank you for making it easier, i really appreacite it :)

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  

×