Jump to content
migueldarius

Help with AI Skill for each side please.

Recommended Posts

Hello everyone, someone can help me to fix my script please. I am a beginer in this, somebody can tell my why my script doesn't work? I want that OPFOR have 0% skills and BLUFOR complete 100%. :down:
 

if NOT(isServer) exitWith {};

[] spawn 
{
while {true} do
	{
	sleep 10;

		{
		if ((side _x) == East) then {
			_x setSkill ["aimingspeed", 0.1];
			_x setSkill ["aimingaccuracy", 0.1];
			_x setSkill ["aimingshake", 0.1];
			_x setSkill ["spottime", 0.1];
			_x setSkill ["spotdistance", 0.1];
			_x setSkill ["courage", 0.1];
			_x setSkill ["reloadSpeed", 0.1];
			_x setSkill ["commanding", 0.1];
			};
		sleep 2;
		if ((side _x) == West) then {
			_x setSkill ["aimingspeed", 1];
			_x setSkill ["aimingaccuracy", 1];
			_x setSkill ["aimingshake", 1];
			_x setSkill ["spottime", 1];
			_x setSkill ["spotdistance", 1];
			_x setSkill ["courage", 1];
			_x setSkill ["reloadSpeed", 1];
			_x setSkill ["commanding", 1];
			};
		} 
	forEach allUnits;
	}
};

 

Share this post


Link to post
Share on other sites

Missing semicolon at second last bracket

sent from mobile using Tapatalk

Share this post


Link to post
Share on other sites

This script will set the skill of each unit every 10 seconds for the duration of your servers's session, EVEN though you've already set their skill?

I assume you're doing this so that the skill of newly spawned AI also get these skill settings.

 

Mmmmm.. Now if only there was a script that already did this...

 

Oh yeah, there is. See How to set AI Skills in init code and turn it into a script.

 

Check out Serena's optional suggestion to mine, and especially Larrow's updated scripts too.

Share this post


Link to post
Share on other sites

What beerkan said.

Alternatively:

if NOT(isServer) exitWith {};

[] spawn 
{
while {true} do
	{
		{
			_x setSkill ["aimingspeed", 0.1];
			_x setSkill ["aimingaccuracy", 0.1];
			_x setSkill ["aimingshake", 0.1];
			_x setSkill ["spottime", 0.1];
			_x setSkill ["spotdistance", 0.1];
			_x setSkill ["courage", 0.1];
			_x setSkill ["reloadSpeed", 0.1];
			_x setSkill ["commanding", 0.1];
			_x setVariable ["TAG_fnc_skillSet",true];
		} forEach (allUnits select {side _x isEqualTo east AND !(_x getVariable ["TAG_fnc_skillSet",false])});
		{
			_x setSkill ["aimingspeed", 1];
			_x setSkill ["aimingaccuracy", 1];
			_x setSkill ["aimingshake", 1];
			_x setSkill ["spottime", 1];
			_x setSkill ["spotdistance", 1];
			_x setSkill ["courage", 1];
			_x setSkill ["reloadSpeed", 1];
			_x setSkill ["commanding", 1];
			_x setVariable ["TAG_fnc_skillSet",true];
		} forEach (allUnits select {side _x isEqualTo west AND !(_x getVariable ["TAG_fnc_skillSet",false])});
	sleep 10;
	}
};		 

This will only set skill on units once and should run a bit better performance wise.

Cheers

  • Like 1
  • Thanks 1

Share this post


Link to post
Share on other sites
On 4/21/2017 at 9:05 AM, Grumpy Old Man said:

What beerkan said.

Alternatively: 


if NOT(isServer) exitWith {};

