Jump to content

froggyluv

{Question} SImple Array Average

Recommended Posts

So this is where my Beauty School DropOut level math fails me - I need to count and average the Skill of any given group on the map.

Share this post


Link to post
Share on other sites

These seem to be working, give them a shot:

 

syntax: x = skill unitName

  Reveal hidden contents

 

syntax: x = unitName skill skillType

  Reveal hidden contents

 

 

Edited by opusfmspol
  • Like 1

Share this post


Link to post
Share on other sites
{
  _x setVariable ["grpMean", (units _x apply {skill _x}) call BIS_fnc_arithmeticMean ]
 } forEach allGroups;

 

recall the value by

_mean = _yourGroup getVariable "grpMean"

  • Like 1
  • Thanks 1

Share this post


Link to post
Share on other sites

Elegant solution pierremgi -many thanks

 

BIS_fnc_arithmeticMean -where do you even find this stuff?! :scratchchin:

Share this post


Link to post
Share on other sites
private _result = allGroups apply {private _acc = 0; {_acc = _acc + skill _x} forEach units _x; _acc / count units _x}
// Result: [0.4375,0.4375,1]
private _result = allGroups apply {private _acc = 0; {_acc = _acc + skill _x} forEach units _x; [_x, _acc / count units _x]}
// Result: [[B Alpha 1-1,0.4375],[B Alpha 1-2,0.4375],[B Alpha 1-3,1]]

 

  • Like 2

Share this post


Link to post
Share on other sites
  On 10/13/2017 at 5:12 AM, opusfmspol said:

These seem to be working, give them a shot:

 

 

 These are great man - i actually needed a subSkills breakdown as well -this REALLY helps thanks man!

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

×