Jump to content
palokan

AI Skill Script only affecting certain Faction

Recommended Posts

Hey Guys, i wrote a script to set the AI on the whole server every 10 seconds to certain Values according to the Side it is on for a modded "KP Liberation" Mission. This worked perfectly. But i wanted to change the script for the East Side to better reflect the skill of certain factions.

 

the original script was: 

while {true} do
{

{

_x setSkill 0.6;

_x setSkill ["aimingAccuracy", 0.2];

_x setSkill ["aimingShake", 0.7];

_x setSkill ["aimingSpeed", 0.7];

_x setSkill ["Endurance",0.5];

_x setSkill ["spotDistance",0.6];

_x setSkill ["spotTime",0.8];

_x setSkill ["courage", 0.8];

_x setSkill ["reloadSpeed", 1];

_x setSkill ["commanding", 0.7];

} forEach (allUnits select {side _x == east});

sleep 10;

};

this worked exactly as i intended. (is exec. via init.sqf and sets the skills from mission start every 10 seconds so that it includes every spawned unit, even if called by Zeus or any other special way. works great)
but now i wanted to change 

 

} forEach (allUnits select {side _x == east});

 

to something that affects only a certain faction like

 

} forEach (allUnits select {faction _x == LOP_TKA});

 

this line however doesn't work and i can't find any answer how to only call a script on a certain faction, so i was hoping someone in this forum could help me :) 

 

 

PaloKan

 

 

EDIT: I am an idiot. All i was missing was putting the Faction name into " " to make my scripts work haha. great, now i have differently skilled Middle Eastern Militia, ISIS Soldiers and Russian Elite soldiers to fight <3 

Thread can be closed :)

/thread

Share this post


Link to post
Share on other sites

Why do you set skill every 10 seconds? skill is something persistent.

Share this post


Link to post
Share on other sites
On 3/8/2018 at 8:17 PM, pierremgi said:

Why do you set skill every 10 seconds? skill is something persistent.

Hijacking this old thread because the topic about setting skill in a loop is relevant for my mission.

 

I was thinking about doing this for my zeus mission aswell and i would guess settings this in a loop will also affect the new zeus placed units. Because if this run only once it wont affect the new units placed later right?

Share this post


Link to post
Share on other sites

right.

You need to set skill for the spawned unit. Not familiar with zeus scripted but you have a module "set attributes - objects" with several options.

Share this post


Link to post
Share on other sites

@pierremgi I noticed his using this code

forEach (allUnits select {side _x == east});

What's the different from using

forEach (allUnits select {side _x isEqualTo east});

Which one should i use?

Share this post


Link to post
Share on other sites

Is it possible to change this code to select all ai's and exclude players?

forEach (allUnits select {side _x isEqualTo east});

 

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

×