Jump to content

Recommended Posts

Hey everyone 😀

 

Im making a mission and im wanting the AI to shout when firing at eachother. I have the sounds i want to use, im wanting each side to have certain phrases they will shout at eachother when firing weapons (like battle cries) but i only want them to shout only when firing. im only wanting certian AI on each side to shout stuff not all the ai. there is a video on youtube that has something similar to what im wanting - he made a script that made the ai shout stuff when shooting but he didnt give any instructions. 

 

 

Also on the same note im also wanting to know how to add music to cars, so that when we are travelling the radio is playing. im also wanting one of the ai to 'sing' whist in the car.so basically we get in start driving, the radio plays and one of the ai sings then when we reach a certain spot the ai stops singing and the radio turns off. (can this be done with waypoints or connected to them so that certain sounds be played when you reach certain spots and stop when you reach others?)

 

 

thank you for any help given its much appreciated 😘

 

Share this post


Link to post
Share on other sites
2 hours ago, froggyluv said:

Youd want to use a Fired eventhandler and then play a random sound file each time

 

Thank you for your reply! Could you please give an example of the code and where to put it? 

Iv added the sounds using the description.ext - but not sure of the rest. (im a bit new to mission making)

 

 

Share this post


Link to post
Share on other sites

Not tested but say you have declared sound files named "AllahuAkbar_01","AllahuAkbar_02","AllahuAkbar_03","AllahuAkbar_04","AllahuAkbar_05" -that you want Eastern units to yell while firing. You could just place these in the Mission\init.sqf I suppose

 

Aggro_Scream = { 
_Aggro_Scream = selectRandom ["AllahuAkbar_01","AllahuAkbar_02", "AllahuAkbar_03", "AllahuAkbar_04", "AllahuAkbar_05"] ;
_this say3d _Aggro_Scream; 
};

 

{if (side _x isEqualTo East)  then {
    _x addEventHandler ["Fired", {[_this select 0] call Aggro_Scream}];
};
} forEach allUnits;

 

 

 

  • Like 2
  • Thanks 1

Share this post


Link to post
Share on other sites

thank you so much il try it out and let you know how it works, i really appreciate it!

Share this post


Link to post
Share on other sites

im guessing you would just repeat this code underneath for the west (blufor) aswell? (im wanting both sides to shout at eachother when firing) 

Share this post


Link to post
Share on other sites

Just change the East to West and change the audio files  you want. 

 

if (side _x isEqualTo West)  then {
    _x addEventHandler ["Fired", {[_this select 0] call American_Aggro_Scream}];
};
} forEach allUnits;

 

Now Americans or West units will call their own random list under American_Aggro_Scream - capiche?

  • Like 1

Share this post


Link to post
Share on other sites
12 minutes ago, froggyluv said:

Just change the East to West and change the audio files  you want. 

 

if (side _x isEqualTo West)  then {
    _x addEventHandler ["Fired", {[_this select 0] call American_Aggro_Scream}];
};
} forEach allUnits;

 

Now Americans or West units will call their own random list under American_Aggro_Scream - capiche?

 

 

I think im with ya... Il have a go now and see... i really appreciate your help and patience 🙂

Share this post


Link to post
Share on other sites

also super dumb question but do i put this in the mission file in the (other profiles) folder? or do i do this in game? sorry just a bit confused where to put the code lmao

Share this post


Link to post
Share on other sites

so i created a init.sqf file in the mission folder (like a description.ext file) and this is the code i put in it:

------------------------------------------------------------------------

 

 

IS_Aggro_Scream = { 
_IS_Aggro_Scream = selectRandom ["akbar1","akbar2", "akbar3", "akbar4", "akbar5"] ;
_this say3d _IS_Aggro_Scream; 
};

 

{if (side _x isEqualTo East)  then {
    _x addEventHandler ["Fired", {[_this select 0] call IS_Aggro_Scream}];
};
} forEach allUnits;

YPJ_Aggro_Scream = { 
_YPJ_Aggro_Scream = selectRandom ["ululation11","ululation12", "ululation13", "ululation14", "ululation15"] ;
_this say3d _YPJ_Aggro_Scream; 
};

if (side _x isEqualTo West)  then {
    _x addEventHandler ["Fired", {[_this select 0] call YPJ_Aggro_Scream}];
};
} forEach allUnits;

 

 

------------------------------------------------------

Im getting an error message on start of mission and the sounds arent playing so im not sure what iv done wrong? 

Share this post


Link to post
Share on other sites

this is how iv put the sounds im wanting in the description.ext:

 

 

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, ""};
};


};

Share this post


Link to post
Share on other sites

Hello,

You are missing a backwards bracket on the last forEach allUnits.

 IS_Aggro_Scream = { 
	_IS_Aggro_Scream = selectRandom ["akbar1","akbar2", "akbar3", "akbar4", "akbar5"] ;
	_this say3d _IS_Aggro_Scream; 
};

{
	if (side _x isEqualTo East)  then {
  		_x addEventHandler ["Fired", {[_this select 0] call IS_Aggro_Scream}];
	};
} forEach allUnits;

YPJ_Aggro_Scream = { 
	_YPJ_Aggro_Scream = selectRandom ["ululation11","ululation12", "ululation13", "ululation14", "ululation15"] ;
	_this say3d _YPJ_Aggro_Scream; 
};

{
	if (side _x isEqualTo West)  then {
		_x addEventHandler ["Fired", {[_this select 0] call YPJ_Aggro_Scream}];
	};
} forEach allUnits; 

 

Not sure this is entirely needed but I have this line on my cfgSounds class (on my missions).

class CfgSounds{
	// List of sounds (.ogg files without the .ogg extension)
	sounds[] = {akbar1, akbar2, etc};
};

 

Cheers.

  • Like 1

Share this post


Link to post
Share on other sites

thanks but its still not working not sure what im doing wrong... did you get it to work?

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

×