Jump to content
dazza

Adding ForceWalk to Player Group AI

Recommended Posts

Hi, I'm very new at coding, and struggling with this command.  Trying to addaction a SLOW and NORMAL speed for my AI whenever I want they to proceed slowly to a waypoint. Originally I had it working with Setspeed "Limited", but I was playing with the idea of forcing them to walk slow while in DANGER mode too. I discovered ForceWalk might be my solution, but whenever I try it, I get "...Type Group expected Object File myspeed\SLOW/sqf..., line1" as an error. 

Can I please get someone's eyes to look at it and figure out where I'm going wrong please?

 

Much appreciated!

 

I've currently got (bold are folder names):

 

config.cpp

class CfgPatches
{
    class Myspeed
    {
        units[] = {};
        weapons[] = {};
        requiredVersion = 1.0;
        requiredAddons[] = {"Extended_EventHandlers"};

    };
};

class Extended_PostInit_EventHandlers
{
  Myspeed_Post_Init = "TAG_myAddon_Post_Init_Var = [] execVM ""Myspeed\init.sqf""";
};


init.sqf

player addaction ["SLOW","myspeed\SLOW.sqf"];
player addaction ["NORMAL","myspeed\NORMAL.sqf"];

 

NORMAL

_playerGrp = Group player; _playerGrp forceWalk false;

 

SLOW

_playerGrp = Group player; _playerGrp forceWalk true;

 

Share this post


Link to post
Share on other sites

The forceWalk command needs to be run on individual units.

//	This should work.

//	NORMAL
{ _x forceWalk false; } forEach units player;

 

//	SLOW
{ _x forceWalk true; } forEach units player;

 

  • Like 1

Share this post


Link to post
Share on other sites

That's amazing mate! I've already plugged it in and tested it. Totally works!

 

Is there a way to forceWalk my AI teammates without the forceWalk affecting myself (player)? 

 

Really appreciate your help and reply

Share this post


Link to post
Share on other sites
On 9/18/2021 at 5:40 PM, dazza said:

Wait! Nvm solved it 😄 

How did you solve it so other can use it..

  • Like 1

Share this post


Link to post
Share on other sites

{ _x forceWalk true; } forEach units player - [player];

  • Like 4
  • Thanks 1

Share this post


Link to post
Share on other sites
On 9/20/2021 at 6:34 AM, Play3r said:

How did you solve it so other can use it..

{ _x forceWalk true; } forEach units player; player forceWalk false;

 

Not elegant, but worked like a charm.

  • Like 2
  • Thanks 1

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

×