• Player model sounds?
    4 replies, posted
I have ragdoll mod installed, so everytime you go ragdoll your character makes a noise, or when they get hurt as a ragdoll you make a noise. I was wondering what controls that, because I have zombine player models that each make a different noise set. I want them to make zombie noises, not human or combine. Any clue how to go about this?
Anyone?
Get a list of sounds, define them in a table like so: [code] DeathSoundsModels = { "zombiesound1.wav", "zombiesound2.wav", "zombiesound3.wav" } [/code] Make a list of models you want the sounds to play on: [code] ZombieModels = { "zombiemodel1.mdl" "zombiemodel2.mdl" "zombiemodel3.mdl" } [/code] Then define it in the script somewhere: [code] if (ply:GetModel() == ZombieModels) then self:EmitSound(DeathSoundsModels[math.random(1, #DeathSoundsModels)]) else -- etc etc end [/code] Not entirely sure if that is how you get player models from a table, it probably isn't. If no-one replies on how to properly call players models from a table, just use this (no matter how sloppy): [code] if (ply:GetModel() == "zombiemodel1" or ply:GetModel() == "zombiemodel2" or ply:GetModel() == "zombiemodel3") then self:EmitSound(DeathSoundsModels[math.random(1, #DeathSoundsModels)]) else -- etc etc end [/code] Remember, don't add in .mdl on the end.
you would use [b][url=wiki.garrysmod.com/?title=Table.HasValue]Table.HasValue [img]http://wiki.garrysmod.com/favicon.ico[/img][/url][/b] and you would have to defnine the whole model path for example "models/Zombie/classic.mdl" not sure if thats the path to the zombie model, but i think you get it
Sweet, thats what i was looking for Kamern! Thank you!
Sorry, you need to Log In to post a reply to this thread.