Heya! As part of the UT: Forgotten Classics BP, for one level, I need to code an advanced MusicEvent trigger, to allow multiple songs to be played w/o the use of a trigger needed to be activated. It plays the songs in order that they are listed (Song0 to Song9, 10 song slots), and the option to loop back to the first song once the looping is complete.
This is my code so far (it's based from the MusicEvent trigger, since extending it would cause some issues in the long run ^^ ):
I have left the "bUseMultipleSongs" & "bLoopMultipleSongs" booleans blank for now, as I don't want to code up something that proves itself useless. ^^ =/ Therefore, I politely ask someone to help me fill in those 2 blanks, and spot any typos or errors if need be! I am only a novice coder, so I still have a *LOT* to learn, but I am getting there slowly.
Any help will be *MUCH* appreciated!
Take care for now, ^^
RoninMastaFX
This is my code so far (it's based from the MusicEvent trigger, since extending it would cause some issues in the long run ^^ ):
Code:
//=========================================================
// RMFXMusicTrigger (Enhanced MusicEvent Trigger)
// Made by: Mitchell "RoninMastaFX" LeBlanc
// Exclusively for UT: Forgotten Classics Bonus Pack
// Made in 2010
// Based from "MusicEvent" Copyright (c) Epic Games, Inc. & Digital Extremes
//=========================================================
class RMFXMusicTrigger extends Triggers
// Variables
var() music Song0;
var() music Song1;
var() music Song2;
var() music Song3;
var() music Song4;
var() music Song5;
var() music Song6;
var() music Song7;
var() music Song8;
var() music Song9;
var() byte SongSection;
var() byte CdTrack;
var() EMusicTransition Transition;
var() bool bSilence;
var() bool bOnceOnly;
var() bool bAffectAllPlayers;
var() bool bUseMultipleSongs;
var() bool bLoopMultipleSongs;
// When gameplay starts
function BeginPlay()
{
if( Song0==None )
{
Song0 = Level.Song0;
}
if( Song1==None )
{
Song1 = Level.Song1;
}
if( Song2==None )
{
Song2 = Level.Song2;
}
if( Song3==None )
{
Song3 = Level.Song3;
}
if( Song4==None )
{
Song4 = Level.Song4;
}
if( Song5==None )
{
Song5 = Level.Song5;
}
if( Song6==None )
{
Song6 = Level.Song6;
}
if( Song7==None )
{
Song7 = Level.Song7;
}
if( Song8==None )
{
Song8 = Level.Song8;
}
if( Song9==None )
{
Song9 = Level.Song9;
}
if( bSilence )
{
SongSection = 255;
CdTrack = 255;
}
}
// When triggered
function Trigger( actor Other, pawn EventInstigator )
{
local PlayerPawn P;
local Pawn A;
if( bAffectAllPlayers )
{
A = Level.PawnList;
While ( A != None )
{
if ( A.IsA('PlayerPawn') )
PlayerPawn(A).ClientSetMusic( Song0, Song1, Song2, Song3, Song4, Song5, Song6, Song7, Song8, Song9, SongSection, CdTrack, Transition );
A = A.nextPawn;
}
}
else
{
// Only affect the one player
P = PlayerPawn(EventInstigator);
if( P==None )
return;
// Go to music
P.ClientSetMusic( Song0, Song1, Song2, Song3, Song4, Song5, Song6, Song7, Song8, Song9, SongSection, CdTrack, Transition );
}
// Turn off if once-only
if( bOnceOnly )
{
SetCollision(false,false,false);
disable( 'Trigger' );
}
// Play multiple songs in order (Song0 to Song9)
if( bUseMultipleSongs )
{
}
// Loop back to Song0
if( bLoopMultipleSongs )
{
}
}
defaultproperties
{
CdTrack=255
Transition=MTRAN_Fade
bAffectAllPlayers=True
bUseMultipleSongs=False
bLoopMultipleSongs=False
}
I have left the "bUseMultipleSongs" & "bLoopMultipleSongs" booleans blank for now, as I don't want to code up something that proves itself useless. ^^ =/ Therefore, I politely ask someone to help me fill in those 2 blanks, and spot any typos or errors if need be! I am only a novice coder, so I still have a *LOT* to learn, but I am getting there slowly.
Any help will be *MUCH* appreciated!
Take care for now, ^^
RoninMastaFX
Last edited: