Regions cannot be found

In this forum you will find and post information regarding the modding of Star Wars Battlefront 2. DO NOT POST MOD IDEAS/REQUESTS.

Moderator: Moderators

Post Reply
LRKfm946
Master Sergeant
Master Sergeant
Posts: 163
Joined: Sun Feb 02, 2014 6:13 pm
Projects :: Battlefront II Hunger Games
Games I'm Playing :: SWBF2 BF3
Contact:

Regions cannot be found

Post by LRKfm946 »

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?
Marth8880
Resistance Leader
Posts: 5042
Joined: Tue Feb 09, 2010 8:43 pm
Projects :: DI2 + Psychosis
Games I'm Playing :: Silent Hill 2
xbox live or psn: Marth8880
Location: Edinburgh, UK
Contact:

Re: Regions cannot be found

Post by Marth8880 »

I believe sound trigger regions require the ActivateRegion function in the LUA.

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
LRKfm946
Master Sergeant
Master Sergeant
Posts: 163
Joined: Sun Feb 02, 2014 6:13 pm
Projects :: Battlefront II Hunger Games
Games I'm Playing :: SWBF2 BF3
Contact:

Re: Regions cannot be found

Post by LRKfm946 »

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?
Marth8880
Resistance Leader
Posts: 5042
Joined: Tue Feb 09, 2010 8:43 pm
Projects :: DI2 + Psychosis
Games I'm Playing :: Silent Hill 2
xbox live or psn: Marth8880
Location: Edinburgh, UK
Contact:

Re: Regions cannot be found

Post by Marth8880 »

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)
LRKfm946
Master Sergeant
Master Sergeant
Posts: 163
Joined: Sun Feb 02, 2014 6:13 pm
Projects :: Battlefront II Hunger Games
Games I'm Playing :: SWBF2 BF3
Contact:

Re: Regions cannot be found

Post by LRKfm946 »

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
Hidden/Spoiler:
[code]ucft
{
REQN
{
"str"
"align=2048"
"gcw_vo"
"gcw_tac_vo"
}
REQN
{
"lvl"
"hgsgcw"
}
}[/code]
hgsgcw.req
Hidden/Spoiler:
[code]ucft
{
REQN
{
"bnk"
"align=2048"
"hgsgcw"
"hgscustom"
}

REQN
{
"config"
"hgs_sounds"
}
}[/code]
hgsgcw.sfx
Hidden/Spoiler:
[code]..\kam\effects\emt_kamRainGutter_01.wav -resample ps2 11025 xbox 22050 pc 22050
..\kam\effects\emt_kamRainGutter_02.wav -resample ps2 11025 xbox 22050 pc 22050

..\..\global\effects\emt_thunder_clap_01.wav -resample xbox 16000 pc 22050
..\..\global\effects\emt_thunder_clap_02.wav -resample xbox 16000 pc 22050
..\..\global\effects\emt_thunder_clap_03.wav -resample xbox 16000 pc 22050
..\..\global\effects\emt_thunder_roll_01.wav -resample xbox 11025 pc 22050
..\..\global\effects\emt_thunder_roll_02.wav -resample xbox 11025 pc 22050
..\..\global\effects\emt_thunder_roll_03.wav -resample xbox 11025 pc 22050
[/code]
hgscustom.asfx
Hidden/Spoiler:
[code]effects\alarm.wav -resample xbox 22050 pc 22050
effects\amb_bees.wav -resample xbox 22050 pc 22050[/code]
hgs_sounds.snd
Hidden/Spoiler:
[code]I3DL2ReverbPreset()
{
Name("bees");
RoomGain(0.9);
RoomHFGain(0.7);
RoomRollOff(0.0);
DecayTime(3.0);
DecayHFRatio(0.5);
ERGain(0.2);
ERDelay(0.01);
ReverbGain(0.2);
ReverbDelay(0.05);
Diffusion(100.0);
Density(100.0);
HFReference(5000.0);
}

