Welcome, Guest. Please login or register.
Did you miss your activation email?
November 22, 2024, 08:04:17 PM
Home Help Login Register
News: Zombie Master 2 discussion

Zombie Master  |  Other  |  Trouble in Terrorist Town  |  Topic: Custom Weapons reload and draw sounds
Pages: [1]
Author Topic: Custom Weapons reload and draw sounds  (Read 3342 times)
GargamelUK
Poster

Posts: 3


« on: April 12, 2011, 04:21:00 AM »

Im using a few entirely custom weapons on my server. Im unsure how to specify the custom reload and draw wav files in ttt weapon luas.

The custom weapon tutorials i've read only seem to cover using pre-existing source-game sounds. Any help/tips would be greatly appreciated
Mr. Gash
Poster

Posts: 382


www.nonerdsjustgeeks.com


« Reply #1 on: April 12, 2011, 06:58:54 PM »

Add your custom sound(s_, then make a file in lua/autorun/server, and make a line with
resource.AddFile("sound/your/custom/sound/path.wav");

If you want more, just copy/past that line to the next line, replace it with your next sound path.

Now you can use that sound.
GargamelUK
Poster

Posts: 3


« Reply #2 on: April 12, 2011, 08:37:49 PM »

Its downloading the sound to clients but getting them to play when the weapon is reload or drawn is the problem. Currently everything relevant goes to the client and the models and fire sound all work. Ive only yet to do the icon

Ill post my LUA for reference
http://pastebin.com/vtbk06qt

The 2 lines at the bottom which specify the location for the draw and reload sounds were an attempt to add these values to the weapon lua in conjuction with adding

    if not worldsnd then
      self.Weapon:EmitSound
  elseif SERVER then
      WorldSound
  end


commands to the weapon_tttbase lua under the Reload and Draw functions. This didnt work
Bad King Urgrain
Administrator
*****
Posts: 12276



« Reply #3 on: April 12, 2011, 09:40:18 PM »

CS:S weapons specify every sound effect in their model, except the firing sound. Hence, TTT does not try to play any reload/draw sounds. Adding fields with creative names like SWEP.Reload.Sound has no effect. You will have to play them yourself, eg.
function SWEP:Reload()
  self:EmitSound("myreloadsound")

  return self.BaseClass.Reload(self)
end

function SWEP:Deploy()
  self:EmitSound("mydrawsound")

  return self.BaseClass.Deploy(self)
end
GargamelUK
Poster

Posts: 3


« Reply #4 on: April 12, 2011, 10:06:55 PM »

Thank you, that worked perfectly
Pages: [1]
Zombie Master  |  Other  |  Trouble in Terrorist Town  |  Topic: Custom Weapons reload and draw sounds « previous next »
Jump to:  


Login with username, password and session length

Powered by SMF 1.1.21 | SMF © 2015, Simple Machines
Page created in 0.01 seconds with 18 queries.