-
Notifications
You must be signed in to change notification settings - Fork 5
AI Skill
File location | f\setAISkill |
Enabled by default? | Yes |
Enable/Disable in | init.sqf/description.ext |
Runs on | Server/HC |
The AI's skill setting is defined by various 'sub-skills' - such as endurance or accuracy - which cannot be set in the editor directly. Depending on the mission maker's preference they might prefer AI to be smart and reactive but less precise. The AI Skill Selector component allows mission makers to both set a standard skill level for the AI and tweak the various sub-skills.
By default, the following AI skill options are available for each side:
Option | AI Skill | Corresponding skill value in-game |
---|---|---|
0 | Super | 1.0 |
1 | High | 0.7 |
2 | Medium (default) | 0.6 |
3 | Low | 0.5 |
The default skill values affect every sub-skill of a unit. To view the default values of all sub-skills open the file f\setAISkill\f_setAISkill.sqf and look for the following code segment:
f_var_skillSet = [
0.45, // aimingAccuracy
0.5, // aimingShake
0.5, // aimingSpeed
0.65, // spotDistance
0.7, // spotTime
1.2, // courage
2, // reloadSpeed
2, // commanding
1.2 // general
];
These values are the sub-skills a unit set to the overall skill level of Super
would have. For all (other) skill levels the values from the f_var_skillSet
array are multiplied using the overall skill values (see above table). Values over 1 ensure that certain skills of the AI are always on the higher end of the spectrum, to avoid sluggish AI behavior on low or medium skill levels.
Sub-skill randomization
Furthermore, a unit's sub-skills are affected by small randomization, controlled by this block of code further down in the same file:
// The final skill will be within +/- this range
f_var_skillRandom = 0.08;
This randomization controls the amount that a sub-skill can differ between two units of the same overall skill level. For example, two units set to the medium overall skill level (0.6) would have a base reloadSpeed
of 1.2 (2*0.6) and aimingAccuracy
of 0.33 (0.55 * 0.6). However, due to randomization these values can vary in a degree from 0.85 – 1.35 and 0.25 – 0.41 respectively.
Note for server configuration / hosting
Remember that these values are also affected by the precision and skill values set in your game difficulty menu and the server.cfg. Reducing these will also lower the values set by the F3 AI Skill Selector. Recommended values are around 0.35 for precisionAI and 0.85 for skillAI.
For more information, see the https://community.bistudio.com/wiki/Category:AI
Civilian units will use the skill setting of one of the three combatant sides. To change which side's skill setting will govern the skill setting of civilian units open the file init.sqf
and look for following line:
f_var_civAI = independent;
By default, the component is configured so that the skill setting for the Independent
side will govern the skill setting of civilian units.
You can change change by choosing west
for BLUFOR, east
for OPFOR, or independent
for INDEPENDENT.
If for example you want the majority of your AI to have 'medium' skill but want to enforce 'super' skill on a specific group of units, put this in the unit init:
[this,1] call f_fnc_setAISkill;
The second parameter dictates the multiplicator used for the skill-values, in this example it is identical to the one which is used by the super
skill level. The AI's skill will be set with this level and ignored by f_setAISkill.sqf
.
To save processing resources this script does not periodically check for spawned units to update their skill level. However, it does flag all units that were already processed. To affect newly created units you can have several options:
Option 1: Scan all present units and update new ones
Run this command on the server:
[] execVM "f\setAISkill\f_setAISkill.sqf";
This will loop through all units in the mission and process those which skill was not modified yet.
Option 2: Update specific list of units
Run this command on the server:
[unit1,unit2,unit3,unit4] execVM "f\setAISkill\f_setAISkill.sqf";
If you're able to create an array of all newly spawned units you can pass it to the script. This will save some processing power as the script will only loop through those units instead of checking every existing unit.
You can also use this for individual units by passing [unitname]
instead.
A curator created by f_fnc_zeusInit
(such as through the Admin briefing will automatically detect if the AI Skill Selector is active and use it to set the skills of newly created units.
Note: The skill-level for the unit's side needs to be set in the parameters and f_setAISkill.sqf
needs to have run once.
Open the file init.sqf
and look for the following line:
[] execVM "f\setAISKill\f_setAISkill.sqf";
and change it to:
//[] execVM "f\setAISKill\f_setAISkill.sqf";
Open the file description.ext
and look for the code segment entitled:
// F3 - AI Skill Selector
Comment out the classes f_param_AISkill_BLUFOR
, f_param_AISkill_OPFOR
, and f_param_AISkill_INDP
like this:
/*
class f_param_AISkill_BLUFOR
{
...
};
class f_param_AISkill_OPFOR
{
...
};
class f_param_AISkill_INDP
{
...
};
*/
-
Keep in mind that skill levels are also affected by the precision and skill values set in your game difficulty and the server.cfg. At Folk ARPS we have found settings of 0.35/0.85 for our server to provide a balanced experiencing with medium and high level AI.
-
You don't need to enable all three blocks in the file description.ext.', just the block(s) of the side(s) which you need to control.
-
If you want a editor placed unit to be ignored by the AI Skill Selector component and use the skill slider value instead, put this code in its init:
this setVariable ["f_setAISkill",true];
- Assign Gear
- Assign Gear AI
- Authorized Crew Check
- Briefing
- Casualties Cap
- Disable Thermals
- Dynamic View Distance
- E & E Check
- FCS
- Fire Team Member Markers
- Group Markers
- Group Join
- Map Click Teleport
- Medical System
- Mission Conditions
- Multiplayer Ending Controller
- Nametags
- Premount
- Radio
- Remove Body
- Safe Start
- Group ID
- Color Teams
- AI Skill
- Spectator
- Zeus Support