pete_smith1229 Posted November 20, 2023 Posted November 20, 2023 I used the following script to create an .acm file from an .ogg file. BEGIN ~Add MUSIC~ COPY ~my_mod/audio/music/RB_MUS01.ogg~ ~music~ COPY_EXISTING ~songlist.2da~ ~override~ LAF HANDLE_AUDIO INT_VAR music = 1 STR_VAR audio_path = ~my_mod/audio/music~ END From the Weidu documentation, I'm attempting to use the ADD_MUSIC function using: //ADD_MUSIC internalMusicName newMUSFile ADD_MUSIC ~RB_MUS01~ ~my_mod/audio/music/RB_MUS01.mus~ But I receive a parsing error. How is this function used exactly? Quote
pete_smith1229 Posted November 20, 2023 Author Posted November 20, 2023 I've just noticed this note from the Weidu documentation: INT_VAR music if this variable is not 0 and the game is BG:EE, the audio files are given the extension .acm instead of .wav. This variable has no effect if the game is not BG:EE. By default its value is 0. I'm guessing IW:EE uses the same engine as an .acm file is produced...? In addition to how to use the ADD_MUSIC funtion, is there any other steps required to incorporate music or can I just use the PlaySong() function to play the music? Quote
pete_smith1229 Posted November 20, 2023 Author Posted November 20, 2023 Managed to get it done manually with NI but boy was it an ordeal... would rather go down the scirpting route! I don't think there's a thread in this forum which describes how to add music manually (if so then please correct me) in which case, I'll include the steps I did once I've remembered exactly what I did... Quote
paladin84 Posted November 20, 2023 Posted November 20, 2023 3 hours ago, pete_smith1229 said: But I receive a parsing error. How is this function used exactly? I am not sure why you have a parse error here, I use exactly the same code to add music in my mod: https://github.com/abalabokhin/NWNForBG/blob/main/NWNForBG/Setup-NWNForBG.tp2#L438 and it works. As far as I understand, ADD_MUSIC just add an entry into songlist.2da and copy *.mus file. All *.acm files should be copied manually (into the dedicated directory - see also in the code). Idk how to play the added music, I was using it in the areas (like here https://github.com/abalabokhin/NWNForBG/blob/main/NWNForBG/Setup-NWNForBG.tp2#L955). PlaySound() should work with any ogg/wav files, no need to add music for that. Quote
pete_smith1229 Posted November 22, 2023 Author Posted November 22, 2023 (edited) @paladin84 Thanks for confirming and elaborating on the ADD_MUSIC function. In addition to your description of manually copying files, I've included the steps I did to add music to the game: 1. Use VLC (or similar) to convert mp3/wav file to .ogg file and save to my_mod/audio/music/ 2. Run the following script to create .acm file COPY_EXISTING ~songlist.2da~ ~override~ LAF HANDLE_AUDIO INT_VAR music = 1 STR_VAR audio_path = ~my_mod/audio/music/~ END 3. Create new folder (e.g. "rb_mus") in main_game_EE/music/ 4. Move .acm file to main_game_EE/music/rb_mus/ 5. Rename .acm file by appending "a" (i.e. rb_musa.acm) 6. Create .mus file (text file) with the following where: Rb_mus = folder name; 1 = no. of acm files; A is character used to point to the .acm file; @TAG end = interrupt state (more info) Rb_mus 1 A @TAG end 7. Append songlist.2da with following where: 85 = new unique ID; rb_mus = folder name containing acm files; rb_mus01.mus = name of .mus file 85 rb_mus rb_mus01.mus 8. Music can be called using the following: PlaySong(0) // Play blank PlaySong(85) // Play new music SetMusic(DAY,rb_mus01) // Play new music during the day (check MUSIC.IDS for other parameters) StartMusic(COMBAT_NORMAL,PLAY) // Configure "songs" parameter in .ARE file where COMBAT_NORMAL = rb_mus01.mus (rb_mus) - 85 Edited November 22, 2023 by pete_smith1229 Quote
Recommended Posts
Join the conversation
You are posting as a guest. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.