Jump to content
Purzel

Need help with CarHorn

Recommended Posts

Hi folks,

I´ve got a problem with a a honking carhorn in my MP-mission.

I want AI to use the carhorn, but that dude konvoif1 won´t do it.
I tried this code:

konvoif1 forceWeaponFire ["CarHorn", "Single"];

"konvoif1 sits at the driverseat, but theres no sound...
AI should do it three times, but I would be happy if he would do at least once...

What´s wrong? I searched this forum, but I can´t find a working solution.

Greetz Purzel


 

Share this post


Link to post
Share on other sites
(driver car) forceWeaponFire ["CarHorn","CarHorn"];

Basically when remote operating a vehicle's weapons, you need to specify the unit that is operating the specific weapon (in this case, the driver is operating the horn) instead of the vehicle itself. "CarHorn" as a weapon has one mode, "this", which means you'll have to replace "this" with "CarHorn" instead. More info here: https://community.bistudio.com/wiki/forceWeaponFire

Share this post


Link to post
Share on other sites

I tried this:

(driver konvoi1) forceWeaponFire ["CarHorn","CarHorn"];

But it does not work.

Drivers name: konvoif1
Car Name: konvoi1

What do you mean "this" has to be replaced by "CarHorn"...?
 

 

Share this post


Link to post
Share on other sites

What car are you trying this on? All of BIS' cars should use CarHorn but I've only tested it on the Hatchbacks.

Either way, you can hop into the car yourself as driver and use this to check for all weapons of the vehicle:

hint str (weapons (vehicle player))

If one of the weapons is CarHorn, then the code above should work (I know it doesn't but we'll get to that).

The thing with forceWeaponFire is that it requires a firemode. The most common ones are obviously "Single", "Burst", "FullAuto" but these usually only work for regular infantry weapons. Other weapons, like gatlings, use "close", or in the case of the car horn there's "this".

To check for weapon fire modes:

hint str (getArray (configFile >> "CfgWeapons" >> currentWeapon (vehicle player) >> "modes"));

The above code is sort of on-off considering that in this case "CarHorn" probably won't be the selected weapon, so I'd just recommend hopping into the config viewer and looking up the relevant item yourself. Either way, whenever you have "this" as a firemode, you have to replace "this" with the weapon name (in this case, "CarHorn") instead. Also, you will need to make sure that the unit that actually "fires" the gun is used in forceWeaponFire (which in this case is the driver). 

 

If the issue isn't about wrong weapon names then I'm guessing it's because of mp locality, where are you executing the code?

  • Like 1

Share this post


Link to post
Share on other sites

Tryteker's suggestions are great and should work.  But if for some reason it doesn't then PlaySound can be your workaround.  Download the horn sound of your choice from the interwebs, convert it to .ogg using free GoldWave, add the sound to your description.ext file, and use PlaySound or Say3D to play it.

 

Note if you use your own sound, you now have control of sound of horn, and length of sound.  So if horn is being used as a signal you can now do the exact series of short and long horn blasts you want for your signalling.

 

When ARMA frustrates me and I've burned X amount of time on something like this, I look for an alternative so I can move on to the cool stuff I want to do.

 

Post  your solution when you get it working.  Good luck.

Share this post


Link to post
Share on other sites

I tried.
the wrong-code-message is gone, but it does still not work.
I´ll post here, if I´m successful!

Share this post


Link to post
Share on other sites

This is what I use when I want to force the horn.

(driver _truck) forceWeaponFire [currentWeapon _truck, currentWeapon _truck];

You can switch the "_truck" for your vehicle. Hope it helps.

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

×