Jump to content
pierremgi

selectWeapon doesn't work for launcher

Recommended Posts

Did I miss something?

 

place an AT unit on map, name it bob for example.

in a trigger or in console:

0 = [] spawn {bob selectWeapon (secondaryWeapon bob)}

doesn't work, but:

0 = [] spawn {bob selectWeapon (handGunWeapon bob)}

0 = [] spawn {bob selectWeapon (primaryWeapon bob)}

work fine...

 

On the other hand, when bob is player, that works with the launcher. Incomprehensible for me.

 

Thanks

Share this post


Link to post
Share on other sites

`selectWeapon` works, but the AI will always switch back to a rifle to engage enemy infantry.

Share this post


Link to post
Share on other sites

`selectWeapon` works, but the AI will always switch back to a rifle to engage enemy infantry.

Indeed. the ammo used needs to be configured in a way to be used against infantry (such as RHS's OG7 HE RPG rounds), otherwise the AI will, as commy2 quite rightly stated, simply switch back to their rifle.

Share this post


Link to post
Share on other sites

OK, If i understand, selectWeapon is not a "stand alone" command. If you place one Rifleman (AT) in editor + the player, there is no way to script something with this command to see the AT unit switch for the NLAW (never seen the switch for launcher  and switch back for rifle, my unit doesn't anything at all).

 

Could you please try the code below, it takes 2 minutes:

0 = [] spawn {bob selectWeapon (secondaryWeapon bob)};

in any trigger or console, and tell me if different from my result ? (I verified ARMA 1.58, local cache and so on... No problem with a mod or anything else).

Please try bob as the AI unit, then as the player in 3den or SP. See: Player switches for NLAW (PMCL) but not AI.

 

But if not a "stand alone" command, how to use it?

The ammo is not the problem as the launcher are already loaded for vanilla units.

 

Add any empty truck, car, tank you want.

 

Now, another problem (undocumented so far, if I'm right):

You can fire an unguided missile on any object with:

bob reveal [my_object,4];

bob doTarget my_object;

bob dofire my_object;

I succeed to fire an Alamut at an antibiotic box!

This works also for guided missile like NLAW, but only on accurate targets like cars or trucks at least.

 

 

So, selectWeapon... finally what for?

It seems coupled with the "fire" command, but this couple of commands works along with a more complex environment:

 

Try with an rifleman (AT) OPFOR (unguided Alamut), a truck (empty), a BLUFOR player as enemy presence is mandatory, player out of sight of enemy AT unit:

bob reveal [my_object,4];

bob doTarget my_object;

bob selectWeapon (secondaryWeapon bob);

bob fire (secondaryWeapon bob);

 

The script will work only if player fires a shot (in any direction). The enemy sound seems to awake the OPFOR which take the launcher and finally fire at the object (truck).

Of course, on this statement, I tried bob setCombatMode "yellow" or even  bob setCombatMode "red", with no added behavior. Player has to shoot.

 

Sorry for this long post.

If you declare that selectWeapon is not broken, it could be fine to precise in BIKI, the context and limitations. Thanks.

Share this post


Link to post
Share on other sites

No, you didn't listen. You are thinking about this to hard.

 

There are no such things as "stand alone commands" - what would that even mean? This also has absolutely nothing to do with the editor, triggers or ammo.

 

What does "selectWeapon" do?

It makes the unit switch to that weapon (or muzzle). It works for the player and for AI. The only limitation is that you have to execute it on the machine where the unit is local.

 

What does the command not do?

It does not order the AI to keep the weapon selected. There is no such command and as far as I know, there is no way to order the AI to keep a weapon either.

 

The AI will select the launcher, but it will immediately switch back to a rifle or pistol, because it wants to engage infantry. It's two systems running against each other: your trigger and the soldiers AI. Maybe there is some kind of way for the AI to keep the launcher, but I'm not aware of any.

Share this post


Link to post
Share on other sites

Thanks to listen at me also! I slightly modified my post after tests.

The fact is:

bob selectWeapon (secondaryWeapon bob);

doesn't work at all as intended.

 

"stand alone" for my Frenglish means you can use it without any other line of command to see the result. Not followed by fire command for example.

 

The probable difference with you (if you tested this command on your PC) and me, is the context: I'm testing a very basic edited mission with a player, an AT AI (enemy or friend), one or two objects like car or small items from vanilla. I'm not in a battlefield context, with multiple awareness and so on. So, my experience is not yours. I'm not arguing with the validity of yours, I'm trying to understand mine and my first interest is to know if other people can reproduce mine. You tell me there is a temporary switch rifle/launcher/rifle, but in my basic context I've never been able to reproduce it. Did you try mine?

 

Anyway, I understand the struggle between 2 systems, but it's totally weird without enemy presence (infantry or not!), regardless the lack of documentation. I wrote my post because I think some other guys spend time to make things work as announced. And, if you read it from top to bottom, at least you have some hints to avoid heavy disappointments with a such command.

 

Thank you for your reading and explanation. I hope thos topic will not end, like some others, by a "That's normal!"

If you have time, just test what I wrote above. It's basic, vanilla reproducible, and not time expensive, on contrary of all the tests I did.

Share this post


Link to post
Share on other sites

The AI does not need enemies to be present for it to switch back to the rifle.

 

You are wrong if you think I haven't tried this myself already.

 

Just do the following test - put it into the init box of an AI AT soldier:

0 = this spawn {
    _this selectWeapon secondaryWeapon _this;
    while {true} do {
        diag_log currentWeapon _this;
    };
};

This will make him select the launcher, and then for the rest of the game print his selected weapon into the RPT.

 

You will get the following result:

21:47:26 "launch_B_Titan_short_F"
21:47:26 "launch_B_Titan_short_F"
21:47:26 "launch_B_Titan_short_F"

    ...hundres of lines here

21:47:44 "launch_B_Titan_short_F"
21:47:44 "arifle_MXC_Holo_pointer_F"
21:47:44 "arifle_MXC_Holo_pointer_F"

    ...continued until mission ends

The conclusion is that "selectWeapon" works for AI, but the AI switches back to the rifle immediately. They don't need any enemies nearby for that and the change can happen so quickly, that you never see them reaching for their launcher animation wise.

  • Like 1

Share this post


Link to post
Share on other sites

Wow, yes! Acknowledged!

Roughly, I'm not so stupid when i say it's not a real "stand-alone" command. With launcher, you need to fire (at the next line of code). Otherwise, this could be the most useless command of the game, as far as launcher are concerned!

 

I understand the difference of behavior with primaryWeapon, handGun and secondaryWeapon. The 2 first work fine. The 3rd one is overwhelmed by a standard engine for firing infantry (why not).

 

Finally, if you want to test thoroughly this command:

- selectWeapon runs and the launcher is selected but the animation has no time (most of the time) to run before AI "decides" to switch back to its previous weapon;

- selectWeapon needs extra line(s) of code to effectively switch for a launcher ready to fire, and, furthermore, this is even more significant if you want to fire a missile/rocket.

Share this post


Link to post
Share on other sites

You are to focused on the goal you personally want to achive. The command is simply not meant for AI. Even if you "selectWeapon" to a pistol, the AI will select the launcher if a tank comes along.

 

What you want is a command that forces the AI to keep a weapon selected, which would make it impossible for it to engage infantry at all. You are totally right that such a framework for AI could be useful for mission makers. That doesn't change the fact that "selectWeapon" works - for what it is meant to do. Your thread is titled "selectWeapon doesn't work for launcher" which is simply not correct.

Share this post


Link to post
Share on other sites

Focused? Where do you read any word about your consideration in BIKI's page?  How much time any writer must spill trying to use this command, (generally for the goal to obtain something different from the native engine)?

So the title could be : "selectWeapon is absolutely not satisfactory for launchers". But we are discussing the sex of angels.

Share this post


Link to post
Share on other sites

No, it should be: "feature request - add option to ask AI to always pull out the AT launcher".

 

Btw. the BI wiki is a exactly that: a wiki. All you have to do is make an account and you can add a note about "selectWeapon" and AI yourself.

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

×