setFatigue: Difference between revisions

From Bohemia Interactive Community
Jump to navigation Jump to search
mNo edit summary
No edit summary
Line 40: Line 40:
<br>
<br>
[[setFatigue]] will affect fatigue of a local unit only. If you execute it on remote unit, the [[getFatigue]] value will only change locally with no effect on remote unit. Scripted [[setFatigue]] changes don't broadcast at all. In short, use [[setFatigue]] on local units only.<br>
[[setFatigue]] will affect fatigue of a local unit only. If you execute it on remote unit, the [[getFatigue]] value will only change locally with no effect on remote unit. Scripted [[setFatigue]] changes don't broadcast at all. In short, use [[setFatigue]] on local units only.<br>
<dd class="notedate">Posted on 15 October, 2015
<dt class="note">'''[[User:Pierre MGI|Pierre MGI]]'''<dd class="note">
<br>
Usage of this command is tricky as the fatigue is always changing!  You need to use a loop for enabling a "stable level" of fatigue.<br/>
If you want to  limit the fatigue for players in a group, just add in init.sqf, something like:<br/>
0= [] spawn {<br/>
{while {alive _x} do {scopename "fatigued"; sleep 0.5; waituntil {sleep 0.5; getFatigue _x > 0.4 }; _x setFatigue 0.4}; breakTo "fatigued"} forEach units my_group;
};<br/>
Precision tends to be reached with smaller value of sleep commands, probably at the cost of CPU load * nbr of players/units in group.
This works for AI units as well.<br/>
<!-- Note Section END -->
<!-- Note Section END -->
</dl>
</dl>

Revision as of 06:56, 16 October 2015

Hover & click on the images for description

Description

Description:
Sets the person's fatigue, from 0 to 1.
Groups:
Uncategorised

Syntax

Syntax:
unit setFatigue value
Parameters:
unit: Object
value: Number
Return Value:
Nothing

Examples

Example 1:
player setFatigue 1;

Additional Information

See also:
getFatigueenableFatigue

Notes

Report bugs on the Feedback Tracker and/or discuss them on the Arma Discord or on the Forums.
Only post proven facts here! Add Note

Notes

Posted on 05 April, 2014
Killzone_Kid

setFatigue will affect fatigue of a local unit only. If you execute it on remote unit, the getFatigue value will only change locally with no effect on remote unit. Scripted setFatigue changes don't broadcast at all. In short, use setFatigue on local units only.
Posted on 15 October, 2015
Pierre MGI

Usage of this command is tricky as the fatigue is always changing! You need to use a loop for enabling a "stable level" of fatigue.
If you want to limit the fatigue for players in a group, just add in init.sqf, something like:
0= [] spawn {
{while {alive _x} do {scopename "fatigued"; sleep 0.5; waituntil {sleep 0.5; getFatigue _x > 0.4 }; _x setFatigue 0.4}; breakTo "fatigued"} forEach units my_group; };
Precision tends to be reached with smaller value of sleep commands, probably at the cost of CPU load * nbr of players/units in group. This works for AI units as well.

Bottom Section