I have a sound cue that I want played whenever the player does a specific action. I've got it playing fine and everything but I want to make the resource that is used come from a configuration file instead of being hard coded.
So I added a property to my class called MonsterNoiseSoundCue as follows:
var config SoundCue MonsterNoiseSoundCue;
Then in the DefaultProperties section I added the following to the object I create which then then added to the components collection of my pawn.
Begin Object Class=AudioComponent Name=MonsterActivatedSound1
bAutoPlay=false
SoundCue=MonsterNoiseSoundCue// This variable is a configured value. SoundCue'CastleAudio.UI.UI_StopTouchToMove_Cue'
End Object
Components.Add(MonsterActivatedSound1);
MonsterActivatedSound = MonsterActivatedSound1;
For some reason it doesn't build saying "Not allowed to use 'config' with object variable." Does anyone know of another way to approach this?
That "Not allowed to use 'config' with object variable." message was a change in UnrealEngine 3.
I cannot test right now and I'm a UT2004 scripter, but I would try this:
In your PreBeginPlay function (or similar), use this to get the cue:
You should get a warning in the log if the sound cue doesn't exist.