Szuran Posted February 15, 2020 (edited) I'd like to have a unique sound opening a certain level, for example: Map 02 opens with a maniacal laughter that only plays once. Could you show me how to write an ACS script to do so? Let's assume the sound file is called SOUND and is in the folder GEETINGS in pk3. #Library "GREETINGS" #Include "ZCommon.ACS" Script "GREETINGS" ENTER NET That's how far my knowledge goes, and it's probaby wrong already. What would be next? Edited February 15, 2020 by Szuran 0 Share this post Link to post
0 snapshot Posted February 15, 2020 (edited) Open the script editor in your map editor (F10 in the case of UDB) and type it there, then compile it with the "compile script" button in the same script editor window, this way you can have per-map scripts. #Include "ZCommon.ACS" Script "GREETING" OPEN { ActivatorSound("greets",127); } 1 Share this post Link to post
0 snapshot Posted February 15, 2020 (edited) After you have imported your sound file and made sure it's defined for use in game in the SNDINFO lump, you can use either use PlaySound or ActivatorSound to play it, I'd recommend changing the script type to OPEN if you intend to make it support multiplayer so it only gets played when the map gets loaded first time or reloaded rather than each time a player enters the game: In your SNDINFO lump: greets dsgreets In your script file (whether the one in your map or library): Script "GREETING" OPEN { ActivatorSound("greets",127); } Make sure your sound file is placed under the main sounds/ folder in your .pk3 file Edited February 15, 2020 by sluggard 0 Share this post Link to post
0 Szuran Posted February 15, 2020 (edited) But how to make sure this only gets played in Map 02? I'd like to have a different sound for every map. 0 Share this post Link to post
0 Szuran Posted February 15, 2020 25 minutes ago, sluggard said: Open the script editor in your map editor (F10 in the case of UDB) and type it there, then compile it with the "compile script" button in the same script editor window, this way you can have per-map scripts. Something isn't working. My script compiles, I did it in GZDB, Map01, and it looks like this: #Library "GREET" #Include "ZCommon.ACS" Script "GREET" OPEN { ActivatorSound("greet",127); } The file is called GREET and I have greet greet in SNDINFO. I placed the file in pk3/sounds I have GREET in LoadACS. What am I missing? 0 Share this post Link to post
0 snapshot Posted February 15, 2020 (edited) Are you sure your sound file is in one of the supported sound formats? named correctly? not followed by .mp3 or .wav or something like that? 0 Share this post Link to post
0 Szuran Posted February 15, 2020 I redid it, exactly the same as before, and now it works. Don't know why. Thank you for your help! 0 Share this post Link to post
0 Szuran Posted February 15, 2020 1 hour ago, sluggard said: You're welcome! One more question, because even though I did compile it in Map01, the script launches at the start of any map. May I ask what specific thing I should do to tie it to one map only? 0 Share this post Link to post
0 snapshot Posted February 15, 2020 (edited) Did you also write it in your Library? If so remove the one in your library and it should only play in the map where you have the script. 0 Share this post Link to post
0 Szuran Posted February 15, 2020 So is it compiled into the map and I don't need it in pk3? 0 Share this post Link to post
0 Szuran Posted February 15, 2020 I removed greet.acs from pk3 and it still loads - still in every map. 0 Share this post Link to post
0 snapshot Posted February 15, 2020 This is so strange, It should be tied to the map where you compile it, I'm out of ideas lol, I was going to suggest you recompile your library without that script but keep it if you want to have other kinds of scripts that happen on all maps. 0 Share this post Link to post
0 Szuran Posted February 15, 2020 I think I'll just find a workaround - write greetings so they fit any map and make them randomly chosen at the beginning. 0 Share this post Link to post
I'd like to have a unique sound opening a certain level, for example: Map 02 opens with a maniacal laughter that only plays once.
Could you show me how to write an ACS script to do so?
Let's assume the sound file is called SOUND and is in the folder GEETINGS in pk3.
#Library "GREETINGS"
#Include "ZCommon.ACS"
Script "GREETINGS" ENTER NET
That's how far my knowledge goes, and it's probaby wrong already. What would be next?
Edited by SzuranShare this post
Link to post