UE1:RMusic Controller: Difference between revisions

From Unreal Wiki, The Unreal Engine Documentation Site
Raven (talk | contribs)
Raven (talk | contribs)
Line 113: Line 113:
RMusicPlayer can be also integrated with gametypes, console.
RMusicPlayer can be also integrated with gametypes, console.


====Gametype integration (with save support)====
====Gametype integration (with save support and level change detection)====
Subclass of SinglePlayer2 (SinglePlayer2 is part of OldSkool by UsAaR33)
Subclass of SinglePlayer2 (SinglePlayer2 is part of OldSkool by UsAaR33)
<uscript>
<uscript>
Line 159: Line 159:
</uscript>
</uscript>


====Gametype integration (without save support)====
====Gametype integration (with level change detection only)====
Subclass of coopgame2 (coopgame2 is part of OldSkool by UsAaR33)
Subclass of coopgame2 (SinglePlayer2is part of OldSkool by UsAaR33)
<uscript>
<uscript>
class RMusic_CoopGameInfo extends coopgame2;
class RMusic_CoopGameInfo extends SinglePlayer2;


event PostLogin( playerpawn NewPlayer )
event PostLogin( playerpawn NewPlayer )
Line 189: Line 189:
}
}
}
}
}
}
</uscript>
====Gametype integration (with save support only)====
Subclass of SinglePlayer2 (SinglePlayer2 is part of OldSkool by UsAaR33)
<uscript>
class RMusic_SingleGameInfo extends SinglePlayer2;
event PostLogin( playerpawn NewPlayer )
{
local RMusic_Controller RMusic_Controller;
local RMusic_Save RMusic_Save;
local RMusic_Player RMusic_Player;
        Super.PostLogin(NewPlayer);
if(Level.NetMode != NM_DedicatedServer)
{
//we have to found save part
foreach AllActors(class'RMusic_Save', RMusic_Save)
{
//we have to check if we have saved controller
if(RMusic_Save.SavedController != none)
{
RMusic_Controller=RMusic_Save.SavedController;
break;
}
}
//if saved controller is found, we have to restore music
if(RMusic_Controller != none) RMusic_Controller.EVENT_Player();
}
}
}
}

Revision as of 05:15, 30 May 2008

About

RMusic_Controller is part of RMusicPlayer beta. It controls RMusic_Player.

Usage

In ActorBrowser find Actor->RMusic_Component->RMusic_Controller, place it on map and configure it.

RMusic_Controller properties

You can configure following properties:

Name: PlayerClass

Type: class<RMusic_Player>

Description: Player class (if you want to have own music directory)


Name: RMusic_File

Type: string

Description: Music file to play


Name: RMusic_PlayAtStartup

Type: bool

Description: Should it be played at level start


Name: RMusic_MuteUMX

Type: bool

Description: If true will mute all music in umx files


Name: RMusic_BroadcastToAll

Type: bool

Description: If true, it'll broadcast functions to all players


Name: RMusic_bUnloadPreviousDSP

Type: bool

Description: If true, all DSP plugins will be unloaded


Name: RMusic_bOwnFadeUpdateTime

Type: bool

Description: If true, RMusic_OwnFadeUpdateTime will be used instead of default FaderUpdateTime in RMusic_Player


Name: RMusic_OwnFadeUpdateTime

Type: float

Description: Defines how fast music will fade in/out


Name: RMusic_bUseSaveControl

Type: bool

Description: If true, special RMusic_Save will be spawned to track last used controller


Name: RMusic_DSPPlugins[16]

Type: string

Description: DSP plugins to load


Name: Action

Type: ENum

Values:

  • AC_Play - Plays music
  • AC_Stop - Stops music
  • AC_ShutDown - Shutdown FMODEX (avoid this one ;) )

Description: Action


Name: RMusic_PlayType

Type: ENum

Values:

  • PT_Loop - Loops music
  • PT_PlayOnce - Plays once

Description: Play type


Name: RMusic_Transition

Type: ENum

Values:

  • TRANS_Instanly - Instant transition
  • TRANS_Fade - Smooth fade

