Playsound

Post your scripting questions / solutions here

Moderator: Moderators

Post Reply
Rookie One.pl
Site Admin
Posts: 2752
Joined: Fri Jan 31, 2003 7:49 pm
Location: Nowa Wies Tworoska, Poland
Contact:

Playsound

Post by Rookie One.pl »

It's me again,

I have a problem with playsound command. I want to play a radio message for all players (in multiplayer). So I followed jv_map's 'Ubersound Workaround' tutorial and made this TIKI:

Code: Select all

TIKI 

setup
{
        path models/fx/dummy
        skelmodel dummy3.skd
}

init
{
        server
        {
                classname ScriptModel
                rendereffects +dontdraw
                notsolid
        }
        client
        {
                settiki none
                aliascache en_hostage_rescued sound/dialogue/Multiplayer/a/hostage_rescued.wav soundparms 1.2 0.0 1.0 0.0 10000 10000 local streamed subtitle "A hostage has been rescued!" maps "dm obj"
        }
}

animations
{
                idle dummy3.skc
}
which is called hostage_mp_dialogue.tik and placed in models/sound, and a for loop in the script:

Code: Select all

// Play radio message for all players
	for(local.playernum = 1; local.playernum <= $player.size; local.playernum++)
		$player[local.playernum] playsound en_hostage_rescued
What's wrong with it? I can't see.

Rookie One
Admin
Image
Image
Honour guide me.

here's my stuff - inequation.org | here's where I work - thefarm51.com
Rookie One.pl
Site Admin
Posts: 2752
Joined: Fri Jan 31, 2003 7:49 pm
Location: Nowa Wies Tworoska, Poland
Contact:

Ooops...

Post by Rookie One.pl »

I forgot to write what's wrong with it :oops: Well, the sound isn't played, and there's no error messages in console (I alwas run MoHAA in developer mode).
Admin
Image
Image
Honour guide me.

here's my stuff - inequation.org | here's where I work - thefarm51.com
jv_map
Site Admin
Posts: 6521
Joined: Tue Sep 03, 2002 2:53 pm
Location: The Netherlands
Contact:

Post by jv_map »

1. Where is that for loop located? Are there any players on the server when it plays the sound?

2. Have you precached your sound TIKI?
Image
Rookie One.pl
Site Admin
Posts: 2752
Joined: Fri Jan 31, 2003 7:49 pm
Location: Nowa Wies Tworoska, Poland
Contact:

Post by Rookie One.pl »

1. The loop is located in my hostage script a thread called when a hostage reaches safe zone (trigger_multiple).

Code: Select all

// Show message that the hostage has been rescued
iprintlnbold "A hostage has been rescued!"
// Play radio message for all players
And you know the rest. There aren't any other players on the server, because I don't have any friends over my LAN who have MoHAA :cry: (they have either too slow comp or no disk space :cry: ).

2. Yes, this is my precache script:

Code: Select all

cache models/sound/hostage_mp_dialogue.tik
That's all!

Rookie One
Last edited by Rookie One.pl on Tue Feb 04, 2003 7:15 pm, edited 1 time in total.
Admin
Image
Image
Honour guide me.

here's my stuff - inequation.org | here's where I work - thefarm51.com
jv_map
Site Admin
Posts: 6521
Joined: Tue Sep 03, 2002 2:53 pm
Location: The Netherlands
Contact:

Post by jv_map »

Do you get an error message when you remove that line from the precache script?
Image
Rookie One.pl
Site Admin
Posts: 2752
Joined: Fri Jan 31, 2003 7:49 pm
Location: Nowa Wies Tworoska, Poland
Contact:

Yup

Post by Rookie One.pl »

Yup, when I either remove that line from the script or remove the file.
Admin
Image
Image
Honour guide me.

here's my stuff - inequation.org | here's where I work - thefarm51.com
jv_map
Site Admin
Posts: 6521
Joined: Tue Sep 03, 2002 2:53 pm
Location: The Netherlands
Contact:

Post by jv_map »

Maybe try some different soundparms :?

Sound file should be 22050 or 44100 Hz 16-bit mono.

If it's in a .pk3, change 'streamed' to 'loaded'.
Image
Rookie One.pl
Site Admin
Posts: 2752
Joined: Fri Jan 31, 2003 7:49 pm
Location: Nowa Wies Tworoska, Poland
Contact:

I don't get it

Post by Rookie One.pl »

Now, I ran the map and the sound worked! I really don't know what's happening with that game... I hate compilers (these for programming/scripting, not for mapping, although they are awful, too!)!!! Even if there's everything OK on the code they always find an error...

Rookie One
Admin
Image
Image
Honour guide me.

here's my stuff - inequation.org | here's where I work - thefarm51.com
Post Reply