Jump to content

Recommended Posts

Hello, so i have an issue im trying to solve and im pretty sure its something simple but i cant work it out.

 

Im wanting to play a sound when someone fires their weapon (a battle cry), i thought i had the correct script thing but its not working can someone help?

 

my code (i put this in the init box of the unit:

 

 unit1 addEventHandler ["Fired", unit1 say3D ["sound1"]; 
}]; 

 

but it keeps saying im missing a ";" and wont let me enter it. 

 

All i want is for units to shout angrily when they fire their weapon ☹️

Share this post


Link to post
Share on other sites
3 minutes ago, Schatten said:

@Nicole_UK,


this addEventHandler ["Fired", {
    params ["_unit"]

    _unit say3D ["sound1"];
}];

 

 

Iv just tried this now and its still saying im missing a ";" ☹️ 

 

im so confused lol what am i doing wrong? i have the sounds in the description.ext, i have the unit's variable name.... i dont get it

Share this post


Link to post
Share on other sites

 

8 minutes ago, Nicole_UK said:

where please?

 

Schatten added it

Share this post


Link to post
Share on other sites

yes my bad i copied it wrong - oops 😁 

 

but it still wouldnt play the sounds , just threw an error message up so im not sure whats going on still..... wtf arma drives me crazy lol. 

Share this post


Link to post
Share on other sites
7 minutes ago, Nicole_UK said:

but it still wouldnt play the sounds

Sound must be defined in CfgSounds of the Description.ext or main config. Have you did that?

Share this post


Link to post
Share on other sites
4 hours ago, Schatten said:

Sound must be defined in CfgSounds of the Description.ext or main config. Have you did that?

 

Yes iv just tried again now and it didnt work im just not sure what im doing wrong at all....

 

heres what im ptting maybe you guys can see where im going wrong lol because i just dont get it

 

heres my description.ext (the sounds list):

 

class CfgSounds
{
 class akbar1
 {
  name = "akbar1"; // Name for mission editor
  sound[] = {\Sound\akbar1.ogg, 0.8, 1.0};
  titles[] = {0, ""};
 };
 class akbar2
 {
  name = "akbar2"; // Name for mission editor
  sound[] = {\Sound\akbar2.ogg, 0.8, 1.0};
  titles[] = {0, ""};
 };
 class akbar3
 {
  name = "akbar3"; // Name for mission editor
  sound[] = {"\Sound\akbar3.ogg", 0.8, 1.0};
  titles[] = {0, ""};
 }; 
 class akbar4
 {
  name = "akbar4"; // Name for mission editor
  sound[] = {\Sound\akbar4.ogg, 0.8, 1.0};
  titles[] = {0, ""};
 };
 class akbar5
 {
  name = "akbar5"; // Name for mission editor
  sound[] = {"\Sound\akbar5.ogg", 0.8, 1.0};
  titles[] = {0, ""};
 };
 class akbar6
 {
  name = "akbar6"; // Name for mission editor
  sound[] = {"\Sound\akbar6.ogg", 0.8, 1.0};
  titles[] = {0, ""};
 };
 class akbar7
 {
  name = "akbar7"; // Name for mission editor
  sound[] = {"\Sound\akbar7.ogg", 0.8, 1.0};
  titles[] = {0, ""};
 };
 class akbar8
 {
  name = "akbar8"; // Name for mission editor
  sound[] = {"\Sound\akbar8.ogg", 0.8, 1.0};
  titles[] = {0, ""};
 };
 class akbar9
 {
  name = "akbar9"; // Name for mission editor
  sound[] = {"\Sound\akbar9.ogg", 0.8, 1.0};
  titles[] = {0, ""};
 };
 class akbar10
 {
  name = "akbar10"; // Name for mission editor
  sound[] = {"\Sound\akbar10.ogg", 0.8, 1.0};
  titles[] = {0, ""};
 };
 class ululation1
 {
  name = "ululation1"; // Name for mission editor
  sound[] = {\Sound\ululation1.ogg, 0.8, 1.0};
  titles[] = {0, ""};
 };
 class ululation2
 {
  name = "ululation2"; // Name for mission editor
  sound[] = {\Sound\ululation2.ogg, 0.8, 1.0};
  titles[] = {0, ""};
 };
 class ululation3
 {
  name = "ululation3"; // Name for mission editor
  sound[] = {"\Sound\ululation3.ogg", 0.8, 1.0};
  titles[] = {0, ""};
 }; 
 class ululation4
 {
  name = "ululation4"; // Name for mission editor
  sound[] = {\Sound\ululation4.ogg, 0.8, 1.0};
  titles[] = {0, ""};
 };
 class ululation5
 {
  name = "ululation5"; // Name for mission editor
  sound[] = {"\Sound\ululation5.ogg", 0.8, 1.0};
  titles[] = {0, ""};
 };
 class ululation6
 {
  name = "ululation6"; // Name for mission editor
  sound[] = {"\Sound\ululation6.ogg", 0.8, 1.0};
  titles[] = {0, ""};
 };
 class ululation7
 {
  name = "ululation7"; // Name for mission editor
  sound[] = {"\Sound\ululation7.ogg", 0.8, 1.0};
  titles[] = {0, ""};
 };
 class ululation8
 {
  name = "ululation8"; // Name for mission editor
  sound[] = {"\Sound\ululation8.ogg", 0.8, 1.0};
  titles[] = {0, ""};
 };
 class ululation9
 {
  name = "ululation9"; // Name for mission editor
  sound[] = {"\Sound\ululation9.ogg", 0.8, 1.0};
  titles[] = {0, ""};
 };
 class ululation10
 {
  name = "ululation10"; // Name for mission editor
  sound[] = {"\Sound\ululation10.ogg", 0.8, 1.0};
  titles[] = {0, ""};
};
 class YPJ_song
 {
  name = "YPJ_song"; // Name for mission editor
  sound[] = {"\Sound\YPJ_song.ogg", 0.8, 1.0};
  titles[] = {0, ""};
};


};

 

 

