Jump to content
_sam

AI Animated until fired near or knowsabout player

Recommended Posts

Hello.

 

I'm making a nightime infiltration mission. Players have to assault a base, and I have placed AI in it. I want some AIs to be animated until they know about the players or if the players fire near them.

 

Any suggestions ?

 

BIS_fnc_ambientAnim plays the anim, but I don't know how to remove the anim from the AI if one of these conditions are triggered.

 

 

Thanks in advance,

 

Sam.

Share this post


Link to post
Share on other sites

Use firedNear EH: https://community.bistudio.com/wiki/Arma_3:_Event_Handlers#FiredNear

 

Depending to which units you assign the EH, here's some pseudocode (couldn't test, not at home):

  _firedUpon = _unit addEventHandler "firedNear"; // this should return true or false
  if( side _unit !== side player && _unit knowsAbout player > 3 || _firedUpon && _unit knowsAbout player > 2 ) {
    playerDetected = true;
    // stuff happens
  }

Share this post


Link to post
Share on other sites
See this post for some info on cancelling ambient anims.

Share this post


Link to post
Share on other sites

Hey guys. I've also have a question about "knowsAbout".

 

I had a trigger with a condition of: "east knowsabout player == 2" with various effects when the player was discovered, and it worked great for my stealth mission. Then, suddenly, it stopped working. No matter how many times I type it in, or reproduce it in different missions, "knowsAbout" has no effect anywhere. Is my game broken or something?

 

I am not an idiot. I have worked on this for 6 hours now, repeating the process again and again.

 

Does anyone know what's wrong?

 

Thanks.

Share this post


Link to post
Share on other sites

knowabout varies from 0 to 4, so it might never be exactly 2.

So maybe: "east knowsabout player >= 2"

Share this post


Link to post
Share on other sites

knowabout varies from 0 to 4, so it might never be exactly 2.

So maybe: "east knowsabout player >= 2"

 

This worked!

 

TO ANYONE reading this thread in the future and trying to make a better secret ops mission, this is a good condition for whether the player has been discovered.

 

Two ways to check if the player has been spotted

 

Condition:

Whole side:              east knowsAbout player >=  2

Individual units:        behaviour unitname == "COMBAT"   (works best)

 

Timeout

3/3/3

 

Effect

Alarms etc.

Share this post


Link to post
Share on other sites

Can someone please tell me why this isn't working as a trigger condition:

behaviour one == "COMBAT" OR behaviour two == "COMBAT"

Why won't it accept these as conditions, and how can I fix it?

 

Also, I copied a script with permission which goes like this:

//setSkill for ai on map from editor
//AI Skill  
{
_x setUnitAbility 0.1;
_x setskill ["aimingAccuracy",0.2];
_x setskill ["aimingShake",0.4];
_x setskill ["aimingSpeed",0.5];
_x setskill ["Endurance",0.3];
_x setskill ["spotDistance",0.1];
_x setskill ["spotTime",0.4];
_x setskill ["courage",0.9];
_x setskill ["reloadSpeed",0.1];

_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";

if (DebugDeep) then {
hint 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];
//sleep 0.1;
};
} forEach allunits;

How can I change it so it only gets applied to the units that I call the script from, in the editor, and not all units?

 

Thanks!

Share this post


Link to post
Share on other sites
((behaviour one) == "COMBAT") OR ((behaviour two) == "COMBAT")

Perhaps this works.

 

 

How can I change it so it only gets applied to the units that I call the script from, in the editor, and not all units?

 

 

 

Remove the foreach and replace _x with _unit

 

At the top of the script add:

_unit = param [0,objNull];

You can then transfer the unit to the script by doing this:

 

[unit] execVM "script.sqf";

_x setskill ["Endurance",0.3];

This line is obsolete, since the Endurance parameter has no influence on AI.

 

https://community.bistudio.com/wiki/AI_Sub-skills#endurance

Share this post


Link to post
Share on other sites
((behaviour one) == "COMBAT") OR ((behaviour two) == "COMBAT")

Perhaps this works.

 

 

 

 

Remove the foreach and replace _x with _unit

 

At the top of the script add:

_unit = param [0,objNull];

You can then transfer the unit to the script by doing this:

 

[unit] execVM "script.sqf";

_x setskill ["Endurance",0.3];

This line is obsolete, since the Endurance parameter has no influence on AI.

 

https://community.bistudio.com/wiki/AI_Sub-skills#endurance

 

 

Thank you so much. Final settings:

 

Unit init:

nul = [this] execVM "aiskillelite.sqf";

aiskillelite.sqf:

//setSkill for ai on map from editor
//AI Skill  
_unit = param [0,objNull];

_unit setUnitAbility 0.1;
_unit setskill ["aimingAccuracy",0.7];
_unit setskill ["aimingShake",0.8];
_unit setskill ["aimingSpeed",0.9];
_unit setskill ["Endurance",0.7];
_unit setskill ["spotDistance",0.5];
_unit setskill ["spotTime",0.7];
_unit setskill ["courage",0.9];
_unit setskill ["reloadSpeed",0.9];

_aA = _unit skill "aimingAccuracy";
_aS = _unit skill "aimingShake";
_aSp = _unit skill "aimingSpeed";
_e = _unit skill "Endurance";
_sD = _unit skill "spotDistance";
_sT = _unit skill "spotTime";
_c = _unit skill "courage";
_rS = _unit skill "reloadSpeed";

//sleep 0.1;
};

Then I made various similar scripts like "aiskillrecruit.sqf" etc.

 

 

 

This thread pretty much explains how to set up a perfect stealth mission. I know there are easier ways, but to someone with limited skills, this combined with the detection trigger is a life saver for stealth missions.

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

×