Scripts / How To PlaySound from Files

Author
Message
gerw
8
Years of Service
User Offline
Joined: 10th Oct 2016
Location:
Posted: 22nd Oct 2016 17:09
Hello everyone,
I have several music files recording some dialogues and I want to play them in my game. A dialogue can be long so I divide them into pieces. The problem is that how can I play them continuously via scripts. If it can be done without sound zone or entity, that will be better.
By the way, can I freeze a player and control his view(that means g_PlayerAngX and so on) or lock a player in a position but let him adjust his view freely? I want it to have the same effect as cutscenes.
PM
3com
10
Years of Service
User Offline
Joined: 18th May 2014
Location: Catalonia
Posted: 23rd Oct 2016 14:38
You've these comments at the bottom of "global.lua" file:

Quote: "LoadGlobalSound: LoadGlobalSound ( filename, iID ) -- where iID is an index greater than zero and filename points to a WAV file in your game installation
DeleteGlobalSound: DeleteGlobalSound ( iID ) -- where iID is the index of the sound loaded in the load command
PlayGlobalSound: PlayGlobalSound ( iID ) -- where iID is the index of the sound to be played
LoopGlobalSound: LoopGlobalSound ( iID ) -- where iID is the index of the sound to be looped
StopGlobalSound: StopGlobalSound ( iID ) -- where iID is the index of the sound to be stopped
SetGlobalSoundSpeed: SetGlobalSoundSpeed ( iID, speed ) -- where iID is the index of the sound to change the speed of
SetGlobalSoundVolume: SetGlobalSoundVolume ( iID, volume ) -- where iID is the index of the sound to change the volume of
GetGlobalSoundExist: GetGlobalSoundExist ( iID ) -- where iID is the index of the sound to check existence of
GetGlobalSoundPlaying: GetGlobalSoundPlaying ( iID ) -- where iID is the index of the sound to check if playing
GetGlobalSoundLooping: GetGlobalSoundLooping ( iID ) -- where iID is the index of the sound to check if looping"


Also take at look to "globalsoundtests.lua" file.
Also here: https://forum.game-guru.com/outbound?url=https%3A%2F%2Fforum.game-guru.com%2Fthread%2F207801%3Fpage%3D15%23msg2550652

Quote: "By the way, can I freeze a player and control his view(that means g_PlayerAngX and so on) or lock a player in a position but let him adjust his view freely?"




more details here: https://forum.game-guru.com/thread/207801?page=14#msg2547604

hth

3com









Laptop: Lenovo - Intel(R) Celeron(R) CPU 1005M @ 1.90GHz

OS: Windows 10 (64) - Ram: 4 gb - Hd: 283 gb - Video card: Intel(R) HD Graphics

PM
smallg
Community Leader
19
Years of Service
User Offline
Joined: 8th Dec 2005
Location:
Posted: 24th Oct 2016 09:29 Edited at: 24th Oct 2016 09:32
Does this not fit what you're after?
https://forum.game-guru.com/thread/207801?page=16#msg2558294
I also have a version without image support in my thread if you don't want them shown.
(See the sticky above)

Edit, I see you're after a cut scene type thing, I assume watching people talk rather than actually talking to them.
Well my script will show you how to load and control multiple sounds and how to lock the character so I guess its still a good starting point.
lua guide for GG
https://steamcommunity.com/sharedfiles/filedetails/?id=398177770
windows 10
i5 @4ghz, 8gb ram, AMD R9 200 series , directx 11

Login to post a reply

Server time is: 2024-12-22 23:21:50
Your offset time is: 2024-12-22 23:21:50