Jump to content
Search In
  • More options...
Find results that contain...
Find results in...
Da Syobon

PlaySound script doesn't work

Recommended Posts

First of all, sorry for my bad english...

 

I'm amateur in scripting. I want to make a script that will play sound depending on script number.

This is the script:

Script 1 (VOID)
{
    PlaySound("1",0);
}

 

Script 2 (VOID)
{
    PlaySound("2",0);
}

 

Script 1 works fine. Script 2 works fine too but only if it has to play the same sound from the script 1("1"). So, the script 2 can't play different sound ("2"). Sndinfo is set properly.

 

Guys please help me, I'm too lame to fix it by myself :((

 

 

Share this post


Link to post

Have you looked at the PlaySound function? The first parameter is for the TID of the actor that plays the sound, the sound name is the second parameter. So it should be PlaySound(0, "1") and (0, "2") I suppose.

 

Strings in ACS are actually indices to a string table, so they're actually numbers. So coincidentally it works in the first case because "1" being the first string in the string table will have value 0 (see zero-based numbering), meaning that it will play on the actor with TID 0, which is interpreted as the activator in this case. And on the second parameter, 0 will be used as the index for the string of the sound name which will give it "1". However, in the second script, the index of the string "2" is 1, so it plays the sound "1" on a thing with TID 1, which is not the activator of the script, so you don't hear it. Mystery solved.

Share this post


Link to post

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
×