Guest User

Modified Deathrattle Sounds Code

a guest
Feb 19th, 2024
158
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 2.27 KB | None | 0 0
  1.     -- use vanilla sounds for all races
  2.     local Races = {["Argonian"] = true, ["Breton"] = true, ["Dark Elf"] = true, ["High Elf"] = true, ["Imperial"] = true, ["Khajiit"] = true, ["Nord"] = true, ["Orc"] = true, ["Redguard"] = true, ["Wood Elf"] = true}
  3.     if (Races[e.reference.object.race.id]) then
  4.         local genderPath = e.reference.object.female and "f" or "m"
  5.         local racePath = ({
  6.             ["Argonian"] = "a",
  7.             ["Breton"] = "b",
  8.             ["Dark Elf"] = "d",
  9.             ["High Elf"] = "h",
  10.             ["Imperial"] = "i",
  11.             ["Khajiit"] = "k",
  12.             ["Nord"] = "n",
  13.             ["Orc"] = "o",
  14.             ["Redguard"] = "r",
  15.             ["Wood Elf"] = "w",
  16.         })[e.reference.object.race.id]
  17.         local range = ({
  18.             ["Argonian"] = ({
  19.                 ["f"] = 16,
  20.                 ["m"] = 16,
  21.             }),
  22.             ["Breton"] = ({
  23.                 ["f"] = 15,
  24.                 ["m"] = 15,
  25.             }),
  26.             ["Dark Elf"] = ({
  27.                 ["f"] = 14,
  28.                 ["m"] = 14,
  29.             }),
  30.             ["High Elf"] = ({
  31.                 ["f"] = 15,
  32.                 ["m"] = 15,
  33.             }),
  34.             ["Imperial"] = ({
  35.                 ["f"] = 15,
  36.                 ["m"] = 10,
  37.             }),
  38.             ["Khajiit"] = ({
  39.                 ["f"] = 16,
  40.                 ["m"] = 16,
  41.             }),
  42.             ["Nord"] = ({
  43.                 ["f"] = 15,
  44.                 ["m"] = 14,
  45.             }),
  46.             ["Orc"] = ({
  47.                 ["f"] = 21,
  48.                 ["m"] = 15,
  49.             }),
  50.             ["Redguard"] = ({
  51.                 ["f"] = 14,
  52.                 ["m"] = 15,
  53.             }),
  54.             ["Wood Elf"] = ({
  55.                 ["f"] = 15,
  56.                 ["m"] = 15,
  57.             }),
  58.         })[e.reference.object.race.id][genderPath]
  59.         local randomInRange = math.random(1, range)
  60.         local rangePath = ((randomInRange < 10) and "00" or "0") .. randomInRange
  61.  
  62.         soundPath = "vo\\" .. racePath .. "\\" .. genderPath .. "\\Hit_" .. racePath .. genderPath .. rangePath .. ".mp3"
  63.         -- i.e. vo\k\f\Hit_KF016.mp3 for Khajiit female
  64.  
  65.         tes3.playSound({ reference = e.reference, soundPath = soundPath }) 
  66.         return
  67.     end
  68.  
  69.     -- now unused
  70.     -----------------------------------------------------------------
  71.     -- use Gothic sounds for all races except Argonian, Khajiit, Orc
  72.     --if e.reference.object.female then
  73.     --  soundPath = ({
  74.     --      "vo\\death\\SVM_16_DEAD_RU.mp3",
  75.     --      "vo\\death\\SVM_17_DEAD_RU.mp3",
  76.     --      "vo\\death\\SVM_17_DEAD_EN.mp3",
  77.     --      "vo\\death\\SVM_17_DEAD_PL.mp3",
  78.     --  })[math.random(1, 4)]
  79.     --else
  80.     --  soundPath = ({
  81.     --      "vo\\death\\SVM_13_DEAD_RU.mp3",
  82.     --      "vo\\death\\SVM_3_DEAD_DE.mp3",
  83.     --  })[math.random(1, 2)]
  84.     --end
  85.     -----------------------------------------------------------------
Advertisement
Add Comment
Please, Sign In to add comment