in the editor i names my units (variable name) and put this in their init (the unit's variable names are i1, i2, i3, etc...):

 

this addEventHandler ["Fired", { params ["_i1"]; _i1 say3D ["akbar1"]; }];

 

Im just not sure where im going wrong?? 😓

Share this post


Link to post
Share on other sites

Instead of adding _i1 ect and use it in every init you could use a condition like

{ if (side _x isEqualTo EAST) then { _x addEventHandler ["Fired", _unit say3D ["akbar1"];}];  // will take into account any unit that is OPFOR
and then add it  to the mission init ect.

  • Like 2

Share this post


Link to post
Share on other sites

Try with a cfgSound like this:

 

class CfgSounds {
  sounds[] = {"akbar1","akbar2","akbar3",..............  all your stringed classes here};
  class akbar1 {
    name = "akbar1";
    sound[] = {"sound\akbar1.ogg",db+20,1.0,150};  // no \ at start, stringed path, other params as you like. (volume pitch distance max)
    titles[] = {};
  };

.....................
};

 

then,

this addEventHandler ["Fired", { params ["_i1"]; _i1 say3D "akbar1"; }];

should work

  • Like 4

Share this post


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

should work

Thank you so much i will try this out tonight! i really appreciate it 😀

Share this post


Link to post
Share on other sites
7 hours ago, pierremgi said:

Try with a cfgSound like this:

 

class CfgSounds {
  sounds[] = {"akbar1","akbar2","akbar3",..............  all your stringed classes here};
  class akbar1 {
    name = "akbar1";
    sound[] = {"sound\akbar1.ogg",db+20,1.0,150};  // no \ at start, stringed path, other params as you like. (volume pitch distance max)
    titles[] = {};
  };

.....................
};

 

then,

this addEventHandler ["Fired", { params ["_i1"]; _i1 say3D "akbar1"; }];

should work

 

this works perfectly - thank you soooooo much omg been trying to sort this for ages!!! thank you again!

 

anyone wanting to do the same thing use this code 😀

  • Like 2

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

×