logo
Main

Forums

Downloads

Unreal-Netiquette

Donate for Oldunreal:
Donate

borderline

Links to our wiki:
Wiki

Walkthrough

Links

Tutorials

Unreal Reference

Usermaps

borderline

Contact us:
Submit News
Page Index Toggle Pages: 1 Send TopicPrint
Normal Topic Music for area - trigger on/off when player entering/leaving (Read 394 times)
Sat42
Junior Member
**
Offline


Oldunreal member

Posts: 61
Joined: Dec 21st, 2015
Music for area - trigger on/off when player entering/leaving
Aug 6th, 2020 at 9:57pm
Print Post  
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 Tongue

Thanks for any help!
  
Back to top
 
IP Logged
 
medor
Senior Member
Betatester
****
Offline


Oldunreal member

Posts: 313
Joined: May 17th, 2009
Re: Music for area - trigger on/off when player entering/leaving
Reply #1 - Aug 7th, 2020 at 6:00am
Print Post  
  
Back to top
 
IP Logged
 
Sat42
Junior Member
**
Offline


Oldunreal member

Posts: 61
Joined: Dec 21st, 2015
Re: Music for area - trigger on/off when player entering/leaving
Reply #2 - Aug 7th, 2020 at 8:23am
Print Post  
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...)
  
Back to top
 
IP Logged
 
yrex .
Betatester
Offline


Oldunreal member

Posts: 224
Joined: May 6th, 2015
Re: Music for area - trigger on/off when player entering/leaving
Reply #3 - Aug 7th, 2020 at 5:23pm
Print Post  
  

Quality content | mail me instead of PMing: ampoyrex(a)wp(.)pl
Back to top
 
IP Logged
 
Sat42
Junior Member
**
Offline


Oldunreal member

Posts: 61
Joined: Dec 21st, 2015
Re: Music for area - trigger on/off when player entering/leaving
Reply #4 - Aug 8th, 2020 at 11:40am
Print Post  
yrex . wrote on Aug 7th, 2020 at 5:23pm:



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

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!  Smiley
  
Back to top
 
IP Logged
 
yrex .
Betatester
Offline


Oldunreal member

Posts: 224
Joined: May 6th, 2015
Re: Music for area - trigger on/off when player entering/leaving
Reply #5 - Aug 8th, 2020 at 2:50pm
Print Post  
You can do anything you want, as long as you credit me.
  

Quality content | mail me instead of PMing: ampoyrex(a)wp(.)pl
Back to top
 
IP Logged
 
Sat42
Junior Member
**
Offline


Oldunreal member

Posts: 61
Joined: Dec 21st, 2015
Re: Music for area - trigger on/off when player entering/leaving
Reply #6 - Aug 8th, 2020 at 3:39pm
Print Post  
yrex . wrote on Aug 8th, 2020 at 2:50pm:
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!  Smiley


  
Back to top
 
IP Logged
 
Buster
Global Moderator
*****
Offline



Posts: 1528
Location: BC, Canada
Joined: Jun 8th, 2005
Gender: Male
Re: Music for area - trigger on/off when player entering/leaving
Reply #7 - Aug 9th, 2020 at 6:02pm
Print Post  
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 !!
Smiley_~
Back to top
WWW  
IP Logged
 
.:..:
Oldunreal MasterPoster
Developer Team
*
Offline



Posts: 1515
Location: Finland
Joined: Aug 16th, 2005
Gender: Male
Re: Music for area - trigger on/off when player entering/leaving
Reply #8 - Sep 15th, 2020 at 5:38am
Print Post  
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
} 

  

Shivaxi wrote on Jul 25th, 2013 at 12:50pm:
...and now im stuck trying to fix everything you broke for the next 227 release xD Tongue

(ಠ_ಠ)
Back to top
IP Logged
 
Page Index Toggle Pages: 1
Send TopicPrint
Bookmarks: del.icio.us Digg Facebook Google Google+ Linked in reddit StumbleUpon Twitter Yahoo