Page 1 of 1

Sound Script

Posted: October 18th, 2006, 2:01 am
by Cr@sh
Hey, i was wondering if anyone could help me with a sound script, so that when you enter a different room, the music changes
xfire: crash636

PLZ help if you can TY

Edit Drofder: removed Email.

Posted: October 18th, 2006, 2:44 pm
by Drofder2004
hi, welcome to the forum.

If all you want is different sound in each room, you need not make a script to do each sound, you just need to work out the correct values for your csv files. I am assuming you have the sound working ingame.

In each room (in the centre), place a script_origin (right-click 2d window and select script_origin).
Now, with the script_origin selected, press N to open the entities window.
Now, in the boxes below (key and value) enter
targetname (in key)
<room name> (in value)
Change <room name> to a name you assign to each room.

Now you have your map set up, you need to get a script to play all the music.

Code: Select all

main()
{
   _music();
}

_music()
{
roomA = getent("<room name>", "targetname"); // change room name to value you used above
roomB = getent("<room name>", "targetname");
//etc

roomA thread _loopsound("<alias>"); //change <alias> to the alias in the csv file
roomB thread _loopsound("<alias>");
//etc
}

_loopsound(sound)
{
self playLoopSound(sound);
}
If you can hear the sound outside of the room, you need to adjust the distance in the csv file.

Posted: October 19th, 2006, 2:54 am
by Cr@sh
ok thank you so much

Posted: October 28th, 2006, 9:15 pm
by creator
how does the sound in a object works?

like a elevator, go in the elevator then the elevator doors close
with this command u play the sound
play <soundname> , but what u need to have inside radiant to make it work? or only the elevator doors?