.qc (dot qc) - the group for quake c coders of all denominations. If you make quake one mods and write code in quake c, join our group! I'll try to answer any quake c questions - please post your inquiry in the forums...
Posts | ||
---|---|---|
Sounds on a map? | Locked | |
Thread Options | ||
|
Oct 30 2011 Anchor | |
>Hello,can you tell me how i can make a sound on the map in worldcraft? (trigger) There are 3 basic ways to play sounds on maps: 1. Maps "sounds" number - put in worldspawn, attempts to play a cd track for a map. 2. Ambient sound - either the fire crackle from flames, sky woosh, water flow, or one of the ambient_* sounds. 3. A sound generated by quake-c code. You'll note none of these are triggered. Vanilla quake does not have trigger sounds. You cant play a looped sound unless its one of the ambient_* sounds. To play a specific sound, either by trigger or otherwise you will have to use custom code. The hipnotic code base does this: play_sound You could add this to any mod, the quake-c follows at the end of this text. In the map editor: 1. update entities definition (by getting a file for your editor with hipnotic support or - ) with: /*QUAKED play_sound_triggered (0.3 0.1 0.6) (-8 -8 -8) (8 8 8 ) toggle toggle determines whether "volume" how loud "noise" sound to play "impulse" channel on which "speed" attenuation factor /*QUAKED play_sound (0.3 0.1 0.6) (-8 -8 -8) (8 8 8 ) "volume" how loud "noise" sound to play "wait" random time between sounds "delay" minimum delay between sounds "impulse" channel on which to play sound "speed" attenuation factor 2. Follow the instructions above and add your "play_sound_triggered". The fields specified need filled out correctly. At a minimum you need: Now, add a "trigger" entity. This can be touch or shootable or whatever. The minimum is: A map brush made into a trigger (trigger texture recommended even though its never seen - just for editing purposes) the Your map editor 3D view might look something like this: The player walks along the stone texture brush and hits the (non-visible) trigger. The sound plays from the purple box the trigger targets. The box location is *where* the sound originates when played. After you build and compile the map and put it in quake/id1/maps, you could: get progs.dat from the hipnotic quake-c code package - Moddb.com Run it: or if you like painkeep, 2.2 supports play_sound - main: Moddb.com - 2.2 update: Moddb.com - install the main pack and the update. Run it: Now test your sound trigger. The reason I include painkeep is that it is a (free) and complete package, even though the install is bigger. Everything will (should at least) work. With the hipnotic quake-c there are many functions that require hipnotic models, sounds and support. Since you are just using play_sound this should not have an impact. This quake-c could be added to any mod - (you should give credit to hipnotic if you do this.) /* Miscelanneous QuickC program void() play_sound_use = void() PlaySoundThink = /*QUAKED play_sound_triggered (0.3 0.1 0.6) (-8 -8 -8) (8 8 8 ) toggle /*QUAKED play_sound (0.3 0.1 0.6) (-8 -8 -8) (8 8 8 ) play_sound_triggered(); ------------ Note about where quake keeps / looks for sounds and sample map ents. Quake expects to find the sound in "quake/id1/sound/" or "quake/mymod/sound" - so the sample wav file is in "quake/id1/sound/items/protect.wav". Sample ents from radiant: // entity 25 When the player ent is standing in the trigger brush, "quake/id1/sound/items/protect.wav" is played every 3 seconds. ------------ There was another problem with the sound looping even when the trigger's "wait" "3" was changed to "wait" "-1". I suspect the unwanted looping issue has something to do with the data in the wav file and what the engine code sees. -- \|/ |
Only registered members can share their thoughts. So come on! Join the community today (totally free - or sign in with your social account on the right) and join in the conversation.