[] spawn 
{
while {true} do
	{
		{
			_x setSkill ["aimingspeed", 0.1];
			_x setSkill ["aimingaccuracy", 0.1];
			_x setSkill ["aimingshake", 0.1];
			_x setSkill ["spottime", 0.1];
			_x setSkill ["spotdistance", 0.1];
			_x setSkill ["courage", 0.1];
			_x setSkill ["reloadSpeed", 0.1];
			_x setSkill ["commanding", 0.1];
			_x setVariable ["TAG_fnc_skillSet",true];
		} forEach (allUnits select {side _x isEqualTo east AND !(_x getVariable ["TAG_fnc_skillSet",false])});
		{
			_x setSkill ["aimingspeed", 1];
			_x setSkill ["aimingaccuracy", 1];
			_x setSkill ["aimingshake", 1];
			_x setSkill ["spottime", 1];
			_x setSkill ["spotdistance", 1];
			_x setSkill ["courage", 1];
			_x setSkill ["reloadSpeed", 1];
			_x setSkill ["commanding", 1];
			_x setVariable ["TAG_fnc_skillSet",true];
		} forEach (allUnits select {side _x isEqualTo west AND !(_x getVariable ["TAG_fnc_skillSet",false])});
	sleep 10;
	}
};		 

This will only set skill on units once and should run a bit better performance wise.

Cheers 

 

not working fo me

Share this post


Link to post
Share on other sites
1 hour ago, AlexMercerIV said:

not working fo me

How are you running the script, and coming to the conclusion that its not working?

Got to provide details or you get 20 questions or no response from anyone.

  • Like 1

Share this post


Link to post
Share on other sites

I tried to apply to "Zeus" and the bots fired single at 300m with a probability of 1/4 but with such parameters they just need to shoot at the ground

Share this post


Link to post
Share on other sites
3 minutes ago, AlexMercerIV said:

I tried to apply to "Zeus"

You have a mission you created and ran the script through the init.sqf and the script gave you those results?

 

Share this post


Link to post
Share on other sites

Just a question: Why do you avoid server with your first line? BI doc is not helpful for this point. No clue on where setSkill should be applied. But server seems to me the right place for AIs. Just a feeling.

  • Like 1

Share this post


Link to post
Share on other sites
3 minutes ago, Gunter Severloh said:

You have a mission you created and ran the script through the init.sqf and the script gave you those results? 

 

yes

Share this post


Link to post
Share on other sites
1 hour ago, AlexMercerIV said:

yes

 

Hello there AlexMercerIV !

 

You can check also here :

 

  • Like 1

Share this post


Link to post
Share on other sites

What is working for me is

IQRA.sqf  // my spawn script

// Alpha East
_AE1 [];

if (isServer) then {
_AE1 = [getmarkerpos "AEs1", EAST, ["O_HeavyGunner_F"],[],[],[],[],[],265.921] call BIS_fnc_spawnGroup;

{
    [_x] execVM "IQ_INIT\RedInit\Rin.sqf";
    [_x] execVM "IQ_Load\RedL\RLoad.sqf";
    [_x] execVM "IQ_Skill\RedCon\RedCSkill.sqf";
} forEach units _AE1;

_awp0 = _AE1 addWaypoint [getmarkerpos "awp1", 0];
    _awp0 setWaypointType "MOVE";
    _awp0 setWaypointSpeed "NORMAL";
    _awp0 setWaypointBehaviour "AWARE";
    _awp0 setWaypointFormation "LINE";
    _awp0 setWaypointCombatMode "RED";
    _awp0 setWaypointCompletionRadius 5;
    _awp0 setWaypointDescription "Move here.";
    _awp0 setWaypointTimeout [60, 60, 60];
    

RedCSkill.sqf //my skill script

_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 ["commanding", 0.1];
_unit setSkill ["general", 0.1];
_unit setskill ["Endurance", 0.1];
_unit setskill ["courage", 0.1];
_unit setskill ["reloadSpeed", 0.1];
_unit setUnitAbility 0.1;


Not sure that's what you're looking for, but that is how I spawn my units and pass the skill to them..
Hope it helps

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

×