Jump to content
Sign in to follow this  
Infernal

New ambiance script sound.

Recommended Posts

Hello, I'm creating a script to give the ambiance shots, as we all know, ARMA has many limitations on guns sounds, I created this script to enhance the sound of guns fired at distances over 200 meters.

The script works well with class man, but does not work on vehicles.

Could someone help me?

This is the script, its a simple script, but this make a huge diference in ambiance battlefield.

Init.sqf:

_a= _this select 0;
_man = nearestObject [_a,"man"];

_man addEventHandler ["Fired",{hint "MAN!";
_shot = nearestObject [_this select 0, _this select 4];
[_shot,_this]exec "Distantshots\Shot.sqs"}];

Shot.sqs:

_shot= _this select 0;
_fired=_this select 1;
_weapon= _fired select 1;
_unit= vehicle (_fired select 0);
_ammo= _fired select 4;

?(_shot distance player > 200):goto "distant"
?(_shot distance player < 200):exit

#distant

_crack= "logic" createVehicle (getpos _unit);

?(_ammo == "B_9x18_Ball"):_crack say "9xa";
?(_ammo == "B_9x19_Ball"):_crack say "9xa";
?(_ammo == "ACE_Bullet_9x18_B"):_crack say "9xa";
?(_ammo == "ACE_Bullet_9x19_B"):_crack say "9xa";
?(_ammo == "ACE_Bullet_9x19_B_S"):_crack say "9xa";
?(_ammo == "ACE_Bullet_765x17_B"):_crack say "9xa";
?(_ammo == ACE_Bullet_762x25_B):_crack say "9xa";

?(_ammo == "B_545x39_Ball"):_crack say "556a";
?(_ammo == "B_545x39_3RndBurst"):_crack say "556a";
?(_ammo == "ACE_Bullet_545x39_B"):_crack say "556a";

?(_ammo == "ACE_Bullet_545x39_BT"):_crack say "556b";
?(_ammo == "ACE_Bullet_545x39_AP"):_crack say "556b";
?(_ammo == "ACE_Bullet_545x39_B_S"):_crack say "556b";

?(_ammo == "B_556x45_Ball"):_crack say "556c";
?(_ammo == "B_556x45_3RndBurst"):_crack say "556c";
?(_ammo == "ACE_Bullet_556x45_B"):_crack say "556c";

?(_ammo == "ACE_Bullet_556x45_AP"):_crack say "556d";
?(_ammo == "ACE_Bullet_556x45_BT"):_crack say "556d";
?(_ammo == "ACE_Bullet_556x45_B_S"):_crack say "556d";

?(_ammo == "B_762x51_Ball"):_crack say "762a";
?(_ammo == "B_762x51_noTracer"):_crack say "762a";

?(_ammo == "ACE_Bullet_762x51_B_S"):_crack say "762b";
?(_ammo == "ACE_Bullet_762x39_BT"):_crack say "762b";

?(_ammo == "ACE_Bullet_762x39_B"):_crack say "762c";
?(_ammo == "ACE_Bullet_762x39_B_S"):_crack say "762c";

?(_ammo == "B_762x51_3RndBurst"):_crack say "762d";
?(_ammo == "ACE_Bullet_762x51_BT"):_crack say "762d";

?(_ammo == "ACE_Bullet_762x54R_B"):_crack say "pkm";

?(_ammo == "ACE_Bullet_762x51_B"):_crack say "m240a";
?(_ammo == "ACE_Bullet_762x54R_BT"):_crack say "m240a";
?(_ammo == "ACE_Bullet_762x54R_B_S"):_crack say "m240a";

?(_ammo == "B_762x54_Ball"):_crack say "m240b";
?(_ammo == "B_762x54_noTracer"):_crack say "m240b";
?(_ammo == "B_762x54_3RndBurst"):_crack say "m240b";

?(_ammo == "ACE_Bullet_556x45_SB"):_crack say "sniper";
?(_ammo == "ACE_Bullet_556x45_SB_S"):_crack say "sniper";
?(_ammo == "ACE_Bullet_762x51_SB_S"):_crack say "sniper";
?(_ammo == "ACE_Bullet_762x54R_SB"):_crack say "sniper";
?(_ammo == "ACE_Bullet_762x54R_SB_S"):_crack say "sniper";
?(_ammo == "ACE_Bullet_127x99_SB"):_crack say "sniper";
?(_ammo == "ACE_Bullet_127x108_SB"):_crack say "sniper";

?(_weapon == "M136"):_crack say "at4";
?(_weapon == "ACE_M136"):_crack say "at4";
?(_weapon == "ACE_Dragon"):_crack say "at4";
?(_weapon == "ACE_SMAW"):_crack say "at4";
?(_weapon == "ACE_M72"):_crack say "at4";

