This covers the entirety of sound trigger regions. Also, take a look at Hoth (and I think pretty much only Hoth lol) for an example of a .tsr file, specifically hot1gcwtrig.tsr.
[color=#DD9900]soundhooks.txt[/color] wrote:Code: Select all
-------------------------------------------------------------------------------
TriggerRegions
-------------------------------------------------------------------------------
It's possible to trigger a sound as a player walks into a region.
A configuration file for the sound triggering regions should have the
extension .tsr and should contain a number of Group() and Region()
sections.
Each Group() has the following properties...
Name : Name of the group (referenced by the Region())
Reinforcements : The fraction of reinforcements the players team needs to
exceed before the group is triggered.
Alliance : Sound / stream triggered when player is on the alliance team
Empire : Sound / stream triggered when player is on the empire team
Republic : Sound / stream triggered when player is on the republic team
CIS : Sound / stream triggered when player is on the CIS team
Each Region() has the following properties...
Name : Name of the region (referenced in the region name in the world)
Group : 1 or more groups associated with this region. The first group with
reinforcements lower than the player team's reinforcements count
is triggered while the player is in the region.
For example the file hoth.tsr could contain...
Group()
{
Name("hot_carrier_away1");
Reinforcements(0.7);
Alliance("all_vo_shipaway1");
Empire("imp_vo_shipaway1");
Republic("");
CIS("");
}
Group()
{
Name("hot_carrier_away2");
Reinforcements(0.4);
Alliance("all_vo_shipaway2");
Empire("imp_vo_shipaway2");
Republic("");
CIS("");
}
Group()
{
Name("hot_vehiclewarning");
Reinforcements(0.0);
Alliance("all_vo_warningwalkers");
Empire("all_vo_warningwalkers");
Republic("");
CIS("");
}
Region()
{
Name("hot_hanger");
Group("hot_carrier_away1");
Group("hot_carrier_away2");
}
Region()
{
Name("hot_trenches");
Group("hot_vehiclewarning");
}
Then a region (box / sphere etc.) in the region file is created for each area
(a region can consist of multiple boxes, sphere etc.). The label of each
region should be in the following format...
soundtrigger {regionname}
In the above example the regions would be called
soundtrigger hot_hanger
soundtrigger hot_trenches
In order to use other regions with Lua, you need to use the
ActivateRegion function with them.
LRKfm946 wrote:What kind of sound can I use with a sound trigger region (stream, space, etc.), and will it loop?
You can use both sound effects and sound streams with sound trigger regions. The effect/stream will (should) loop if you include
Looping(1); in the
SoundProperty() or
SoundStreamProperty(). If you want to stop the sound, using
ScriptCB_TriggerSoundRegionEnable(groupName, 0) (the 0 signifies the region being disabled; a 1 would enable it) *might* work. If that doesn't work and you don't plan on using any music in the map (which would certainly be very immersive in my opinion), you could always skip sound trigger regions entirely and instead use normal regions with
OnEnterRegion, set the sounds up as music, and use these:
Code: Select all
-------------------------------------------------------------------------------
ScriptCB_PlayInGameMusic(musicID)
musicID : ID of the music to play in game
-------------------------------------------------------------------------------
ScriptCB_StopInGameMusic()
stops the music previously played using ScriptCB_PlayInGameMusic()
The only downside that I can think of with this is the fact that you can't really overlap music (I don't think; I've never tried it) so multiple alarm sounds can't be playing simultaneously.
Another alternative that you could try is use
OnEnterRegion with a normal region to create a sound emitter object at a specified node or matrix (make sure to give it a unique name) with this in the ODF:
Code: Select all
[GameObjectClass]
ClassLabel = "SoundAmbienceStatic"
GeometryName = "speaker.msh"
GeometryScale = 1.0
[Properties]
Sound = "soundPropertyName"
MinDistance = "1.0"
MaxDistance = "10.0"
And then use
KillObject(uniqueObjectName) when the 'finish' event is returned or something. You'd obviously change "soundPropertyName" to the name of your sound property, and if you want to use a stream instead of an effect for whatever reason, you'd change "SoundAmbienceStatic" to "SoundAmbienceStreaming" and reference a sound stream property instead of a sound property in the
Sound parameter. I recommend using an effect instead of a stream because from what I've experienced, streams that are played through sound stream emitters aren't spatial. (i.e., such sounds are always routed through the same speaker channels regardless of the direction that the player is facing, an example of this being music or command post VOs)