• 🏆 Texturing Contest #33 is OPEN! Contestants must re-texture a SD unit model found in-game (Warcraft 3 Classic), recreating the unit into a peaceful NPC version. 🔗Click here to enter!
  • It's time for the first HD Modeling Contest of 2024. Join the theme discussion for Hive's HD Modeling Contest #6! Click here to post your idea!

Using MIDI music in Wc3

Deleted member 177737

D

Deleted member 177737

Note: I found a tutorial on another site dated from a long time ago that explained this to me (after a lot of guess work) so I've decided to post a better tutorial here with some better explinations and stuff.




Why use MIDI?

In short MIDI has an extremly small filesize compared to any other music format that I know of. MIDI is made for instrumental music so you won't find any MIDI files with people singing.


Why do I need a tutorial to get MIDI music to work?

You need a tutorial to get MIDI music to work because for some odd reason the world editor wont let you use MIDI music without a few extra steps. I find this quite strange because Warcraft 3 uses some MIDI files.

For people to be able to play a map that is using MID music files they need to do all of the registry editing outlined in this tutorial. If they don't they won't hear any music.


The Tutorial
*Close Warcraft 3 and the World Editor before doing any of this*

1.) Download UI.rar (it is attached to this post) and place it in your Warcraft 3 directory.

The Warcraft 3 directory is commonly at C:\Program Files\Warcraft III



2.) Go to the start menu and type in "regedit" without the quotation marks and press ENTER.

MIDI-Tutorial01.png

(For a larger picture just click the picture)


3.) Navigate to:
HKEY_CURRENT_USER\Software\Blizzard Entertainment\Warcraft III
MIDI-Tutorial02.png


4.) Now right click on the right side of the regedit screen like in the picture below then go to New then click on DWORD (32-bit) Value.
MIDI-Tutorial03.png

Name the new file "Allow Local Files" without the quotation marks then double-click on the new file and change the 0 (zero) to a 1 (one) just like in the below picture.
MIDI-Tutorial04.png

Now you can exit the registry editor and open up the World Editor.

5.) The Hive doesn't allow MID files to be uploaded so I've given instructions on how to get an MID file below.

Go to C:\Windows and search for onestop, a MID file should be found. Move that file to your desktop.


It is up to you to find an MID file to test with, this site has a few: www.mirsoft.info


6.) Now that you have an MID file we can go test if this tutorial has worked for you. Open up the World Editor and then open the Import Manager and import your MID file.

7.) Open the trigger editor, create a new trigger with nothing except for the Event "Map Initiization".
MIDI-Tutorial05.png

8.) Convert the newly created trigger to custom script.
MIDI-Tutorial06.png


9.) Add the lines:
JASS:
call SetAmbientDaySound( "Roland" )
call SetAmbientNightSound( "Roland" )

Just like I have done in the below picture.
MIDI-Tutorial07.png

10.) Now add this line:
JASS:
Call PlayMusicBJ("war3mapImported\\onestop.mid")
After the previously added lines, make sure this is above "endfunction".
Just replace onestop.mid with the name of your MID file.

Note: Every time you want your MID file to play you need to use jass like I've shown you in steps 9 & 10 to get it to play.
MIDI-Tutorial08.png

11.) Save and Test the map. (Make sure your music is set to 100% and you speakers are turned up)
If the music doesn't play you either did something wrong or the MID file your using doesn't work.


I've attached a test map which works after following this tutorial.
 

Attachments

  • MIDI Test Map.w3m
    41.4 KB · Views: 281
  • UI.rar
    990 bytes · Views: 182
Hmm yeah apparently we don't have a tutorial like that here.

This works well. Sadly a lot of people aren't willing to put in the work for it. :( But it may be useful for projects with bigger followings that want to minimize their file size. Approved.

I moved it to misc since it seems a bit more appropriate than actual mapping. (since it deals with regedit and stuff)
 
Level 3
Joined
Nov 30, 2012
Messages
30
We dont need to allow local file to play midi.
Just input the .dls file and change it's path.
View attachment miditest.w3m
My test code below:
JASS:
library midi

function Trig_InitMIDI_Actions takes nothing returns nothing       
        local sound midlib=CreateMIDISound("AshenvaleDay",1,1)
        call StartSound(midlib)
        call StopSound(midlib,false,true)
    call SetMapMusic( "cmx.mid;fxt.mid",true,2)//set bgm
endfunction
 
function InitTrig_InitMIDI takes nothing returns nothing
    set gg_trg_InitMIDI = CreateTrigger(  )
    call TriggerRegisterTimerEventSingle( gg_trg_InitMIDI, 0.00 )
    call TriggerAddAction( gg_trg_InitMIDI, function Trig_InitMIDI_Actions )
    call StopSound(bj_nightAmbientSound,true,false)
        call StopSound(bj_dayAmbientSound,true,false)
        call ClearMapMusic()
        call SetMusicVolume(100)
        call VolumeGroupSetVolume(ConvertVolumeGroup(1),0.5)
        call VolumeGroupSetVolume(ConvertVolumeGroup(2),0.5)
        call VolumeGroupSetVolume(ConvertVolumeGroup(5),1)
endfunction
endlibrary

Here are some bugs:
1.It may cause war3 crash when reload the map(maybe)
2.Some times there will be no sound until sevel minutes.
 
Top