Comrades in Arms Discussion Board

Full Version: Critical mission making bug - Mission makers please read and acknowledge!
You're currently viewing a stripped down version of our content. View the full version with proper formatting.

EDIT: Bug fixed. Disregard.
There's a bug that causes all missions played on a dedicated server to have an AI with a skill of 1.0. Ever wondered why this game is so hard on coop nights although we use ASR AI? Well, there's your answer. There's a good chance it has been there, by the way, since Arma 2, and that explains a lot, too.

The bug is caused by the skill slider in the editor. Therefore, all mission makers, please use the init field to set the skill of the unit  (if 0.7 is the desired skill level for the unit)
Code:
this setSkill 0.7;

In case you'd like to have all AI using the same skill, you may use the following line in the your init.sqf (if 0.5 is the desired skill level):
Code:
{_x setSkill 0.5;} foreach allUnits;

if you need side specific setSkill:
Code:
{ if (side _x == EAST) then {_x setSkill 0.3;} }forEach allUnits;
{ if (side _x == WEST) then {_x setSkill 0.3;} }forEach allUnits;
{ if (side _x == RESISTANCE) then {_x setSkill 0.3;} }forEach allUnits;


Unless we play a mission of an author that has acknowledged this message, we will use a monitor to set a 0.6 skill for all the AI when we start the mission. That of course means that all AI will have the same skill level. If you want different skill levels for different AI groups or individual units, please use the first method above.

Mission makers please acknowledge this. Also, we would appreciate if you could update your missions that have not been completed yet only in the case you'd like to use different skill levels for different AI units or groups in the mission.

More details here.
Noted

edit: if you need side specific setSkill


{ if (side _x == EAST) then {_x setSkill 0.3;} }forEach allUnits;
{ if (side _x == WEST) then {_x setSkill 0.3;} }forEach allUnits;
{ if (side _x == RESISTANCE) then {_x setSkill 0.3;} }forEach allUnits;
Roger that, hopefully this gets fixed soon Smile
Thanks Outlawz, OP updated with side specific setSkill code.
Hoho man, that is one huge booboo BI made if this has been around for years.
Oh man....
Looks like Robalo is correct:
http://forums.bistudio.com/showthread.ph...ost2854985

[color=rgb(0, 0, 0)][/color][/color]
Quote:[color=rgb(51, 51, 51)][color=rgb(0, 0, 0)][/color][color=rgb(51, 51, 51)]Speaking of skillFinal, seems the interpolation algorithm is either bugged or intentionally altered so that when running setskill on clients on local units, the resulting final skill is a lot higher (about twice or even higher for accuracy) compared to when it's executed on a server, on units local to server.[/color][color=rgb(51, 51, 51)]This when CfgAISkill class settings, difficulty settings in profile, setskill parameters were identical on server and client.[/color][color=rgb(51, 51, 51)]To be clear, calling setskill then skillfinal with local arguments only.On a server, you get as expected, considering coefficients used in interpolation are <1, lower final skill values.But on a client:unit setskill ["aimingaccuracy", 0.396464];unit skillfinal "aimingaccuracy" => 0.623674 ! how come ?
What's the magic formula here ?
[/color]
[color=rgb(51, 51, 51)][size=1em]So set your AI skill twice as low as you actually want it to be.[/size][/color]
Even more sophistication:
PHP Code:
_baseSkill = <some number>;
{
  Â  _sideFactor = switch (side _x) do {
  Â  Â  Â  case west: {1.0};  Â  Â  Â  /* May vary according to your preferences */
  Â  Â  Â  case east: {0.8};
  Â  Â  Â  case resistance: {0.8};
  Â  };
  Â  _rankFactor = switch (rank _x) do {
  Â  Â  Â  "COLONEL": {1.0};
  Â  Â  Â  "MAJOR": {0.9};
  Â  Â  Â  "CAPTAIN": {0.8};
  Â  Â  Â  "LIEUTENANT": {0.6};
  Â  Â  Â  "SERGEANT": {0.5};
  Â  Â  Â  "CORPORAL": {0.4};
  Â  Â  Â  "PRIVATE": {0.3};
  Â  };
  Â  _x setSkill _baseSkill _sideFactor _rankFactor;
} forEach 
allUnits

Obviously, factors can be modified according to your preference.
Version of alwarren's code that works
Code:
_baseSkill = 0.5;
_sideFactor = 0;


{
       _checkSide = switch (side _x) do {
              case west: {_sideFactor = 1.0};       
              case east: {_sideFactor = 0.8};
              case resistance: {_sideFactor = 0.8};
       };
       _rankFactor = switch (rank _x) do {
              case "COLONEL": {1.0};
              case "MAJOR": {0.9};
              case "CAPTAIN": {0.8};
              case "LIEUTENANT": {0.6};
              case "SERGEANT": {0.5};
              case "CORPORAL": {0.4};
              case "PRIVATE": {0.3};
       };
       _x setSkill _baseSkill * _sideFactor * _rankFactor;
} forEach allUnits;
What didn't work on my original code? And why that _checkSide variable?
"_sideFactor = switch (side _x)"  returns a boolean, not a number


"_rankFactor = switch (rank _x) do {
"COLONEL": {1.0};" you need 'case' in front of the strings for the 'switch do' to work
(01-29-2015, 11:44 PM)Outlawz7 link Wrote: [ -> ][size=1em]"_sideFactor = switch (side _x)"  returns a boolean, not a number[/size]

Why would it return a boolean? It should return a float, just like the second switch.
EDIT: I think I know what's wrong, adding a default cause should fix the problem.

Quote:[size=1em] "_rankFactor = switch (rank _x) do {
"COLONEL": {1.0};" you need 'case' in front of the strings for the 'switch do' to work[/size]

True, forgot those.
(01-29-2015, 11:53 PM)Alwarren link Wrote: [ -> ]Why would it return a boolean? It should return a float, just like the second switch.
EDIT: I think I know what's wrong, adding a default cause should fix the problem.


Yep, that fixes it. I tried again, a civilian in the mission was throwing that boolean into the works.
Thanks for the heads up on the issue lads.
I have implemented Alwarrens rank based skill structure in my missions and will continue to add it into future missions.
Bug fixed. Closing thread.