play sound mid-game
play sound mid-game
I've written a mission where you pick up someone and then you throw him in a destructor to make him die. Now, I want to make him scream before he die. How can i do that?
- Gustavob
- Immortal
- Posts: 407
- Joined: 18 May 2009, 21:40
- GH nick: Gustavob
|Gustavob| - Location: Nowhere.
- Contact:
Re: play sound mid-game
For that you should "reserve space" for a sound before LEVELSTART with the SOUND command, like this:
Then, after LEVELSTART, in the mission, create the sound doing something like this:
I think it works
Code: Select all
SOUND soundname
LEVELSTART
Code: Select all
SOUND soundname
LEVELSTART
soundname = CREATE_SOUND ( X.x , Y.y , Z.z ) SCREAM PLAY_INSTANT END
[the commands to the char go to the destructor and die]
IF (HAS_CHARACTER_DIED (charname))
DELETE_ITEM (soundname)
ENDIF
You just lost the game.
Re: play sound mid-game
Good! it seems that I haven't seen the SCREAM sound type in the docs before. Now, I get a compile error on this:
it's using wil.gmp and it's not the whole code, in fact I removed my previous script by accident and now I'm going to rewrite it. So, I get a compile error on line 20, which is
"answear_phone_1:" but I can't figure where the errors are coming from.
and, how about playing an external file? Is it possible? the list in the docs about sound types is too short!
Thanks for your help!
Code: Select all
PLAYER_PED player = ( 158.5 , 140.5 , 2.0 ) 2 270
OBJ_DATA phone_1 = ( 158.5 , 138.5 , 2.0 ) 0 phone
SOUND sound_1
GENERATOR machine_gun_1 = (162.0, 143.0) 0 COLLECT_01 4 40 30
GENERATOR machine_gun_2 = (150.0, 201.0) 0 COLLECT_01 4 40 30
GENERATOR flamer_1 = (239.0, 127.0) 0 COLLECT_08 4 40 30
GENERATOR molotov_cock_1 = (203.5, 166.5) 0 COLLECT_04 4 40 10
GENERATOR armor_1 = (156.5, 142.5, 2.0) 0 COLLECT_29 4 40
PARKED_CAR_DATA tank1 = (226.5, 238.0) -1 0 TANK
FORWARD answear_phone_1:
THREAD_TRIGGER thread_phone_1 = THREAD_WAIT_FOR_ANSWER_PHONE ( player , phone_1 , answear_phone_1: )
answear_phone_1:
sound_1 = CREATE_SOUND (158.5, 138.5) SCREAM PLAY_INSTANT END
RETURN
LEVELSTART
SWITCH_GENERAtOR (machine_gun_1, ON)
SWITCH_GENERAtOR (machine_gun_2, ON)
SWITCH_GENERAtOR (flamer_1, ON)
SWITCH_GENERAtOR (molotov_cock_1, ON)
SWITCH_GENERAtOR (armor_1, ON)
LEVELEND
"answear_phone_1:" but I can't figure where the errors are coming from.
and, how about playing an external file? Is it possible? the list in the docs about sound types is too short!
Thanks for your help!
- Gustavob
- Immortal
- Posts: 407
- Joined: 18 May 2009, 21:40
- GH nick: Gustavob
|Gustavob| - Location: Nowhere.
- Contact:
Re: play sound mid-game
well, about the error in the line 20 I have no idea bcause Im not good with missions since I never scripted one you'd better ask another mapmaker
about playing an external file, i think its not possible, althoug you can edit GTA2 sound files (*.sdt) with GTA Wave 4.0 (can someone pass the link? I lost it D: ), then create your *.wav file you want to play in midgame, find the counterpart sound and import your *.wav file and save the *.sdt.
when doing this youd better copy the *.sty used and use another name to it, the name of your map for example, then save the *.sdt with the same name of the *.sty.
about playing an external file, i think its not possible, althoug you can edit GTA2 sound files (*.sdt) with GTA Wave 4.0 (can someone pass the link? I lost it D: ), then create your *.wav file you want to play in midgame, find the counterpart sound and import your *.wav file and save the *.sdt.
when doing this youd better copy the *.sty used and use another name to it, the name of your map for example, then save the *.sdt with the same name of the *.sty.
Last edited by Gustavob on 02 Aug 2009, 20:03, edited 1 time in total.
You just lost the game.
Re: play sound mid-game
You need a z coordinate for the sound.
sound_1 = CREATE_SOUND (158.5, 138.5, 2.0) SCREAM PLAY_INSTANT END
sound_1 = CREATE_SOUND (158.5, 138.5, 2.0) SCREAM PLAY_INSTANT END
Re: play sound mid-game
@Gustavob: this needs to directly modify the GTA files and i hate to do so. Black Phoenix in here http://brain.wireos.com/?tag=opengta2 is working on a new GTA called openGTA2. I hope he will include these sort of abilities to his game.
@Sektor: Thanks! It worked. But, I can only hear the scream when I answer the phone 3 or 4 times... Is it because of the sound of the phone ringing that is already playing? How can I overcome to this problem?
@Sektor: Thanks! It worked. But, I can only hear the scream when I answer the phone 3 or 4 times... Is it because of the sound of the phone ringing that is already playing? How can I overcome to this problem?