Wolfrug's Dynamic Sound AI (RUG DSAI).
Version: 0.3 BETA
Requires: ArmA v.1.08
Credits: ECP for Generic Sounds & Russian voices (and inspiration), Soldier of Fortune II demo for Spanish voices, COD4 demo for Arab voices, BIS for US voices. Armaholic for hosting me!
Beta thread:
http://www.ofpec.com/forum/index.php?topic=30495.0Download links:
(Look in the above thread for link to "full" version)
Filefront link: Beta 0.3 LITEArmedassault.info mirror:
Lite + normalArmaholic mirror:
Lite + normalFilefront mirror for EXTRA RUSSIAN VOICES : just unzip into the same directory as the full version (will only overwrite init.sqs).
Missions using DSAI:
Were We Soldiers by MrN (requires VTE mod - uses modified v.0.1)
Version history:
V0.1 BETA
- Initial release
v0.2 BETA
- Added two new scripts (UnderFireCheck.sqf & ContactCheck.sqf)
- Changed the scripts from group-centric to unit-array centric.
- Added Spanish sounds (SF2 demo)
- Removed Russian sounds (too big + no word from ECP)
- Added global variable RUG_DSAI_TerminalDistance to decide on range of scripts.
- Split into Lite and normal versions.
v0.3 BETA
- Added more functionality to RUG_DSAI_TerminalDistance (can actually terminate all scripts now).
- Added second global variable RUG_DSAI_CycleTime to decide loop rates of certain scripts.
- Added two new sound level defines to the description.ext, so that there are now three: normal, loud and quiet (GENERAL_SPEECH_SOUND_LEVEL, GENERAL_SPEECH_SOUND_LEVEL2, GENERAL_SPEECH_SOUND_LEVEL3)
- Minor fixes on some scripts.
- Added proper readme
- Added some minor elements to the demo mission...
Contents of readme (available in download packages for v0.3)):
1) Concept
2) Use (overall)
3) Guide on how to add to your own mission.
1)Concept:
This is a Dynamic Sound AI (DSAI) much like the one used in the OFP Mod Enhanced Configuration Project (ECP), from where the inspiration to make this came.
What it does is add voices to soldiers which are appropriate to the situation. It is a (in my opinion) easily enough editable package, that can be added to any mission with a minimum of hassle. There are currently two versions: Lite, which only has the default BIS voices, and "normal", which also contains the configs and sound files for Spanish and Arabic.
2)Use (overall):
Everything important is inside a folder named "RUG_DSAI", except the RUG_DSAIinit.sqf scripts (more on them later). The RUG_DSAI folder has within it the *.h files which define the various sounds (included or excluded from the description.ext using #include as wished by the mission maker).
It also has functions (named things such as DSAI_Behaviour.sqf, or DSAI_ArabBehaviour.sqf). These contain within them the LISTS OF SOUNDS used by the scripts withing the RUG_DSAI\Scripts folder. This is where the real "dynamicness" comes in. You can, for instance, make a list of sounds which only use ONE speaker (say Robert Polo, or "number 4", or whatever), and then use that list for that one character, to avoid having one person speak in many different voices. Alternatively, if you don't like certain sounds, you can simply edit them out of this list and they'll never be spoken. The current lists are (for standard English sounds):
DSAI_Behaviour.sqf -> sounds for Safe/aware/combat/stealth.
DSAI_EnemyKilled.sqf -> sounds for "normal" enemy kill (<1000 rating change) and "big" enemy kill (>1000 rating change)
DSAI_Fleeing -> Activated for units within the group that are fleeing.
DSAI_Generic -> not language bound. Contains sounds like "ahem", and "sneeze" and "laugh" (stolen from ECP). Dependant on the current behaviour of the group (i.e., no laughing while in Aware, etc).
DSAI_Misc -> miscellaneous sounds, such as for reloading, throwing grenades, firing weapons.
DSAI_OwnKilled -> Sounds for when someone in the group is killed and teammembers react.
DSAI_Wounded -> Sounds played when and while wounded.
DSAI_Contact -> Sounds played when in contact and out of contact (v0.2)
DSAI_UnderFire -> Sounds played when under fire (sometimes: rather iffy) (v0.2)
The RUG_DSAI\Sounds folder holds within it the sounds. Their paths are defined in the *.h files in the root RUG_DSAI folder. Don't move them around unless you also change their path in the *.h file!
The RUG_DSAI\Scripts folder holds within it the scripts used globally by each "list". Most scripts take two arguments: the name of the list and the name of the group it's to be applied on. Some scripts are run for each unit separately.
And finally: the RUG_DSAIInit.sqf files: these simply run all the scripts in their right folders for the group. It will first pre-compile the lists, then send them off to each script together with the group name.
3)Tutorial on how to add to your own mission:
1) Make sure the mission file in question is "open" (i.e., not in .pbo format), and then copy over to it the whole RUG_DSAI folder, and the DSAIInit.sqf files you need (for instance the default RUG_DSAIInit.sqf and RUG_ArabDSAIInit.sqf). You can remove any sounds you find unnecessary to make the file size smaller.
2) From the description.ext included in the demo mission, first copy over to the other mission's description.ext the top section that says:
#define GENERAL_SPEECH_SOUND_LEVEL db-0
#define GENERAL_SPEECH_SOUND_LEVEL2 db-10
#define GENERAL_SPEECH_SOUND_LEVEL3 db-30
#define GENERAL_SPEECH_SOUND_LEVEL4 db-35
#define GENERAL_SPEECH_SOUND_LEVEL5 db-10
#define GENERAL_SPEECH_SOUND_LEVEL6 db-10
(You really only need the top three, the others might be implemented in the future). If the mission doesn't have a description.ext, you can just copy the demo mission's as a whole.
After that, in the other mission's description.ext you need to find a point where it says:
class CfgSounds
{
sounds[] = {};
There might or might not be a section like this: if there isn't one, just copy it from the demo mission's description.ext. If there is one, though, copy-paste all the #includes into it (just put them straight under the sounds[]= {}; to make sure they're within the curled brackets. Afterwards it should look something like this:
class CfgSounds
{
sounds[] = {};
// RUG_DSAI sounds
#include "RUG_DSAI\DSAI_BehaviourSounds.h"
#include "RUG_DSAI\DSAI_FleeingSounds.h"
#include "RUG_DSAI\DSAI_WoundedSounds.h"
#include "RUG_DSAI\DSAI_OwnKilledSounds.h"
#include "RUG_DSAI\DSAI_EnemyKilledSounds.h"
#include "RUG_DSAI\DSAI_MiscSounds.h"
#include "RUG_DSAI\DSAI_GenericSounds.h"
#include "RUG_DSAI\DSAI_ContactSounds.h"
#include "RUG_DSAI\DSAI_UnderFireSounds.h"
#include "RUG_DSAI\DSAI_RUSBehaviourSounds.h"
#include "RUG_DSAI\DSAI_ArabBehaviourSounds.h"
#include "RUG_DSAI\DSAI_ArabEnemyKilledSounds.h"
#include "RUG_DSAI\DSAI_ArabMiscSounds.h"
#include "RUG_DSAI\DSAI_ArabWoundedSounds.h"
#include "RUG_DSAI\DSAI_ArabOwnKilledSounds.h"
#include "RUG_DSAI\DSAI_ArabContactSounds.h"
#include "RUG_DSAI\DSAI_ArabUnderFireSounds.h"
#include "RUG_DSAI\DSAI_SPABehaviourSounds.h"
#include "RUG_DSAI\DSAI_SPAEnemyKilledSounds.h"
#include "RUG_DSAI\DSAI_SPAWoundedSounds.h"
#include "RUG_DSAI\DSAI_SPAOwnKilledSounds.h"
#include "RUG_DSAI\DSAI_SPAContactSounds.h"
};
Note that if you're not using any of the languages mentioned up above, you can just edit out them (i.e. SPA and RUS). Nothing changes though if you leave them in.
3) After this, it's just a matter of initializing the sounds themselves! This is best done from the init.sqs or init.sqf file of the mission. If the mission for some reason doesn't have an init.sqs or init.sqf, just copy-paste the one from the demo mission. The command is fairly simple:
;RUG_TerminalDistance is the distance in meters at which all DSAI scripts shut off automatically. Default = 1000.
;Setting RUG_TerminalDistance to -1 automatically shuts off all DSAI scripts. Setting it to 0 pauses them.
;RUG_CycleTime is a relative number in seconds which determines how often certain sounds are played. Default = 5.
RUG_DSAI_TerminalDistance = 1000;
RUG_DSAI_CycleTime = 5;
RUG_DSAI= [(units aPgrp), (units bPgrp), units dudegrp] execVM "RUG_DSAIinit.sqf"
(note that if you're pasting this into an init.sqf file, you need to delete the commented line that starts with ; up above, and put a ; after each line). What you're seeing above is the standard way of initializing the English-language version for three different groups, named aPgrp, bPgrp and dudeGrp. Most groups in the coop mission should hopefully be named already; you probably need to go into the mission to check out their names (they will have something like "group1 = group this" in their init fields; if they don't, just name the groups using that piece of code (without quotes). Remember to name each group differently!). After you've got the names of each group you want to add, just add them using the same syntax as above. I.e.,
RUG_DSAI=[(units NameOfGroup1), (units NameOfGroup2), (units NameOfGroup3)] execVM "RUG_DSAIInit.sqf";
Do the same for the groups you want to have Arab/other language sounds. Find them in the editor, and name them if they aren't already, and then run the same script as above (except with RUG_ArabDSAIInit.sqf, or whichever is applicable). Do note however that if the mission maker has enemy groups (or friendly for that matter) spawn dynamically, you might have to do a lot more work to get the sounds to work with each group. For most standard missions however it should work just fine. Smiley
NOTE 1: The global variable RUG_DSAI_TerminalDistance. If this is not defined anywhere, it will default to 1000. This will decide the distance in meters around the player that the sounds will be played and the scripts run - mess around with it to see what suits you best. Having a lot of groups far outside of earshot that still have the scripts running is a bit unnecessary, and in cities especially sound occlusion makes it hard to ear very far - so you might want to limit it to something like 500 meters or so. But that's up to you. Setting it to -1 will terminate all RUG_DSAI scripts, setting it to 0 will simply pause them.
NOTE 2: The global variable RUG_DSAI_CycleTime gives a relative amount of time that certain scripts cycle (BehaviourCheck, GenericCheck, WoundedCheck): you can experiment with it to get a quick and easy change on the intervals of those checks (10 is pretty good). It defaults to 5.
NOTE 3: In the description.ext you #defined some variables named GENERAL_SPEECH_SOUND_LEVEL(+ number). The first, unnumbered one, is used by most sounds. The second (GENERAL_SPEECH_SOUND_LEVEL2) is used by the more "shouty" sounds (Behaviour:combat, underfire and contact). The third, GENERAL_SPEECH_SOUND_LEVEL3 is currently only used by the Generic sounds. Basically they are supposed to represent three sound levels: normal, loud and quiet. By either lowering (db-10, for instance) or raising (db+10, for instance) these variables in the description.ext, you can decide how far the voices are heard. It won't raise/lower their -volume-, but they will be heard longer/shorter distances. If you're not happy with 0 (no change), just raise or lower it as you see fit.
Thanks for testing!
Wolfrug out.