In my map I am setting up some traps. Each has its own trigger region(s), and its effect region which will be either a sound region or damage region. When a player enters the trigger region, the effect region will be activated.
The mission script won't recognize the regions though. For example, I have regions "alarm_trigger", "alarm_trigger2", and "alarm_trigger3". At first they were grouped, all with the property "alarm_trigger". The script would find the first region but not the 2nd or 3rd. So I ungrouped them and set their properties to match their names (by editing the .RGN file), and nothing changed in-game.
With the other trap, I have a damage region "trap_region_dam" and a trigger region "trap_region". Neither are recognized by the mission script, but when I walk into the damage region, I still get hurt.
Any idea what's going on?
Regions cannot be found
Moderator: Moderators
-
- Master Sergeant
- Posts: 163
- Joined: Sun Feb 02, 2014 6:13 pm
- Projects :: Battlefront II Hunger Games
- Contact:
-
- Resistance Leader
- Posts: 5042
- Joined: Tue Feb 09, 2010 8:43 pm
- Projects :: DI2 + Psychosis
- xbox live or psn: Marth8880
- Location: Edinburgh, UK
- Contact:
Re: Regions cannot be found
I believe sound trigger regions require the ActivateRegion function in the LUA.
Edit: Or this, apparently, I guess:
Edit: Or this, apparently, I guess:
[color=#DD9900]soundhooks.txt[/color] wrote:Code: Select all
------------------------------------------------------------------------------- ScriptCB_TriggerSoundRegionEnable(groupName, enable) groupName : name of the trigger sound region group to enable / disable enable : 1 to enable, 0 to disable. Enabled by default
-
- Master Sergeant
- Posts: 163
- Joined: Sun Feb 02, 2014 6:13 pm
- Projects :: Battlefront II Hunger Games
- Contact:
Re: Regions cannot be found
At the moment I'm not sure if I should use a sound trigger region or another type of sound region. The alarm will be set off when a player walks inside an area but the sound region extends far outside the area, and will play the sound continuously until it gets turned off by an event. What kind of sound can I use with a sound trigger region (stream, space, etc.), and will it loop? I don't see any stock maps using sound trigger regions, they just attach sounds to animations (doors usually) instead.
(Sorry, sound is one of the few things I haven't looked much into yet with modding, so I'm still a noob with it )
And what about the other regions?
(Sorry, sound is one of the few things I haven't looked much into yet with modding, so I'm still a noob with it )
And what about the other regions?
-
- Resistance Leader
- Posts: 5042
- Joined: Tue Feb 09, 2010 8:43 pm
- Projects :: DI2 + Psychosis
- xbox live or psn: Marth8880
- Location: Edinburgh, UK
- Contact:
Re: Regions cannot be found
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.
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:
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)
In order to use other regions with Lua, you need to use the ActivateRegion function with them.[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
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:LRKfm946 wrote:What kind of sound can I use with a sound trigger region (stream, space, etc.), and will it loop?
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()
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"
-
- Master Sergeant
- Posts: 163
- Joined: Sun Feb 02, 2014 6:13 pm
- Projects :: Battlefront II Hunger Games
- Contact:
Re: Regions cannot be found
Well I decided to go with the spawn sound emitter option, but unsurprisingly the custom sounds aren't working. The thunder sounds work fine though.
My sounds are 16-bit PCM signed .wav files, 705kbps, not sure what sample rate. Audacity doesn't give any options when exporting .wav files
Here are my files:
hgs.req
hgsgcw.req
hgsgcw.sfx
hgscustom.asfx
hgs_sounds.snd
com_snd_amb_alarm.odf
My sounds are 16-bit PCM signed .wav files, 705kbps, not sure what sample rate. Audacity doesn't give any options when exporting .wav files
Here are my files:
hgs.req
Hidden/Spoiler:
Hidden/Spoiler:
Hidden/Spoiler:
Hidden/Spoiler:
Hidden/Spoiler:
Hidden/Spoiler:
-
- Resistance Leader
- Posts: 5042
- Joined: Tue Feb 09, 2010 8:43 pm
- Projects :: DI2 + Psychosis
- xbox live or psn: Marth8880
- Location: Edinburgh, UK
- Contact:
Re: Regions cannot be found
Try putting the contents of your .sfx file into your .asfx file, and don't load the .sfx file. (Remember to remove the reference to the .sfx file from your REQ.)
Also, don't worry about the bit rate (705kbps in your case). Additionally, are your custom sounds normalized to their maximum gain in Audacity? To normalize them, select your track(s) and go to Effects, Normalize, set "Normalize maximum amplitude to:" to 0.0, and slap the OK button in its pretty face.
LRKfm946 wrote:My sounds are 16-bit PCM signed .wav files, 705kbps, not sure what sample rate. Audacity doesn't give any options when exporting .wav files
Hidden/Spoiler:
-
- Master Sergeant
- Posts: 163
- Joined: Sun Feb 02, 2014 6:13 pm
- Projects :: Battlefront II Hunger Games
- Contact:
Re: Regions cannot be found
Ok I'll try just using the .asfx. And yep they're already normalized.
By the way, to add in all the missing gcw sounds, I'm assuming I'm going to have to copy all the sound properties from imp_unit.snd and all_unit.snd in addition to including the wavs in hgs.asfx?
Edit: It didn't work. The custom sounds still didn't play. I also tried adding in just one gcw sound (bowcaster chargeup) but that didn't work either. First I just copied the bowcaster charge sound property into hgs_sounds.snd, then I removed that and tried adding "wok_vo" in hgsgcw.req.
I do get some errors every time I munge sound but I doubt they affect anything because I'm not using anything from coruscant, and like I said, some of the sounds I added through my custom sound lvl are working, so it's not a munging problem.
Errors:
By the way, to add in all the missing gcw sounds, I'm assuming I'm going to have to copy all the sound properties from imp_unit.snd and all_unit.snd in addition to including the wavs in hgs.asfx?
Edit: It didn't work. The custom sounds still didn't play. I also tried adding in just one gcw sound (bowcaster chargeup) but that didn't work either. First I just copied the bowcaster charge sound property into hgs_sounds.snd, then I removed that and tried adding "wok_vo" in hgsgcw.req.
I do get some errors every time I munge sound but I doubt they affect anything because I'm not using anything from coruscant, and like I said, some of the sounds I added through my custom sound lvl are working, so it's not a munging problem.
Errors:
Hidden/Spoiler: