Sounds in GTA 2 Coding
You can create sounds for your maps and even create them mid-game, such as a bank alarm during a certain mission.
SOUND uniquename
The above command “reserves” a sound without creating it. To create it later on, add this to it:
uniquename = CREATE_SOUND ( X , Y , Z ) soundtype playtype END
Your code could look like this:
bankalarm01 = CREATE_SOUND ( 13.5 , 127.5 , 4.0 ) BANK_ALARM PLAY_FOREVER END
If you want, you can change the PLAY_FOREVER to PLAY_INSTANT to play it once. If you wish to add a sound right from the start, you'll need to add this code:
SOUND uniquename = ( X , Y , Z ) soundtype playtype
And so, your code could look like this:
SOUND prisonriot01 = ( 47.5 , 16.5 , 2.0 ) PRISON_ALARM PLAY_FOREVER
Sound Types
Below are all the sound type names in GTA 2:
WINDSKIDNIGHT_CLUBBARGENERATOR_RUMBLEWORKSHOPVATCHURCH_SINGINGTEMPLE_CHANTINDUSTRIAL_HIGHTHUMAN_ABATTOIRFUNNY_FARMBANK_ALARMINDUSTRIAL_LOWPORTA_LOOWATERFALLCRICKETSPRISONPRISON_ALARMGANG_DUMPEDSMUG_LAUGHPRISON_YARDPRISON_RIOTGANG_LOCKED_IN_BUSSHOPPING_MALLCLOCK_TOWERYEEHA_BOMBBOWLING_ALLEYCROWD_NOISEFAN_NOISEGENERATOR_LOSE_POWERSCREAMBOMB_TICKBOMB_TICK_SHITDETECTED_MUMBLEKRISHNA_CHANTCRYINGROCKET_LAUNCH_FAIL_CLICKROCKET_FAIL_LAUGHPOISONEDPOWER_PLANTMUMBLEJAZZ_CLUBCOUNTRY_CLUBPYLONDISGRACELANDBAR_2STRIP_CLUBTEMPLE_2GARAGE_OPEN- best used in addition to doorGARAGE_CLOSE- best used in addition to doorLET_ME_OUT
Some of these can seem very quiet in the game while others are very loud and can be heard from far away. This means that you may have to place several sound objects in an area of your map to be able to hear the sound in the whole of that area.
Play Modes
There are only two ways to play sounds:
| Description | |
|---|---|
PLAY_INSTANT | Only makes the sound once. |
PLAY_FOREVER | Repeats the sound until a command makes it stop. |
(Originally written by Chris “Pyro” Hockley and formatted by Ben “Cerbera” Millard with full permission.)