Jump to content
Nicoman35

How to make an AI unit say the generic "ready" AFTER code of addAction is completed?

Recommended Posts

The syntax for addAction is:

 

object addAction [title, script, arguments, priority, showWindow, hideOnUse, shortcut, condition, radius, unconscious, selection, memoryPoint]

 

The script of the addAction command will run in scheduled environment.

I made a mod, where I added the action to a mortar. It's purpose is to rearm the mortar. The action is available to any unit assigned as gunner of that mortar.

Now, when I command the gunner to rearm the mortar, rearming will take some time. But the AI gunner unit will tell "READY" immediately after ordering him to rearm. Because of the scheduled environment, which comports as if it was spawned, and not called.

How am I able to delay that "READY" radio message until after reloading is finished?

Share this post


Link to post
Share on other sites

Should be OK to use sleep on the code/script.

Just count the seconds your AI unit takes to reload and add that time to the sleep command.

 

Nevermind, he goes "READY" like a crazy person, I get it. Yup, no fix i'm afraid.

...unless you disable the voice with _soldier1 disableAI "RADIOPROTOCOL".

...and use needReload, waitUntil needReload is different, and then say.

Edited by RCA3

Share this post


Link to post
Share on other sites

Thanks for your reply. Yes, the first time you give the order, the ai unit confirms with a 'COPY', which is good. But then, he immediately says 'READY'. Guess I could suppress that 'ready', and let him say 'ready' after the action is completed. My only problem now: How do I let him say 'ready`? I did not found that 'ready' sound In cfgRadio (for the command 'GroupRadio'), nor in cfgSounds (for the command 'Say')'. Where is this basic 'ready' stored? I already thought to make an onwn sound 'mortar rearmed', but that would not match to the voice of the corresponding ai unit.

Share this post


Link to post
Share on other sites

Found the sound using @Larrow's LARs_fnc_findRadioProtocols UI.

 

This looks a bit hacky but seems to work:

You need to input your unit's (editor) name AND you need to make sure that, that's the language (english) you want to use. If it's not you need to change path. You can always run Larrow's function again and find the voice/path you need.

 

playSound3D ["A3\Dubbing_Radio_F\data\ENG\" + speaker yourUnit + "\RadioProtocolENG\Normal\110_Com_Announce\Ready.ogg", yourUnit];

 

Share this post


Link to post
Share on other sites

Just realized you need this under radio channel and not 3D.

Unfortunately couldn't reproduce it.

 

I had problems with two commands: playSound and groupRadio.

playSound references a isSpeech param (play as speech through radio channel) which does not seem to work.

groupRadio doesn't sound or text anything.

 

playSound "soundready"; ok

playSound ["soundready",true]; same

playSound ["soundready",false]; same

someUnit groupRadio "radioready"; fail

 

These were the commands I used and below is the description.ext I also used.

I'd like someone to confirm if this commands are broken, please. Or maybe the filename path for CfgRadio must be different? Maybe custom sounds only? (Read edit below).

Thanks.

 

Description.ext:

Spoiler

class CfgSounds
{
    sounds[] = {};
    class soundready
    {
        // how the sound is referred to in the editor (e.g. trigger effects)
        name = "Ready";

        // filename, volume, pitch, distance (optional)
        sound[] = {"@A3\Dubbing_Radio_F\data\ENG\male10eng\RadioProtocolENG\Normal\110_Com_Announce\Ready.ogg", 1, 1};
        titles[] = {0, ""};
    };
};

class CfgRadio
{
    sounds[] = {};
    class radioready
    {
        // display name
        name = "Radio Ready";

        // filename, volume, pitch
        sound[]    = {"@A3\Dubbing_Radio_F\data\ENG\male10eng\RadioProtocolENG\Normal\110_Com_Announce\Ready.ogg", db - 100, 1.0};

        // radio caption
        title = "Ready";
    };
};

 

EDIT:

groupRadio doesn't play from Debug Console. That was my problem, once on unit init it plays well.

playSound isSpeech param still seems broken.

Cheers.

 

Edited by RCA3

Share this post


Link to post
Share on other sites
_unit groupRadio "SentSupportReady";

Or what ever radio command you need, group, side, command, vehicle etc

  • Like 4
  • Thanks 1

Share this post


Link to post
Share on other sites
5 hours ago, Larrow said:

_unit groupRadio "SentSupportReady";

Or what ever radio command you need, group, side, command, vehicle etc

 

Nice. This is what I need! Many thanks.

BUT

I tried this in the editor: 

cursorObject groupRadio "SentSupportReady";

and it works fine.

 

Inside the addAction script, the gunner is the "_caller", thus reffered as '_this select 1'. So, this should work, right? Well, not for me.

_this select 1 groupRadio "SentSupportReady "; -> fails

 

Even more funny, because muting with

_this select 1 disableAI "RADIOPROTOCOL";

 

and unmuting him with 

_this select 1 disableAI "RADIOPROTOCOL";

 

works flawless. What am I doing wrong?

Share this post


Link to post
Share on other sites
54 minutes ago, Nicoman35 said:

works flawless. What am I doing wrong?

This..

54 minutes ago, Nicoman35 said:

_this select 1 disableAI "RADIOPROTOCOL"

If your disabling the units protocol then it cannot use the protocol voice line "SentSupportReady"

Share this post


Link to post
Share on other sites

Absolutely embarrassing 🙈

It works. Sorry for being a muppet.

Many thanks to you guys!! Awesome, how patient you are with an amateur.

 

Just one more question. Where did you find the name of the sound? I would like to vary the 'ready' reply with some others like 'Standing by' or 'Waitin'. Cant seem to find it in the config viewer in the editor.

Share this post


Link to post
Share on other sites

 

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

×