Results 1 to 3 of 3

Thread: Add music to maps

  1. #1

    Default Add music to maps

    Want to add some mp3's to the maps try this I added it to Train to Hell map funny as hell.
    Code:
      STEP 1.) Edit "local.master aliascache" for the mp3's file you want to use,then add this to the ubersound.scr or to map script, (see example below)
           if you are adding it to the ubersound.scr you don't need to add "local.master = spawn ScriptMaster". If you are adding it to
             a single player map, then you need to add the map.scr name to "loaded maps "dm obj" ( example loaded maps "dm obj m1l2 m2l4" )
            You can edit the sound parameters.
             
             ( soundparms parameters are: <BaseVolume> <RandVolume> <BasePitch> <randPitch> <minDist> <maxDist> <Channel> <Loaded/Streamed> )
    
            aliascache song_1 mp3/crazytrain.mp3 soundparms 2.5 1.0 1.0 0.0 2000 20000 weaponidle loaded maps "dm obj"
    
    STEP 2.) Edit the coord's for speaker and triggers in the script below for the map script you want to use.  
    
    STEP 3.) Edit the "play" thread for the amount of songs you want it to play, and the "wait" time ( see "wait 480" in below example) 
             for the longest song to play, this will prevent players from stopping and starting songs over and over again.
    
    STEP 4.) Make a musci folder in mohaa/mian and put the mp3's in t.
    
    // ========== Train To hell =========
    //===================================
    
    // ===== copy & paste under main or in the ubersound.scr =====
    local.master = spawn ScriptMaster
    local.master aliascache song_1 music/crazytrain.mp3 soundparms 6.5 1.0 1.0 0.0 2000 20000 weaponidle loaded maps "dm obj"
    
    // ===== copy & paste under level waittill prespawn =====
    thread mp3        
    
    //===== copy & paste at in of map.scr
    mp3:
    
    level.song = 1
    
    local.speaker = spawn script_model model "models/static/speakerbox1.tik" targetname "speaker"
    local.speaker.origin = ( -2513.03 -4460.87 150.24 )
    local.speaker.angles = ( 0 -90 0 )
    local.speaker notsolid
    local.speaker light 1 0 0 25
    
    local.trig = spawn trigger_use targetname "music"
    local.trig.origin = ( -2513.03 -4460.87 150.24 )
    local.trig setsize ( -30 -30 -30 ) (30 30 30 ) 
    local.trig setthread play
    local.trig message "Song List: 1.War 2.warPigs 3.Stranglehold 4.Free-For-All"
    local.trig wait 5
    local.trig delay 0
    
    end
    
    play:
    
    $music waittill trigger
    
    if(level.song > 1)  //Max number or songs you want played
    level.song = 0     // Sets back to first song after the last one has been reached
     
    local.song = ("song_" + level.song)    //sound alias song_1, song_2, song_3, etc
    
    $music stopsound 3 //5, local 3, weaponidle   Sound channel we are using
    waitframe
    $music playsound local.song
    level.song ++     //prep for next song, increment level.song by one
     
     $music delete
    
      wait 480
     
      thread mp3
      
    end

  2. #2

  3. #3

    Default

    I updated the mod to use scripts instead of calling it from map scripts, here is sample scripts

    music.scr ( called from ambience.scr exec music/music.scr )
    Code:
    main:
    
    	thread music    
                
    end               
    
    
    music: 
                                                                                         					 
    level.mapname = getcvar (mapname)
    
    	switch ( level.mapname )
    	{
    	case "dm/mohdm6":
    	 {
    	exec music/war.scr
    	 }
    	break
    	  case "dm/TheChurch_dm":
    		{
    	exec music/HellsBells.scr
    		}
    	  	break
    	  case "dm/Grabstatte_DM":
    		{
    	exec music/Thriller.scr
    		}
    	  	break
    	  case "dm/train_to_hell.scr":
    		{
    	exec music/crazytrain.scr
    		}
    		break
    	  case "obj/obj_team1":
    		{
    	exec music/Stranglehold.scr
    		}
    	  	break
    			  case "obj/obj_team3":
    		{
    	exec music/wipeout.scr
    		}
    	  	break
    
    	  case "obj/TheChurch_Final_obj":
    		{
    	exec music/HellsBells.scr
    		}
    	  	break
    	  default:
    	  	// error?  ignore?
    	  	end
    	}
    
    end
    crazytrain.scr

    Code:
    main:
    
    thread crazytrain
    
    end
    
    crazytrain:
    
    local.master = spawn ScriptMaster
    local.master aliascache song_1 music/crazytrain.mp3 soundparms 6.5 1.0 1.0 0.0 2000 20000 weaponidle loaded maps "dm obj"
    
    level.song = 1
    
    local.trig = spawn trigger_multiple 
    local.trig.origin = ( -2416.00 -4392.00 88.13 ) 
    local.trig setsize ( -10000 -10000 0 ) (10000 10000 1000 ) 
    local.trig targetname "speaker33"
    local.trig setthread play
    local.trig wait .3
    local.trig delay 0
    
     
    end
    
    play:
    $speaker33 waittill trigger
    
    if(level.song > 1)  //Max number or songs you want played
    level.song = 0     // Sets back to first song after the last one has been reached
     
    local.song = ("song_" + level.song)    //sound alias song_1, song_2, song_3, etc
    
    $speaker33 stopsound 3 //5, local 3, weaponidle   Sound channel we are using
    waitframe
    $speaker33 playsound local.song
    level.song ++     //prep for next song, increment level.song by one
     
     $speaker33 delete
    
      wait 360
     
      thread crazytrain 
      
    end

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •