For direct access use https://forums.oldunreal.com
It's been quite a while since oldunreal had an overhaul, but we are moving to another server which require some updates and changes. The biggest change is the migration of our old reliable YaBB forum to phpBB. This system expects you to login with your username and old password known from YaBB.
If you experience any problems there is also the usual "password forgotten" function. Don't forget to clear your browser cache!
If you have any further concerns feel free to contact me: Smirftsch@oldunreal.com

Music for area - trigger on/off when player entering/leaving

Ask UnrealEd 2 mapping related questions, or give hints, tips and tricks
Post Reply
User avatar
Sat42
OldUnreal Member
Posts: 76
Joined: Mon Dec 21, 2015 2:00 am

Music for area - trigger on/off when player entering/leaving

Post by Sat42 »

Hi all,

Been a while! Finally doing some more mapping ...

Title says it all: I have a corridor (of sorts) of convenient length leading to a bar; I want music (proper .umx, not sound) to kick in when the player enters the area, and the same track to fade away when the player exits the area. If the player backtracks for another visit, same music must kick in again and when leaving the area the music once more must fade away.

Of course the "fade in" trigger must be a bit further in than the "fade out" trigger (with what I've been playing with anyway).

That is the setup I am having trouble with, probably because I didn't have much time yet to look around so I am asking: how do you achieve the above, in such a way that the "fade in" and "fade out" music triggers can be triggered as much as one wants? (so there's always music in the bar, and never outside)

I would love a reply soon as I intend to share a little surprise map with my Dad next week for his birthday :P

Thanks for any help!
Last edited by Sat42 on Thu Aug 06, 2020 9:58 pm, edited 1 time in total.
User avatar
medor
OldUnreal Member
Posts: 321
Joined: Sun May 17, 2009 7:19 am

Re: Music for area - trigger on/off when player entering/leaving

Post by medor »

User avatar
Sat42
OldUnreal Member
Posts: 76
Joined: Mon Dec 21, 2015 2:00 am

Re: Music for area - trigger on/off when player entering/leaving

Post by Sat42 »

Thank you for pointing to your invaluable stash medor!
I had to connect via VPN to access it though as I kept getting "Time outs" here in Europe, slow indeed!

The test map is interesting for the new "Visible" sound actor (it gives you ideas) but it doesn't help solve my specific problem. I did have a look at some special triggers in your repository (ToggleTrigger.uc might help) but again it requires experimentation, and time is of the essence!

Can anyone point to a ready-made, vanilla solution for triggering the same music track on/off when entering/leaving an area? It has to be (indefinitely) repeatable.

(Meanwhile I am trying to finish the actual map...)
User avatar
yrex .
OldUnreal Member
Posts: 243
Joined: Wed May 06, 2015 6:46 am

Re: Music for area - trigger on/off when player entering/leaving

Post by yrex . »



Not tested online.
Last edited by yrex . on Fri Aug 07, 2020 5:23 pm, edited 1 time in total.
Quality content | mail me instead of PMing: ampoyrex(a)wp(.)pl
User avatar
Sat42
OldUnreal Member
Posts: 76
Joined: Mon Dec 21, 2015 2:00 am

Re: Music for area - trigger on/off when player entering/leaving

Post by Sat42 »



Not tested online.

Yrex - many thanks for your custom solution! It's simple and elegant - and I will be using this AreaMusic actor a lot! :D

It's so useful it deserves more recognition - may I share your solution over at UT99.org? Crediting you of course.

Thank you once more!  :)
Last edited by Sat42 on Sat Aug 08, 2020 11:40 am, edited 1 time in total.
User avatar
yrex .
OldUnreal Member
Posts: 243
Joined: Wed May 06, 2015 6:46 am

Re: Music for area - trigger on/off when player entering/leaving

Post by yrex . »

You can do anything you want, as long as you credit me.
Quality content | mail me instead of PMing: ampoyrex(a)wp(.)pl
User avatar
Sat42
OldUnreal Member
Posts: 76
Joined: Mon Dec 21, 2015 2:00 am

Re: Music for area - trigger on/off when player entering/leaving

Post by Sat42 »

You can do anything you want, as long as you credit me.
Excellent, will share your test map with the custom AreaMusic actor over at UT99.org then!

Thanks again! :)


User avatar
Buster
Global Moderator
Posts: 1594
Joined: Wed Jun 08, 2005 3:02 am

Re: Music for area - trigger on/off when player entering/leaving

Post by Buster »

A great idea well executed. Good job. It will come in handy.
Gatherstone - Unreal by Design
https://gatherstone.oldunreal.com

OK - he falls
Keep it Unreal !!
:-)_~
User avatar
.:..:
OldUnreal Member
Posts: 1530
Joined: Tue Aug 16, 2005 4:35 am

Re: Music for area - trigger on/off when player entering/leaving

Post by .:..: »

I checked that AreaMusic code and it's indeed singleplayer only.

I wrote this MusicEvent code a while ago which doesn't allow music to restart (you can trigger this event when entering one area, then switch to another song with another trigger when leaving it).

Code: Select all

Class FSMusicEvent extends MusicEvent;

var(MusicEvent) bool bForceRestartSong;

function Trigger( actor Other, pawn EventInstigator )
{
      local Pawn P;

      if ( bAffectAllPlayers )
      {
            // Fix for online games:
            Level.Song = Song;
            Level.SongSection = SongSection;

            for( P=Level.PawnList; P!=None; P=P.nextPawn )
                  if( PlayerPawn(P)!=None )
                        SetClientSong(PlayerPawn(P));
      }
      else
      {
            // Only affect the one player.
            if ( PlayerPawn(EventInstigator)==None )
                  return;

            // Go to music.
            SetClientSong(PlayerPawn(EventInstigator));
      }

      // Turn off if once-only.
      if ( bOnceOnly )
      {
            SetCollision(false,false,false);
            Disable( 'Trigger' );
      }
}
final function SetClientSong( PlayerPawn PP )
{
      if( PP!=None && PP.Player!=None && (bForceRestartSong || PP.Song!=Song || PP.SongSection!=SongSection) )
      {
            PP.ClientSetMusic( Song, SongSection, CdTrack, Transition );
            PP.Song = Song;
            PP.SongSection = SongSection;
      }
}

defaultproperties
{
      RemoteRole=ROLE_None
      bCollideActors=false
      bStatic=true
}
1823223D2A33224B0 wrote:...and now im stuck trying to fix everything you broke for the next 227 release xD :P
(ಠ_ಠ)
Post Reply
  • Similar Topics
    Replies
    Views
    Last post

Return to “UnrealEd 2, the editor for UnrealTournament”