Description: Transition type

Advanced usage (gametype/console integration)

RMusicPlayer can be also integrated with gametypes, console.

Gametype integration (with save support and level change detection)

Subclass of SinglePlayer2 (SinglePlayer2 is part of OldSkool by UsAaR33) <uscript> class RMusic_SingleGameInfo extends SinglePlayer2;

event PostLogin( playerpawn NewPlayer ) { local RMusic_Controller RMusic_Controller; local RMusic_Save RMusic_Save; local RMusic_Player RMusic_Player;

       Super.PostLogin(NewPlayer);

if(Level.NetMode != NM_DedicatedServer) { if(NewPlayer.GetEntryLevel() != none) { //we have to find music player in Entry level foreach NewPlayer.GetEntryLevel().AllActors(class'RMusic_Player',RMusic_Player) { //then we stops currently played song RMusic_Player.RMusic_Stop(); //and eventually add info about player/current level if( RMusic_Player.bAuthoritative ) { RMusic_Player.RMusic_LocalPlayer = NewPlayer; RMusic_Player.RMusic_OldLevel = NewPlayer.Level; } } } //we have to found save part foreach AllActors(class'RMusic_Save', RMusic_Save) { //we have to check if we have saved controller if(RMusic_Save.SavedController != none) { RMusic_Controller=RMusic_Save.SavedController; break; } } //if saved controller is found, we have to restore music if(RMusic_Controller != none) RMusic_Controller.EVENT_Player(); } } </uscript>

Gametype integration (with level change detection only)

Subclass of coopgame2 (SinglePlayer2is part of OldSkool by UsAaR33) <uscript> class RMusic_CoopGameInfo extends SinglePlayer2;

event PostLogin( playerpawn NewPlayer ) { local RMusic_Controller RMusic_Controller; local RMusic_Save RMusic_Save; local RMusic_Player RMusic_Player;

Super.PostLogin(NewPlayer);

if(Level.NetMode != NM_DedicatedServer) { if(NewPlayer.GetEntryLevel() != none) { //we have to find music player in Entry level foreach NewPlayer.GetEntryLevel().AllActors(class'RMusic_Player',RMusic_Player) { //then we stops currently played song RMusic_Player.RMusic_Stop(); //and eventually add info about player/current level if( RMusic_Player.bAuthoritative ) { RMusic_Player.RMusic_LocalPlayer = NewPlayer; RMusic_Player.RMusic_OldLevel = NewPlayer.Level; } } } } } </uscript>

Gametype integration (with save support only)

Subclass of SinglePlayer2 (SinglePlayer2 is part of OldSkool by UsAaR33) <uscript> class RMusic_SingleGameInfo extends SinglePlayer2;

event PostLogin( playerpawn NewPlayer ) { local RMusic_Controller RMusic_Controller; local RMusic_Save RMusic_Save; local RMusic_Player RMusic_Player;

       Super.PostLogin(NewPlayer);

if(Level.NetMode != NM_DedicatedServer) { //we have to found save part foreach AllActors(class'RMusic_Save', RMusic_Save) { //we have to check if we have saved controller if(RMusic_Save.SavedController != none) { RMusic_Controller=RMusic_Save.SavedController; break; } } //if saved controller is found, we have to restore music if(RMusic_Controller != none) RMusic_Controller.EVENT_Player(); } } </uscript>

Console integration

Subclass of UTConsole <uscript> class RMusic_Console extends UTConsole;

function DrawLevelAction( canvas C ) { local RMusic_Player RMusic_Player; local PlayerPawn PP;

if ( Viewport.Actor.Level.LevelAction == LEVACT_Loading ) // Loading Screen { PP = Root.GetPlayerOwner(); if(PP != none) { if(PP.GetEntryLevel() != none) { foreach PP.GetEntryLevel().AllActors(class'RMusic_Player', RMusic_Player) break;

if (RMusic_Player != none && RMusic_Player.RMusic_IsPlaying()) RMusic_Player.RMusic_Stop(); } } } Super.DrawLevelAction(C); } </uscript>