Legacy:Dirk Fist

From Unreal Wiki, The Unreal Engine Documentation Site
Revision as of 03:45, 3 March 2004 by Tarquin (talk | contribs) (note about DynaMusic)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

Hi Ive been playing with uscript for about 5 months

Tarquin: Hi, welcome :)

Dirk Fist: Hi, Tarquin (mind if I call you Tarq?)

Tarquin: Go ahead :) everyone else does! I've even put 'tarq' in my list of IRC alerts! ;)

Dirk: Oh, and Hi FoxPaw, thanks for responding to my question :D


My First Wiki Project :)

What page should it go on ?

Can I upload a .u or .unr file ?

Tarquin: You can go ahead and create a page DynaMusic. :)

DynaMusic optional music for mappers !

Usage:

  1. Follow the directions for Embedding Code
  2. Place dynamusic actor on your map
  3. Right click on it to bring up properties
  4. Select the DynaMusic/LoadSong property and type in the song "PackageName.SongName" you want to be optional
  5. Right click on empty part of map to bring up the level properties
  6. Change audio/song to one of the standard UT music packages ( this package won't be optional )

The way it works:

  1. When the player connects DynaMusic attempts to load music package
  2. If it's successful it overides the maps default music (as defined in Level properties), with the optional music

<uscript> //============================================================================= // DynaMusic. By Dirk Fist with all do credit to the people of the Wiki //============================================================================= class DynaMusic expands Actor;

var() string LoadSong; var music song; var PlayerPawn MusicPlayer; var bool bMusicStarted; var int started;

replication { // Variables which will cause replication to all (relevant) clients

   reliable if ( Role == ROLE_Authority )
       started,LoadSong;

}

function PreBeginPlay() // executed on server {

   started +=1;                  // force replication
   Super.PreBeginPlay();

}

auto simulated state startup { Begin:

   log("Started",'Dynamusic');
   song = music(DynamicLoadObject( LoadSong, class'Music',True));
   if (song!=None)
   {   // we got a song lets find player
       log(string(song.Class),'Dynamusic');
       foreach AllActors(class 'PlayerPawn', MusicPlayer)
           if (Viewport(MusicPlayer.Player) != None)  break; 
       if (MusicPlayer != None)
       {   // We got player lets play 
           MusicPlayer.ClientSetMusic( song, Level.SongSection, Level.CdTrack, MTRAN_Fade );    
           log(MusicPlayer.PlayerReplicationInfo.PlayerName,'Dynamusic');        
   }   }

}

defaultproperties {

   bAlwaysRelevant=True
   RemoteRole=ROLE_SimulatedProxy

} </uscript>


Dirk Fist: Found some info on making the packages optional http://unreal.epicgames.com/UTMagic.html#PackageFlags

Dirk Fist: If any one knows another way I'd be glad to hear it? Since I don't want to cause version conflicts for maps that use non-optional umx(ogg?) version of the file, Since this is a mapping component and many mappers will probably borrow music from other maps.