?(_weapon == "Javelin"):_crack say "rpg";
?(_weapon == "ACE_Javelin"):_crack say "rpg";
?(_weapon == "Stinger"):_crack say "rpg";
?(_weapon == "ACE_Stinger"):_crack say "rpg";
?(_weapon == "Strela"):_crack say "rpg";
?(_weapon == "ACE_Strela"):_crack say "rpg";
?(_ammo == "R_PG7V_AT"):_crack say "rpg";
?(_ammo == "R_PG7VR_AT"):_crack say "rpg";
?(_ammo == "ACE_Rocket_PG7V"):_crack say "rpg";
?(_ammo == "ACE_Rocket_PG7VR"):_crack say "rpg";
?(_ammo == "ACE_Rocket_PG7VL"):_crack say "rpg";
?(_ammo == "ACE_Rocket_TBG7V"):_crack say "rpg";
?(_ammo == "ACE_Rocket_PG7VL"):_crack say "rpg";
?(_ammo == "ACE_Rocket_RPG22"):_crack say "rpg";
?(_ammo == "ACE_Rocket_RPG27"):_crack say "rpg";
?(_ammo == "ACE_Rocket_RPO"):_crack say "rpg";
?(_ammo == "ACE_Rocket_PG29"):_crack say "rpg";
?(_ammo == "ACE_Rocket_TBG29"):_crack say "rpg";

~5

deletevehicle _crack;

exit

Work fine with class man, ONLY!

---------- Post added at 09:02 ---------- Previous post was at 08:54 ----------

{hint "MAN!" its just to test the different event handlers on Extended Event Handlers on .cpp

Edited by Infernal

Share this post


Link to post
Share on other sites

You could start by writing your code in .SQF :)

Share this post


Link to post
Share on other sites

I don't understand what you want do do. Do you want to increase the hearability of the sound, or just to make it sound like it's really so far?

Share this post


Link to post
Share on other sites

The sounds I already have changed, with these effects, the firefight is very real in terms of sound, almost like in real life.

When a unit fires a shot at a distance greater than 200 meters, the command checks if the bullet is 7x62, 5x56 etc, if so, the script executes the sound that I have determined.

It's very simple, but it makes a big effect on the sound of the gun.

But when a UAZ fire a PKM , there is no sound, shows no error, nothing happens!

If a infantry man fire with that, the sound of "pkm" appears!

I guess this command:

"_shot nearestObject = [_this select 0, _this select 4]"

does not seem to read these weapons projectiles in vehicles.

I wonder if anyone knows this problem!?

Edited by Infernal

Share this post


Link to post
Share on other sites

Im not sure if i understood 100% but standart UAZ with mg has DShKM.

Ammo classname for that is not even listed on your script.

Share this post


Link to post
Share on other sites
Im not sure if i understood 100% but standart UAZ with mg has DShKM.

Ammo classname for that is not even listed on your script.

Yeah i Know, but this is my Mod, i do a lot of modifications in ACE, and i have a a UAZ with pkm and DShKM, as toyotas and ford rangers too.

Share this post


Link to post
Share on other sites

You're adding a "fired" event handler to the man. If in a vehicle, it will not work, as you have to add the "fired" event handler to the vehicle:

This EH will not trigger if a unit fires out of a vehicle. For those cases an EH has to be attached to that particular vehicle.

Share this post


Link to post
Share on other sites
You're adding a "fired" event handler to the man. If in a vehicle, it will not work, as you have to add the "fired" event handler to the vehicle:

This EH will not trigger if a unit fires out of a vehicle. For those cases an EH has to be attached to that particular vehicle.

This is my .cpp file, i attached to class vehicle, so i have to attached to a "specific" vehicle?

class Extended_Init_EventHandlers
{

	class Man
	{
		InitMan ="_this execVM ""\Distantshots\init.sqf"";"
	};
	class Car
	{
		InitCar ="_this execVM ""\Distantshots\init2.sqf"";"
	};
	class Tank
	{
		InitTank ="_this execVM ""\Distantshots\init3.sqf"";"
	};
	class Plane
	{
		InitTank ="_this execVM ""\Distantshots\init.sqf"";"
	};
	class Helicopter
	{
		InitHelicopter ="_this execVM ""\Distantshots\init3.sqf"";"
	};
	class Ship
	{
		InitShip ="_this execVM ""\Distantshots\init.sqf"";"
	};
	class StaticWeapon
	{
		InitStaticWeapon ="_this execVM ""\Distantshots\init2.sqf"";"
	};
};

Thx for reply, you guys are awesome!

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
Sign in to follow this  

×