Jump to content

Question about sounds


Nemaconz

Recommended Posts

So in A2 I had no problem using the below string in my mission file to get sounds to play at random:

[nil,_this,rSAY,[["sound1","sound2","sound3"] call BIS_fnc_selectRandom, 20]] call RE;

 

I even used it on server side files with no problem. But when I try it in A3 it's a no go. I verified that my sounds are listed correctly in the description.ext because I can get them to fire off using: playSound "sound1"; I want these sounds to occur at random, is there a new method for doing this?

I also tried this with no success, I put this at the top where I defined my other variables:

_sound = ["soundClass1","soundClass2","soundClass3"] call BIS_fnc_selectRandom;

and then used this

_test spawn {
    while {alive _this} do
    {
        sleep 5;
        playsound _sound;
        sleep 5;
    };
  };

later on down the line after I kicked off the script. Anyone got any ideas? Worked fine in A2, not sure what to do with it in A3. Thanks!

Link to comment
Share on other sites

Well since there is no RE anymore, I'll try and create the sounds server side instead because I don't want them out of sync with other players, when the  sounds occur everyone needs to hear them at the same time. Time to start the adventure known as a metric ass ton of trial and error. Many things are not the same as it used to be. For instance I have my own AI that I wrote for Arma 2, well I got them working for Arma 3 but what happens now is that for every client that logs onto the server, an additional AI is created, didn't used to be that way before even though the script was in the mission file. Thanks again brother, you have been very helpful.

Link to comment
Share on other sites

Use publiVariableEventHandler clientside and publicVariable serverside to trigger sounds on all clients almost synchronized.

Search this Forum for examples and read the appropriate BIS wiki pages.

Separate code from being executed on clients vs server by using:

if(isServer)then{
 //Serverside only code
};
Greez Kilo "Brother" Swiss
Link to comment
Share on other sites

God I feel retarded, it has been awhile since I've scripted. I added the if(server)then and I'm good, no more additional AI spawning per client. I cannot believe I didn't think of that. Thanks again. Gonna see about the publiceventhandler, I've used them before but it's been awhile. I should be able to get it going, god I wish they would have just left the friggin RE in.

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Advertisement
  • Discord

×
×
  • Create New...