Hello and
Okay, so happy start of year 2011 for everyone of you guys! Yes and I'll now continue to main subject...
This tutorial continues my tutorial series of More Unique Races.
These tutorials are meant to help beginner race coders who want to add some little trick to their race to make it Unique. That's why I have explained everything as good as I can. Still these tutorials are NOT meant to be your first tutorial for WCS Race -coding. If you haven't ever made or published working race before, this is not the right place to begin. If you are totally new to race coding, I recommend to read AvasT's awesome tutorial here: [Tutorial]Basic Coding Concept.
In this tutorial, I'll show you how to add sound effects on your races to make them more Unique.
Let's begin.
This tutorial includes:
>> Introducing the command
> Setting parameters
>> Exploring sounds
> Choosing sounds
> Example of making skill with sound
>> Effective using of sounds
> Example of race with sounds
Introducing the command
How can I add sound effects to my race / skill?
This is quite simple, so I'll start right off with an code line which plays a sound:
Okay, so that's it. No other commands are needed.
Setting parameters
Not, let me explain the parameters:
As you might guess, the <userid> is the player who hears the sound we are playing. That could be replaced with server_var(wcs_userid)
Then the <sound>. This is the sound you are playing. It works just like models in my previous tutorial, Using Models. So replace that paremeter with path to your sound file, for example: sounds\weapons\crossbow\bolt_fly4.wav. And again, you should leave the sounds\ section away because that's the default folder CS:S looks into.
sounds\weapons\crossbow\bolt_fly4.wav
So right parameter <sound> could be like this:
weapons\crossbow\bolt_fly4.wav
NOTE: ALWAYS remember to set the FILETYPE, which is .wav on default sounds. Leaving filetype away, can and some cases will cause errors and crashes!
So, there is still one parameter left, the <volume>. And yes, this changes how loud is your sound played. Set this parameter to number from 0 to 1, when 0 is no sound and 1 is max volume. For example 0.5 is half of the max volume.
Exploring sounds
So how can I know what to set as a <sound> parameter? Or where can I find these sounds?
All the default sounds you can use are located in ..HL2\sounds (for example, I found them in my dedicated servers folder, which is SRCDS\hl2\sounds). There is sound folders, sorted as how they appear in game (Half-Life 2 and in some cases CS:S).
For example so if you want some long and environmental sounds, you could look inside the ambient folder. If you are looking for sound to your, let's say More Damage -skill, you could look inside the weapons or npc folders. Of course, these are only some suggestions, and nothing prevents you to use sounds from anywhere to anything.
Exploring files that way is good, because you can easily play those sounds with music player which supports .wav (wave) files, for example Windows Media Player.
Here is also a list for all the sounds you can use by default: soundlist.txt
Choosing sounds
When choosing sound, there are few thing you should think about.
First one is that the sound you are thinking is not too annoying, and think how it matches to your skill. You should also try out your sound in game everytime you are adding a new one to be sure is it working and how it really sounds in game with other sounds.
Also make sure not to make too loud sounds. If the soundfile is already loud or it can be used continuously, you should turn it's volume down to avoid distracting and annoying players.
The second thing you should keep eye on, is the lenght of your sound file. If you are choosing a sound for your More Damage On Attack -skill for example, I would guide you to avoid long and very distracting sounds. Long sound files are bad because if you happen to launch that sound over and over again (like shooting an enemy with skill which has sound effects) it can easily multiply and all you can hear is multiple sounds over each other. And that's what we don't want to happen, right?
After you have chosen the sound you want, just copy it's path, take the sounds\ part away from beginning of that path, and replace the <sound> part in the skill with your path.
Example of making skill with sound
Okay, here I want to make skill which plays the sound. When the sound plays depends on skillcfg:
skillcfg
"player_attacker" - Plays sound whenever you attack an enemy
"player_victim" - Plays sound whenever you are attacked by an enemy
"player_ultimate" - Plays sound whenever you activate the ultimate
"player_spawn" - Plays sound whenever you spawn
So here is one skill as example:
And now, I will set the parameters as it would be an "player_attacker" skill and I want it to play sound file "sounds\weapons\crossbow\bolt_fly4.wav" for my player at half volume:
And what have I done here:
- I have replaced the <userid> with event_var(attacker), which means me, as a attacker (player_attacker skill)
- I have replaced the <sound> with the sound file, but removed the sounds\ from beginning
- I have replaced the <volume> with value 0.5, which means half of max volume
So, not that hard isn't it?
Effective using of sounds
Okay, using sounds gives nice little Unique boost to your race and makes it more interesting. Using simple sound command is very simple and they are just fine with normal skills. Still, in some cases it can be really good effect to use multiple sounds to create amazing skills. Good and simple example of using sounds like this could be an ultimate skill with "On/Off" switch or just an ultimate with durational effect.
Here, let me show you some quick examples*:
*with quick I mean quick. I only made those for example of sounds. That means the sound part works, but the rest might include errors. Of course I avoid them as much as I can, but because I'm quite beginner and I didn't spend time to try them, I can't promise anything. They aren't meant to be used that way even they could work. I made them fast and didn't check them anyway, so please, avoid straight copying or fix and please, report misspellings and bugs
This skill (above) gives you little speed for time which is set by variable wcs_duration. But what you should see here is the using of sounds. When you activate the skill, you get the first sound (npc\vort\vort_pain3.wav) with volume set to half. When the time set by wcs_duration is over, you return to normal speed and hear the second sound (npc\turret_floor\active.wav) at half volume as well.
Okay and let's continue to second the example:
As you might notice, this is straight copy of Archmage Proudmoores ultimate where I only added some sounds. I wanted to use this, because this is quite simple, but most importantly very known ultimate, so it would distract you as little as possible.
I don't spend anymore time and space to explain exactly what I have done here, but the only thing I have added is found in both racealiases as the first thing in their lines. Those sound playing commands are made and they act just like we have learnt earlier.
So, as you can see from that example, you can also use sounds to give some nice effect on your old skills and races.
So there were few quick examples of using sounds more effective way in ultimate skills.
So, I think this tutorial is soon at the end, but I'll add one more example race here below:
Example of race with sounds
Okay, that's all today. Hope that this helps you guys.
More tutorials of this series are already coming, but keep telling us ideas on the forums own Request a Tutorial topic, which you can find HERE or in Tutorials section.
Thank you.
.+*** HAPPY NEW YEAR!!! ***+.
Okay, so happy start of year 2011 for everyone of you guys! Yes and I'll now continue to main subject...
This tutorial continues my tutorial series of More Unique Races.
These tutorials are meant to help beginner race coders who want to add some little trick to their race to make it Unique. That's why I have explained everything as good as I can. Still these tutorials are NOT meant to be your first tutorial for WCS Race -coding. If you haven't ever made or published working race before, this is not the right place to begin. If you are totally new to race coding, I recommend to read AvasT's awesome tutorial here: [Tutorial]Basic Coding Concept.
In this tutorial, I'll show you how to add sound effects on your races to make them more Unique.
Let's begin.
More Unique Races - Explorer
Part 1 - Using Models | Part 2 - Using Sounds
<<<Previous ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Next>>>
More Unique Races
Part 2 - Using Sounds
This tutorial includes:
>> Introducing the command
> Setting parameters
>> Exploring sounds
> Choosing sounds
> Example of making skill with sound
>> Effective using of sounds
> Example of race with sounds
Introducing the command
How can I add sound effects to my race / skill?
This is quite simple, so I'll start right off with an code line which plays a sound:
Code: [Select]
es_playsound <userid> <sound> <volume>Okay, so that's it. No other commands are needed.
Setting parameters
Not, let me explain the parameters:
As you might guess, the <userid> is the player who hears the sound we are playing. That could be replaced with server_var(wcs_userid)
Then the <sound>. This is the sound you are playing. It works just like models in my previous tutorial, Using Models. So replace that paremeter with path to your sound file, for example: sounds\weapons\crossbow\bolt_fly4.wav. And again, you should leave the sounds\ section away because that's the default folder CS:S looks into.
So right parameter <sound> could be like this:
weapons\crossbow\bolt_fly4.wav
NOTE: ALWAYS remember to set the FILETYPE, which is .wav on default sounds. Leaving filetype away, can and some cases will cause errors and crashes!
So, there is still one parameter left, the <volume>. And yes, this changes how loud is your sound played. Set this parameter to number from 0 to 1, when 0 is no sound and 1 is max volume. For example 0.5 is half of the max volume.
Exploring sounds
So how can I know what to set as a <sound> parameter? Or where can I find these sounds?
All the default sounds you can use are located in ..HL2\sounds (for example, I found them in my dedicated servers folder, which is SRCDS\hl2\sounds). There is sound folders, sorted as how they appear in game (Half-Life 2 and in some cases CS:S).
For example so if you want some long and environmental sounds, you could look inside the ambient folder. If you are looking for sound to your, let's say More Damage -skill, you could look inside the weapons or npc folders. Of course, these are only some suggestions, and nothing prevents you to use sounds from anywhere to anything.
Exploring files that way is good, because you can easily play those sounds with music player which supports .wav (wave) files, for example Windows Media Player.
Here is also a list for all the sounds you can use by default: soundlist.txt
Choosing sounds
When choosing sound, there are few thing you should think about.
First one is that the sound you are thinking is not too annoying, and think how it matches to your skill. You should also try out your sound in game everytime you are adding a new one to be sure is it working and how it really sounds in game with other sounds.
Also make sure not to make too loud sounds. If the soundfile is already loud or it can be used continuously, you should turn it's volume down to avoid distracting and annoying players.
The second thing you should keep eye on, is the lenght of your sound file. If you are choosing a sound for your More Damage On Attack -skill for example, I would guide you to avoid long and very distracting sounds. Long sound files are bad because if you happen to launch that sound over and over again (like shooting an enemy with skill which has sound effects) it can easily multiply and all you can hear is multiple sounds over each other. And that's what we don't want to happen, right?
After you have chosen the sound you want, just copy it's path, take the sounds\ part away from beginning of that path, and replace the <sound> part in the skill with your path.
Example of making skill with sound
Okay, here I want to make skill which plays the sound. When the sound plays depends on skillcfg:
skillcfg
"player_attacker" - Plays sound whenever you attack an enemy
"player_victim" - Plays sound whenever you are attacked by an enemy
"player_ultimate" - Plays sound whenever you activate the ultimate
"player_spawn" - Plays sound whenever you spawn
So here is one skill as example:
Code: [Select]
[[Skill1]]
setting = ""
cmd = "es_playsound <userid> <sound> <volume>"
sfx = ""
And now, I will set the parameters as it would be an "player_attacker" skill and I want it to play sound file "sounds\weapons\crossbow\bolt_fly4.wav" for my player at half volume:
Code: [Select]
[[Skill1]]
setting = ""
cmd = "es_playsound event_var(attacker) weapons\crossbow\bolt_fly4.wav 0.5"
sfx = ""
And what have I done here:
- I have replaced the <userid> with event_var(attacker), which means me, as a attacker (player_attacker skill)
- I have replaced the <sound> with the sound file, but removed the sounds\ from beginning
- I have replaced the <volume> with value 0.5, which means half of max volume
So, not that hard isn't it?
Effective using of sounds
Okay, using sounds gives nice little Unique boost to your race and makes it more interesting. Using simple sound command is very simple and they are just fine with normal skills. Still, in some cases it can be really good effect to use multiple sounds to create amazing skills. Good and simple example of using sounds like this could be an ultimate skill with "On/Off" switch or just an ultimate with durational effect.
Here, let me show you some quick examples*:
*with quick I mean quick. I only made those for example of sounds. That means the sound part works, but the rest might include errors. Of course I avoid them as much as I can, but because I'm quite beginner and I didn't spend time to try them, I can't promise anything. They aren't meant to be used that way even they could work. I made them fast and didn't check them anyway, so please, avoid straight copying or fix and please, report misspellings and bugs
Code: [Select]
[[Skill1]]
setting = "es_xset wcs_duration 9.0"
cmd = "es_playsound server_var(wcs_userid) npc\vort\vort_pain3.wav 0.5; es wcs_setfx speed server_var(wcs_userid) = 1.5 0; es_delayed server_var(wcs_duration) es wcs_setfx speed server_var(wcs_userid) = 1.0 0; es_delayed server_var(wcs_duration) es_playsound server_var(wcs_userid) npc\turret_floor\active.wav 0.5"
sfx = ""
cooldown = "15"This skill (above) gives you little speed for time which is set by variable wcs_duration. But what you should see here is the using of sounds. When you activate the skill, you get the first sound (npc\vort\vort_pain3.wav) with volume set to half. When the time set by wcs_duration is over, you return to normal speed and hear the second sound (npc\turret_floor\active.wav) at half volume as well.
Okay and let's continue to second the example:
Code: [Select]
[[skill1]]
setting = "es_xset wcs_bonushp 5|es_xset wcs_bonushp 6|es_xset wcs_bonushp 7|es_xset wcs_bonushp 8|es_xset wcs_bonushp 9|es_xset wcs_bonushp 10"
racealias_ap4 = "es_playsound server_var(wcs_userid) npc\vort\vort_pain3.wav 0.3; es wcs_setfx jetpack server_var(wcs_userid) = 1 0;es wcsgroup set jetpack server_var(wcs_userid) 1;es_math wcs_health + server_var(wcs_bonushp);es wcs_xtell server_var(wcs_userid) r_lift hp server_var(wcs_bonushp)"
racealias_ap4a = "es_playsound server_var(wcs_userid) npc\turret_floor\active.wav 0.3; es wcs_setfx jetpack server_var(wcs_userid) = 0 0;es wcsgroup set jetpack server_var(wcs_userid) 0;es_math wcs_health - server_var(wcs_bonushp)"
cmd = "es wcsx get health wcs_health server_var(wcs_userid);es wcsgroup get jetpack wcs_jetpack server_var(wcs_userid);if (server_var(wcs_jetpack) = 0) then wcs_xalias racealias_ap4;if (server_var(wcs_jetpack) = 1) then wcs_xalias racealias_ap4a;if (server_var(wcs_health) > 0) then wcs_setfx health server_var(wcs_userid) = server_var(wcs_health) 0"
sfx = ""
cooldown = "4|4|3|3|2|1" As you might notice, this is straight copy of Archmage Proudmoores ultimate where I only added some sounds. I wanted to use this, because this is quite simple, but most importantly very known ultimate, so it would distract you as little as possible.
I don't spend anymore time and space to explain exactly what I have done here, but the only thing I have added is found in both racealiases as the first thing in their lines. Those sound playing commands are made and they act just like we have learnt earlier.
So, as you can see from that example, you can also use sounds to give some nice effect on your old skills and races.
So there were few quick examples of using sounds more effective way in ultimate skills.
So, I think this tutorial is soon at the end, but I'll add one more example race here below:
Example of race with sounds
Code: [Select]
[Example Sound]
#Requirement section
required = 0
maximum = 0
#Restrict section
restrictmap = ""
restrictteam = 0
restrictitem = ""
#Other info
author = "Kamiqawa"
desc = "Example of sounds using"
spawncmd = "es_playsound server_var(wcs_userid) weapons\cguard\charging.wav 1"
deathcmd = ""
roundstartcmd = ""
roundendcmd = ""
preloadcmd = ""
allowonly = ""
onchange = ""
#Skill information
numberofskills = 1
numberoflevels = 1
skillnames = "Sound on attack|Sound on attacked|Sound on ultimate"
skilldescr = "Plays a sound when you attack an enemy|Plays a sound when you are attacked by an enemy|Plays a sound when you activate your ultimate"
skillcfg = "player_attacker|player_victim|player_ultimate"
skillneeded = "0|0|0"
#Skill specific information
[[skill1]]
setting = ""
cmd = "es_playsound server_var(wcs_userid) weapons\rpg\rocketfire1.wav 0.2"
sfx = ""
[[skill2]]
setting = ""
cmd = "es_playsound server_var(wcs_userid) weapons\airboat\airboat_gun_energy1.wav 0.2"
sfx = ""
[[skill3]]
setting = ""
cmd = "es_playsound server_var(wcs_userid) weapons\ambient\alarms\warningbell1.wav 1"
sfx = ""Okay, that's all today. Hope that this helps you guys.
More tutorials of this series are already coming, but keep telling us ideas on the forums own Request a Tutorial topic, which you can find HERE or in Tutorials section.
Thank you.