Space()
{
Name("amb_bees"); // Dark Jedi Bog
I3DL2ReverbPreset("bees");
DirectGain(1.0);
DirectHFGain(0.9);
RoomGain(1.0);
RoomHFGain(0.8);
RoomRollOffFactor(1.0);
ObstructionHFGain(0.6);
ObstructionLFRatio(1.0);
OcclusionHFGain(0.6);
OcclusionLFRatio(1.0);
}

SoundProperties()
{
Name("kam_amb_thunder")
Pitch(1.0);
PitchDev(0.15);
#ifplatform pc
Gain(1.0);
#endifplatform pc
#ifplatform xbox ps2
Gain(0.6);
#endifplatform xbox ps2
GainDev(0.2);
ReverbGain(1.0);
Bus("ambience");
Pan(0.0);
Mode3D(1);
Bias(0.0001);
Priority(0.5);
PlayInterval(3.0);
MinDistance(50);
MuteDistance(500);
MaxDistance(500);
SampleList()
{
Sample("emt_thunder_clap_01", 0.33);
Sample("emt_thunder_clap_02", 0.33);
Sample("emt_thunder_clap_03", 0.33);
}
}

SoundProperties()
{
Name("kam_amb_thundersub")
Pitch(1.0);
PitchDev(0.15);
#ifplatform pc
Gain(1.0);
#endifplatform pc
#ifplatform xbox
Gain(0.6);
#endifplatform xbox
GainDev(0.1);
ReverbGain(1.0);
Bus("ambience");
Looping(0);
Pan(0.0);
Mode3D(1);
Bias(0.0001);
Priority(0.5);
PlayInterval(0.5);
MinDistance(50);
MuteDistance(500);
MaxDistance(500);
SampleList()
{
Sample("emt_thunder_roll_01", 0.33);
Sample("emt_thunder_roll_02", 0.33);
Sample("emt_thunder_roll_03", 0.33);
}
}

SoundProperties()
{
Name("alarm")
Group("Props");
Inherit("props_template");
Looping(1);
SampleList()
{
Sample("alarm", 1.0);
}
}

SoundProperties()
{
Name("amb_bees")
Group("ambient_static");
Inherit("props_template");
Looping(1);
SampleList()
{
Sample("amb_bees", 1.0);
}
}[/code]
com_snd_amb_alarm.odf
Hidden/Spoiler:
[code][GameObjectClass]
ClassLabel = "SoundAmbienceStatic"
GeometryName = "speaker.msh"
GeometryScale = 1.0

[Properties]
Sound = "alarm"
MinDistance = "15.0"
MaxDistance = "66.0"[/code]
Marth8880
Resistance Leader
Posts: 5042
Joined: Tue Feb 09, 2010 8:43 pm
Projects :: DI2 + Psychosis
Games I'm Playing :: Silent Hill 2
xbox live or psn: Marth8880
Location: Edinburgh, UK
Contact:

Re: Regions cannot be found

Post by Marth8880 »

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.)
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:
Image
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
Master Sergeant
Master Sergeant
Posts: 163
Joined: Sun Feb 02, 2014 6:13 pm
Projects :: Battlefront II Hunger Games
Games I'm Playing :: SWBF2 BF3
Contact:

Re: Regions cannot be found

Post by LRKfm946 »

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:
Hidden/Spoiler:
soundflmunge.exe : Error : Unable to open file C:\BF2_ModTools\data_HGS\Sound\worlds\cor\..\..\global\effects\JediGen_ltsabr_throw_lp02.wav - while munging C:\BF2_ModTools\data_HGS\Sound\worlds\cor\cor1cw.sfx
soundflmunge.exe : Error : Unable to open file C:\BF2_ModTools\data_HGS\Sound\worlds\cor\..\..\global\effects\JediGen_ltsabr_throw_lp02.wav, format may be invalid - while munging C:\BF2_ModTools\data_HGS\Sound\worlds\cor\cor1cw.sfx
soundflmunge.exe : Error : Unable to read file list C:\BF2_ModTools\data_HGS\Sound\worlds\cor\cor1cw.sfx - while munging C:\BF2_ModTools\data_HGS\Sound\worlds\cor\cor1cw.sfx
Post Reply