Skip to content

Voices

A voice is a set of sounds.xml entries named <prefix>_<line>. Point an NPC at it with DSDNpcVoice:

<property name="DSDNpcVoice" value="myVoice"/>

Every line is optional; missing lines stay silent. Give each line 2-3 takes so it doesn't repeat.

Lines

Line When Heard by
greet A player starts talking. that player
greet_friendly Same, when the player is liked (600+) or the NPC works for them. that player
hire Hired. everyone near
dismiss Dismissed, or the contract ran out. everyone near
follow, stay, guard Orders. everyone near
thanks Given a weapon or ammo. everyone near
refuse Can't be hired, or can't use the item. everyone near
combat_start, enemy_spotted Picks a new target (one or the other). everyone near
reload Reloading. everyone near
low_ammo 10 rounds left. everyone near
no_ammo Out of ammo. everyone near
kill Its target died. everyone near
idle_chatter Hired and following, every few minutes. everyone near
bandit_taunt A bandit picks a player as its target. everyone near
bandit_flee A bandit breaks off under 25% health. everyone near

Pain and death use the vanilla entity properties SoundHurtSmall, SoundHurt and SoundDeath; point them at your own nodes too.

Lines don't talk over each other: one line per NPC every 2.5 s at most, combat call-outs at most every 8 s, chatter at most every 90 s.

sounds.xml

<configs>
  <append xpath="/Sounds">
    <SoundDataNode name="myVoice_greet"> <AudioSource name="@:Sounds/Prefabs/AudioSource_Creatures.prefab"/>
      <Noise ID="1" noise="4" time="1" muffled_when_crouched="0.5"/>
      <AudioClip ClipName="#@modfolder:Resources/myvoices.unity3d?myVoice_greet_1"/>
      <AudioClip ClipName="#@modfolder:Resources/myvoices.unity3d?myVoice_greet_2"/>
      <AudioClip ClipName="#@modfolder:Resources/myvoices.unity3d?myVoice_greet_3"/>
      <Channel name="Mouth"/> <Priority name="0"/> <maxVoicesPerEntity value="1"/>
      <LocalCrouchVolumeScale value="1.0"/> <CrouchNoiseScale value="0.5"/> <NoiseScale value="1"/>
      <MaxVoices value="10"/> <MaxRepeatRate value="1"/> </SoundDataNode>
  </append>
</configs>

Packing the clips

  1. Unity 2022.3.62f2. Import your clips (mp3, ogg or wav).
  2. Per clip: Force To Mono on, Load Type Decompress On Load, Compression Vorbis (quality about 60).
  3. Name every clip uniquely (myVoice_greet_1...) and set its AssetBundle to myvoices.
  4. Build the bundle for Windows and save it as Resources/myvoices.unity3d in your mod.

Writing lines

Short and tired works best: "Contact!", "Reloading!", "Got him." Record or generate 2-3 takes of each with different wording; it makes NPCs feel far less robotic.