Page 1 of 1

Triggered sounds: how to make them play for instigator only?

Posted: Tue Feb 26, 2019 1:48 am
by Dizzy
Hey all

When using a SpecialEvent to trigger a sound, is it possible to make the sound play only for the person who triggers it?

I messed around with various properties in SpecialEvent but the sound was still being played for every player in the map, even if they were far away from the trigger.

Thanks

Re: Triggered sounds: how to make them play for instigator o

Posted: Tue Feb 26, 2019 2:09 am
by JackGriffin
Subclass it and script your own. Would take about 10 seconds of work. AFAIK there's not a way to restrict a triggered sound to the instigator with the default settings. I'm sure there's a way to cheat it (like the bunny trick for triggers) but it's just going to be simpler to subclass and restrict.

Re: Triggered sounds: how to make them play for instigator o

Posted: Tue Feb 26, 2019 6:02 pm
by Barbie
Dizzy wrote:When using a SpecialEvent to trigger a sound, is it possible to make the sound play only for the person who triggers it?
No. But as Jack suggested, you can easily expand (subclass) this Actor and use ClientPlaySound() to play the sound only for the instigator. Create a new state PlayerPlaySoundEffect for example:

Code: Select all

//=============================================================================
// SpecialEventEx.
//=============================================================================
class SpecialEventEx expands SpecialEvent;

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

		Global.Trigger( Self, EventInstigator);
		if (PlayerPawn(EventInstigator) != None)
			PlayerPawn(EventInstigator).ClientPlaySound(Sound);
	}
}
(See also attached map "TestSpecialEventEx.unr".)

I have used such in my SBBeepTrigger: here the sound can be played for the instigator only optionally.

Re: Triggered sounds: how to make them play for instigator o

Posted: Sat Mar 02, 2019 6:36 pm
by Dizzy

Re: Triggered sounds: how to make them play for instigator o

Posted: Sun Mar 03, 2019 2:27 am
by Barbie

Code: Select all

if (
			PlayerPawn(EventInstigator) != none   &&
			PlayerPawn(EventInstigator).bIsPlayer &&
			PlayerPawn(EventInstigator).IsA('PlayerPawn')
)
:lol:
Make it really safe! Are you sure? - Yes. - Really? - Yes! - I mean, really really? - Yeehes.

Re: Triggered sounds: how to make them play for instigator o

Posted: Sun Mar 03, 2019 5:56 am
by JackGriffin
Barbie wrote: Make it really safe! Are you sure? - Yes. - Really? - Yes! - I mean, really really? - Yeehes.
You obviously aren't married. This is SO a normal conversation.

Re: Triggered sounds: how to make them play for instigator o

Posted: Sun Mar 03, 2019 8:35 am
by sektor2111
Isn't more simple to look for "TournamentPlayer" instead ?
I suppose "GoTo" used even in that "decompiled" MapVote is CPU intensive, not these USELESS checks iterating through objects, right ?
ISA is slow somehow doing the same effect as "PlayerPawn(EventInstigator) != None" one of these is pointless...

PS: :ironic: You forgot other check(s) if you want more USELESS safety...
UselessCodingSession

Code: Select all

if (PlayerPawn(EventInstigator).bIsPawn &&
!PlayerPawn(EventInstigator).bDeleteMe &&
PlayerPawn(EventInstigator).Health > 0 &&
!PlayerPawn(EventInstigator).bHidden &&
PlayerPawn(EventInstigator).Mesh != None &&
PlayerPawn(EventInstigator).DrawType == DT_Mesh &&
!PlayerPawn(EventInstigator).ISA('ScriptedPawn')&&
!PlayerPawn(EventInstigator).ISA('FlockPawn')&&
!PlayerPawn(EventInstigator).ISA('TeamCannon')&&
!PlayerPawn(EventInstigator).ISA('Carcass')&&
!PlayerPawn(EventInstigator).ISA('Mover')&&
!PlayerPawn(EventInstigator).ISA('NavigationPoint')&&
!PlayerPawn(EventInstigator).ISA('KeyPoint')&&
!PlayerPawn(EventInstigator).ISA('Triggers')
/*&&
etc. all bullshit useless checking
*/)
Now that it's definitely a PlayerPawn and nothing else -> inspired from codes shared through these almost 20 years of UT...