Jump to content

Recommended Posts

Hey guys,

 

been looking around in the days for something like a script that affects all AI units on the map, both that gets spawned in at all times, and AI units that has been there since mission start, both SP and MP.

Something like a timer that when, say all AI when they have been Alert or in Caution for 2 minutes, they will eventually go down to SAFE again, and have LIMITED movement of walking - if they have not been engaged with any hostiles.

Each time they become cautious and alerted, it will be a certain period of time before all of them will switch back to SAFE and LIMITED movement when they have had no engagements.

 

As if the threat is over and the AI can relax again. Civilians will calm down and return to their SAFE and LIMITED behaviors. Soldiers will be at ease and return to their SAFE and LIMITED behaviors.

Like on repeat if they end up getting alerted several times.

 

Any tips or pointers are greatly appreciated,

Share this post


Link to post
Share on other sites

You can test something like that:

 

Place it in init.sqf:

 

MGI_EHforIdleGrp = ["CombatModeChanged",
  {
    params ["_grp", "_newMode"];
    if (_newmode isEqualTo "COMBAT") then {
      _grp spawn {
        waitUntil {sleep 2; behaviour leader _this isEqualTo "AWARE"};
        _this setBehaviourStrong "SAFE";
      };
    };
}];

{
  _x addEventHandler MGI_EHforIdleGrp;
} forEach allGroups;

addMissionEventHandler ["GroupCreated", {
   params ["_group"];
   _group addEventHandler MGI_EHforIdleGrp;
}];

 

When a group falls into "AWARE" behavior, after "COMBAT" (engine default for situation clear), he will shift for "SAFE" mode.

 

  • Like 2
  • Thanks 1

Share this post


Link to post
Share on other sites
13 hours ago, pierremgi said:

You can test something like that:

 

Place it in init.sqf:

 


MGI_EHforIdleGrp = ["CombatModeChanged",
  {
    params ["_grp", "_newMode"];
    if (_newmode isEqualTo "COMBAT") then {
      _grp spawn {
        waitUntil {sleep 2; behaviour leader _this isEqualTo "AWARE"};
        _this setBehaviourStrong "SAFE";
      };
    };
}];

{
  _x addEventHandler MGI_EHforIdleGrp;
} forEach allGroups;

addMissionEventHandler ["GroupCreated", {
   params ["_group"];
   _group addEventHandler MGI_EHforIdleGrp;
}];

 

When a group falls into "AWARE" behavior, after "COMBAT" (engine default for situation clear), he will shift for "SAFE" mode.

 

 

You are golden, pierremgi, I will give this a try thank you.

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

×