Jump to content
Sign in to follow this  
EddiePrice

Random Voice Script

Recommended Posts

Hey guys,

I'm making an MP mission, and attempting to make it as realistic as possible. I've come to the conclusion I want the enemy to shout out orders, cries and general noises to their friends and enemies alike, as the player would be to his MP pals.

So I was wondering, is there a way to make all units of a certain side "say" sound files every now and again, randomly picked from a list on detection of the enemy, right up until they are killed?

I'm thinking along the lines of some mods I remember from OFP that had generic battle chanter.

Thanks guys, this is going to be one awesome mission when it's done.

Safety

Share this post


Link to post
Share on other sites

Hi.. i can help you get started a bit..

first you need yo define the sounds. you can do that in description.ext or have a #include "sound.hpp" in that file

example.

<table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">

class CfgSounds

{

sounds[] = { };

class DPOC1

{

name = "DPOC1";

sound[] = {dpoc1.ogg, db+25, 1.0};

titles[] = {};

};

class DPOC2

{

name = "DPOC2";

sound[] = {dpoc2.ogg, db+25, 1.0};

titles[] = {};

};

class DPOC3

{

name = "DPOC3";

sound[] = {dpoc3.ogg, db+25, 1.0};

titles[] = {};

};

};

class CfgSFX

{

sounds[] = {};

};

class CfgEnvSounds

{

sounds[] = {};

};

then you need to make a random number generator.

thats easy..

<table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">

//number gen..

_rnd = round(random 2);

//what number we got?

switch (_rnd) do

{

case 0: {player say "DPOC1";};

case 1: {player say "DPOC2";};

case 2: {player say "DPOC3";};

};

you could use a trigget. which detects when enemy has activated it., then make the closes unit on you side say a random voice. if he is not to far away tho..

just and idea.. there are prolly 100th's of way of doing it..

Share this post


Link to post
Share on other sites

Wow thanks for the quick reply nuxil. I know how to define sounds etc and the randomiser is new to me.

However, I believe the tricky part is I want ALL the OPFOR to start shouting the random sounds at random intervals once they have detected a BLUFOR. Does that make sense?

Thanks again,

Safety

Share this post


Link to post
Share on other sites

I don't know the answer to your problem, but I can point you to one scripting command I think you'll need to complete your scenario. knowsAbout will tell you if a specific unit is detected by a specific unit. You could probably implement it on every unit to detect every unit, but that's a LOT of code and processing, so a more elegant solution would be ideal. Hopefully this can get you going in the right direction though.

Share this post


Link to post
Share on other sites

Yeah the problem is I'm spawing in units using the Urban Patrol Script and TakeBuilding, so applying inits and commands to a certain group is something I can't work out how to do unless the units are placed in the editor.

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  

×