Sc0rc3d 1 Posted April 29, 2013 Hi Guys, i build a few Missions for Arma III all works great so far the only problem seems to be the Skill of the AI. In all my Missions i set in the Editor the AI Skill slider to Max right (In the Mission.sqm its like skill=0.2) in the Most Mission it works great but in the last Time the AI is like a Terminator. One Example: An AI is ~50Meters in Front of me with his back in my direction. If i Fire a Shot in his direction he immediately turns around and i get a headshot thats all in ~2sec. I tryed it many times with mostly the same result. I also tryed the TPWCAS - TPWC AI Suppression System A3 but with the same strange result. I also tryed to set the AI Skill in the init.sqf like: { _x setSkill ["aimingspeed", 0.1]; _x setSkill ["spotdistance", 0.1]; _x setSkill ["aimingaccuracy", 0.1]; _x setSkill ["aimingshake", 0.1]; _x setSkill ["spottime", 0.1]; _x setSkill ["spotdistance", 0.5]; _x setSkill ["commanding", 0.5]; _x setSkill ["general", 0.5]; } forEach allUnits; any Ideas to solve this thing? greetings Sc0rc3d Share this post Link to post Share on other sites
mikie boy 18 Posted April 29, 2013 You can try making a small function and pass that newly created unit/group to that aiskill function. I found if you set the skill using allunits generically it wouldnt work. _unit = "soldiertype" createunit [position player, _grp]; [_unit] spawn Fnc_aiSkillsetting; Fnc_aiSkillSetting = { _unit= this select 0; _unit setSkill ["aimingspeed", 0.1]; _unit setSkill ["spotdistance", 0.1]; _unit setSkill ["aimingaccuracy", 0.1]; _unit setSkill ["aimingshake", 0.1]; _unit setSkill ["spottime", 0.1]; _unit setSkill ["spotdistance", 0.5]; _unit setSkill ["commanding", 0.5]; _unit setSkill ["general", 0.5]; }; Share this post Link to post Share on other sites
1para{god-father} 105 Posted April 29, 2013 I was having the same issue if I spawn anything via script, for some reason it ignores any setting on server and set All skill to 1 This works for me Just take out Debug bit once testing is complete , always good to see on Dedi what is happening :) _Grp1 = [_spos, EAST, (configfile >> "CfgGroups" >> "East" >> "OPF_F" >> "Infantry" >> _randomsquad)] call BIS_fnc_spawnGroup; [_Grp1] call God_fnc_Skill; God_fnc_Skill ={ _groupnamed = _this select 0; _leaderguy = leader _groupnamed; _leaderguy setskill 0.55; { _x setskill ["aimingAccuracy",0.45]; _x setskill ["spotDistance",0.55]; _x setskill ["spotTime",0.55]; _x setskill ["courage",0.50]; _x setskill ["commanding",0.50]; _x setskill ["aimingShake",0.55]; _x setskill ["aimingSpeed",0.60]; //////DEBUG//////Comment out when working///////////////// _aA = _x skill "aimingAccuracy"; _aS = _x skill "aimingShake"; _aSp = _x skill "aimingSpeed"; _e = _x skill "Endurance"; _sD = _x skill "spotDistance"; _sT = _x skill "spotTime"; _c = _x skill "courage"; _rS =_x skill "reloadSpeed"; diag_log format [ "unit: %1\naimingAccuracy: %2\naimingShake: %3 \naimingSpeed: %4\nEndurance: %5\nspotDistance: %6 \nspotTime: %7\ncourage: %8\nreloadSpeed: %9" ,_x,_aA,_aS,_aSp,_e,_sD,_sT,_c,_rS]; } foreach units _groupnamed ; }; Share this post Link to post Share on other sites
Sc0rc3d 1 Posted April 30, 2013 I don't Spawn Units just the preplaced in the Editor and let them patrol with UPS. How can i adept your Script? -.- Share this post Link to post Share on other sites
mikie boy 18 Posted April 30, 2013 Veh = [This] execvm "script name.sqf"; or use spawn. In the init box of unit in editor Share this post Link to post Share on other sites
falconx1 13 Posted June 30, 2013 (edited) when setting AI skill using: setskill In multiplayer, will all the spawned AI have the new setskill for all players on the server? or do i need to use "if server" or something like that Example _grp1 = createGroup east; _grp1 = [getMarkerPos RandomDirection, east, (configfile >> "CfgGroups" >> "East" >> "OPF_F" >> "Infantry" >> "OIA_InfTeam")] call BIS_fnc_spawnGroup; _wp0 = _grp1 addWaypoint [AttackMarkerLocation,0]; _wp0 setWaypointType "SAD"; _wp0 setWaypointSpeed "NORMAL"; _grpname = _this select 0; _grpleader = leader _grpname; _grpleader setskill 0.25; //-- easy AI Edited June 30, 2013 by falconx1 Share this post Link to post Share on other sites
gammadust 12 Posted August 22, 2013 I was having the same issue if I spawn anything via script, for some reason it ignores any setting on server and set All skill to 1 There is an identified issue with the skill (sets it to 1 instead of leaving it default) when using BIS_fnc_spawnGroup. It also ignores the azimuth of the group. Vote it up. Temporary fix of the function: //scriptName "Functions\spawning\fn_spawnGroup.sqf"; /* File: spawnGroup.sqf Author: Joris-Jan van 't Land, modified by Thomas Ryan Description: Function which handles the spawning of a dynamic group of characters. The composition of the group can be passed to the function. Alternatively a number can be passed and the function will spawn that amount of characters with a random type. Parameter(s): _this select 0: the group's starting position (Array) _this select 1: the group's side (Side) _this select 2: can be three different types: - list of character types (Array) - amount of characters (Number) - CfgGroups entry (Config) _this select 3: (optional) list of relative positions (Array) _this select 4: (optional) list of ranks (Array) _this select 5: (optional) skill range (Array) _this select 6: (optional) ammunition count range (Array) _this select 7: (optional) randomization controls (Array) 0: amount of mandatory units (Number) 1: spawn chance for the remaining units (Number) _this select 8: (optional) azimuth (Number) Returns: The group (Group) */ //Validate parameter count if ((count _this) < 3) exitWith {debugLog "Log: [spawnGroup] Function requires at leat 3 parameters!"; grpNull}; private ["_pos", "_side"]; _pos = [_this, 0, [], [[]]] call BIS_fnc_param; _side = [_this, 1, sideUnknown, [sideUnknown]] call BIS_fnc_param; private ["_chars", "_charsType", "_types"]; _chars = [_this, 2, [], [[], 0, configFile]] call BIS_fnc_param; _charsType = typeName _chars; if (_charsType == (typeName [])) then { _types = _chars; } else { if (_charsType == (typeName 0)) then { //Only a count was given, so ask this function for a good composition. _types = [_side, _chars] call BIS_fnc_returnGroupComposition; } else { if (_charsType == (typeName configFile)) then { _types = []; }; }; }; private ["_positions", "_ranks", "_skillRange", "_ammoRange", "_randomControls"]; _positions = [_this, 3, [], [[]]] call BIS_fnc_param; _ranks = [_this, 4, [], [[]]] call BIS_fnc_param; _skillRange = [_this, 5, [], [[]]] call BIS_fnc_param; _ammoRange = [_this, 6, [], [[]]] call BIS_fnc_param; _randomControls = [_this, 7, [-1, 1], [[]]] call BIS_fnc_param; //Fetch the random controls. private ["_minUnits", "_chance"]; _minUnits = _randomControls select 0; _chance = _randomControls select 1; private ["_azimuth"]; _azimuth = [_this, 8, 0, [0]] call BIS_fnc_param; //Check parameter validity. //TODO: Check for valid skill and ammo ranges? if ((typeName _pos) != (typeName [])) exitWith {debugLog "Log: [spawnGroup] Position (0) should be an Array!"; grpNull}; if ((count _pos) < 2) exitWith {debugLog "Log: [spawnGroup] Position (0) should contain at least 2 elements!"; grpNull}; if ((typeName _side) != (typeName sideEnemy)) exitWith {debugLog "Log: [spawnGroup] Side (1) should be of type Side!"; grpNull}; if ((typeName _positions) != (typeName [])) exitWith {debugLog "Log: [spawnGroup] List of relative positions (3) should be an Array!"; grpNull}; if ((typeName _ranks) != (typeName [])) exitWith {debugLog "Log: [spawnGroup] List of ranks (4) should be an Array!"; grpNull}; if ((typeName _skillRange) != (typeName [])) exitWith {debugLog "Log: [spawnGroup] Skill range (5) should be an Array!"; grpNull}; if ((typeName _ammoRange) != (typeName [])) exitWith {debugLog "Log: [spawnGroup] Ammo range (6) should be an Array!"; grpNull}; if ((typeName _randomControls) != (typeName [])) exitWith {debugLog "Log: [spawnGroup] Random controls (7) should be an Array!"; grpNull}; if ((typeName _minUnits) != (typeName 0)) exitWith {debugLog "Log: [spawnGroup] Mandatory units (7 select 0) should be a Number!"; grpNull}; if ((typeName _chance) != (typeName 0)) exitWith {debugLog "Log: [spawnGroup] Spawn chance (7 select 1) should be a Number!"; grpNull}; if ((typeName _azimuth) != (typeName 0)) exitWith {debugLog "Log: [spawnGroup] Azimuth (8) should be a Number!"; grpNull}; if ((_minUnits != -1) && (_minUnits < 1)) exitWith {debugLog "Log: [spawnGroup] Mandatory units (7 select 0) should be at least 1!"; grpNull}; if ((_chance < 0) || (_chance > 1)) exitWith {debugLog "Log: [spawnGroup] Spawn chance (7 select 1) should be between 0 and 1!"; grpNull}; if (((count _positions) > 0) && ((count _types) != (count _positions))) exitWith {debugLog "Log: [spawnGroup] List of positions (3) should contain an equal amount of elements to the list of types (2)!"; grpNull}; if (((count _ranks) > 0) && ((count _types) != (count _ranks))) exitWith {debugLog "Log: [spawnGroup] List of ranks (4) should contain an equal amount of elements to the list of types (2)!"; grpNull}; //Convert a CfgGroups entry to types, positions and ranks. if (_charsType == (typeName configFile)) then { _ranks = []; _positions = []; for "_i" from 0 to ((count _chars) - 1) do { private ["_item"]; _item = _chars select _i; if (isClass _item) then { _types = _types + [getText(_item >> "vehicle")]; _ranks = _ranks + [getText(_item >> "rank")]; _positions = _positions + [getArray(_item >> "position")]; }; }; }; private ["_grp"]; _grp = createGroup _side; //Create the units according to the selected types. for "_i" from 0 to ((count _types) - 1) do { //See if this unit should be skipped. private ["_skip"]; _skip = false; if (_minUnits != -1) then { //Has the mandatory minimum been reached? if (_i > (_minUnits - 1)) then { //Has the spawn chance been satisfied? if ((random 1) > _chance) then {_skip = true}; }; }; if (!_skip) then { private ["_unit", "_type"]; _type = _types select _i; //If given, use relative position. private ["_itemPos"]; if ((count _positions) > 0) then { private ["_relPos"]; _relPos = _positions select _i; _relPos = [_relPos, 360 - _azimuth] call BIS_fnc_rotateVector2D; // added line _itemPos = [(_pos select 0) + (_relPos select 0), (_pos select 1) + (_relPos select 1)]; } else { _itemPos = _pos; }; //Is this a character or vehicle? if (getNumber(configFile >> "CfgVehicles" >> _type >> "isMan") == 1) then { //_unit = _grp createUnit [_type, _itemPos, [], 0, "FORM"]; _type createUnit [_itemPos, _grp]; // added line _unit = (units _grp) select ((count units _grp) - 1); // added line _unit setDir _azimuth; } else { _unit = ([_itemPos, _azimuth, _type, _grp] call BIS_fnc_spawnVehicle) select 0; }; //If given, set the unit's rank. if ((count _ranks) > 0) then { //[_unit,_ranks select _i] call bis_fnc_setRank; }; //If a range was given, set a random skill. if ((count _skillRange) > 0) then { private ["_minSkill", "_maxSkill", "_diff"]; _minSkill = _skillRange select 0; _maxSkill = _skillRange select 1; _diff = _maxSkill - _minSkill; _unit setUnitAbility (_minSkill + (random _diff)); }; //If a range was given, set a random ammo count. if ((count _ammoRange) > 0) then { private ["_minAmmo", "_maxAmmo", "_diff"]; _minAmmo = _ammoRange select 0; _maxAmmo = _ammoRange select 1; _diff = _maxAmmo - _minAmmo; _unit setVehicleAmmo (_minAmmo + (random _diff)); }; }; }; //--- Sort group members by ranks (the same as 2D editor does it) private ["_newGrp"]; _newGrp = createGroup _side; while {count units _grp > 0} do { private ["_maxRank","_unit"]; _maxRank = -1; _unit = objnull; { _rank = rankid _x; if (_rank > _maxRank) then {_maxRank = _rank; _unit = _x;}; } foreach units _grp; [_unit] joinsilent _newGrp; }; _newGrp selectleader (units _newGrp select 0); deletegroup _grp; _newGrp Share this post Link to post Share on other sites