Jump to content
TWRoach

How can i set AI Skill in script?

Recommended Posts

Hello guys 
bad english sorry  I use google translation
how can i use script set ai skill?

I want Zeus or other spawn ai will use these skills

this is my  ai script

AISkill.sqf

//skillia
{
_x allowFleeing 0;
_x setskill ["courage",1];
_x disableAI "AUTOCOMBAT";
_x disableAI "SUPPRESSION";
_x disableAI "FSM";
_x setskill ["aimingAccuracy",0.06];
_x setskill ["commanding",1];
_x setskill ["aimingShake",0.2];
_x setskill ["aimingSpeed",0.2];
_x setskill ["spotDistance",1];
_x setskill ["spotTime",1];
_x setskill ["endurance",1];
_x setskill ["general",1];
_x setskill ["reloadSpeed",1];
} forEach allUnits;
 

 

init.sqf
 [] execVM "AISkill.sqf"; 


But he didn't have any use
Can anyone help me?

I will be very grateful...

Share this post


Link to post
Share on other sites

Thats only gonna run at the init so you need to add either to your Mission/Description.ext or Mod/Config.cpp (depending on whether this is for a Mission or a Mod respectively) so every CAManBase unit created will execute it

 

class Extended_Init_EventHandlers
{
    class CAManBase
    {
      init = "_this execVM 'WhatEverFolder\AISkill.sqf;";
    };
};

Share this post


Link to post
Share on other sites

 

I put it in

14 minutes ago, froggyluv said:

Thats only gonna run at the init so you need to add either to your Mission/Description.ext or Mod/Config.cpp (depending on whether this is for a Mission or a Mod respectively) so every CAManBase unit created will execute it

 

class Extended_Init_EventHandlers
{
    class CAManBase
    {
      init = "_this execVM 'WhatEverFolder\AISkill.sqf;";
    };
};

 

I put it in Description.ext  ,But still not working... btw this is  mission script

Share this post


Link to post
Share on other sites
9 minutes ago, TWRoach said:

 

I put it in

 

I put it in Description.ext  ,But still not working... btw this is  mission script

 

 Just tried -working here -what exactly did you write?

Share this post


Link to post
Share on other sites
1 minute ago, GEORGE FLOROS GR said:

Hello there TWRoach !

 

Check this:

 

 

yes I will try thanks
 

Share this post


Link to post
Share on other sites
1 minute ago, froggyluv said:

 

 Just tried -working here -what exactly did you write?

 

Um... like this in Description.ext?

class Extended_Init_Eventhandlers {
    class CAManBase {
        bb_applyLoadout = "_this call bb_fnc_applyLoadout";
        init = "_this execVM 'WhatEverFolder\AISkill.sqf;";
    };
};

 

Share this post


Link to post
Share on other sites

Ahhh, dont take me so literally Im not a mammal

 

  init = "_this execVM 'WhatEverFolder\AISkill.sqf;";

 

 The WhateverFolder was just an example of whatever folder you may hold that such as Scripts\AiSkill.sqf. If you dont have it in a folder you wouldnt need it:

 

  init = "_this execVM 'AISkill.sqf;";

 

PS: My scripting is rudimentary you should probably check out GOM's script above

 

 

Share this post


Link to post
Share on other sites
5 minutes ago, froggyluv said:

Ahhh, dont take me so literally Im not a mammal

 

  init = "_this execVM 'WhatEverFolder\AISkill.sqf;";

 

 The WhateverFolder was just an example of whatever folder you may hold that such as Scripts\AiSkill.sqf. If you dont have it in a folder you wouldnt need it:

 

  init = "_this execVM 'AISkill.sqf;";

 

PS: My scripting is rudimentary you should probably check out GOM's script above

 

 

my bad sorry
He seems to be working I'm not sure
 because i use ai general skill in 1 but in game he only have 40%

Is this normal?

Share this post


Link to post
Share on other sites

 

 If your not sure its running just put a sleep or a hint in the script to test it

 

Put this in your init or the debug if you want to check the unit's skills in front of you

 

player addAction
[
    "Show skills",
    {
        hintsilent format
        [
            "aimingAccuracy %1\n  aimingShake %2\n  aimingSpeed %3\n  spotDistance %4\n  spotTime %5\n  courage %6\n  reloadSpeed %7\n  commanding %8\n  general %9\n",
            cursortarget skillfinal "aimingAccuracy",
            cursortarget skillfinal "aimingShake",
            cursortarget skillfinal "aimingSpeed",
            cursortarget skillfinal "spotDistance",
            cursortarget skillfinal "spotTime",
            cursortarget skillfinal "courage",
            cursortarget skillfinal "reloadSpeed",
            cursortarget skillfinal "commanding",
            cursortarget skillfinal "general"
        ];
    }
];

  • Like 2

Share this post


Link to post
Share on other sites
8 hours ago, froggyluv said:

 

 If your not sure its running just put a sleep or a hint in the script to test it

 

Put this in your init or the debug if you want to check the unit's skills in front of you

 

player addAction
[
    "Show skills",
    {
        hintsilent format
        [
            "aimingAccuracy %1\n  aimingShake %2\n  aimingSpeed %3\n  spotDistance %4\n  spotTime %5\n  courage %6\n  reloadSpeed %7\n  commanding %8\n  general %9\n",
            cursortarget skillfinal "aimingAccuracy",
            cursortarget skillfinal "aimingShake",
            cursortarget skillfinal "aimingSpeed",
            cursortarget skillfinal "spotDistance",
            cursortarget skillfinal "spotTime",
            cursortarget skillfinal "courage",
            cursortarget skillfinal "reloadSpeed",
            cursortarget skillfinal "commanding",
            cursortarget skillfinal "general"
        ];
    }
];


It looks like they show 0 for each skill 

Share this post


Link to post
Share on other sites

 

 That doesnt sound right -make sure they are directly on your cursortarget in front of you -best if they are not moving to be sure and aim for center mass. Usually all zeros mean you dont have anyone properly in your line of sight

Share this post


Link to post
Share on other sites

When are Extended_Init_Eventhandlers from description.ext executed? Can I reference variables declared in init.sqf? Can I use a function I registered in CfgFunctions?

 

Sorry for the stupid question. I'd check for myself but I'm away from my computer at the moment.

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

×