Hello everyone from 2024!)
I use this guide. I created a scriptfile
welcome.gsx and executed it from the file
_callbacksetup.gsx. Everything worked out.
Then I tried to play the standard game sound when a player connect to the server. I added the line
self playSound( "weap_cobra_missile_fire" ); to the end of the
welcome function in the
welcome.gsx scriptfile. Everything worked out.
And now, instead of the standard game sound, I would like to play my own sound, something like
self playSound("hello");. I have a hello.wav sound. I’ve searched all the forums but still haven’t found an answer as to whether I can do this in any way in a scriptfile. Or do I have to build a mod for this?
Maybe I’m wrong, but it seems to me that custom sounds can only be used in the mod
Ok, thanks!) It seems to be true.
To any sound have an alias in the database, to add new instances to the database you need to compile a ff, so you will need your own mod.
But you can simply find a sound not used in the multiplayer, replace the file with yours, add to a IWD file and call that same alias already in the database. Then will work fine without the need of compiling your own mod.
Which mod are you using? Just add the new sound into the IWD file with the same exact name and path that will work.
My server is without a mod. I played on a server without a mod, and I think I heard custom sounds there. I definitely didn’t download anything when I connected to the server. Is there a way to achieve this without a mod? I understood the approximate logic. I tried to put my sound in the main/sound folder and in the main_shared/sound folder. I named this sound the same as the standard one. And I tried to call it in my plugin. But it didn’t work.
check if the sound/music is already loaded in the callback_startgametype()
if not, add this line there:
game[“YourSoundName”] = “original_alias”;
Then when you play it, use game[“YourSoundName”]
Sorry, but it seems that with this line you are simply assigning the string “original_alias” to the game[“YourSoundName”] variable. I don’t see how this can help with sound loading.
Yeah, sounds silly, but this is needed to work. Check your globallogic file and you will see. Cheers
Yes, thank you very much for your help. But I couldn’t get the custom sound to play. I’m inclined to think that this is still impossible without a mod. After all, if you think about it, in order for the sound to be played on the client, this sound must somehow appear on the client. And without downloading sound this is impossible. And without the mod, no additional files are downloaded.
If I’m still wrong, I’ll be glad if someone writes a specific example of how this should all work. I tried everything: I placed the sound files directly in the main/sound folder and in the main_shared/sound folder along the same path and with the same name, as written in the csv files of the soundaliases folder, I tried packing it into an iwd file. Called via game[“YourSoundName”]. Nothing helped, either the standard game sound was played or silence.
Hajas, you write how this could work in theory? Or have you actually managed to reproduce a custom sound without a mod?