AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Plugins (https://forums.alliedmods.net/forumdisplay.php?f=108)
-   -   [TF2] Soundscape Fixer (v1.3.0 - 06/01/2014) (https://forums.alliedmods.net/showthread.php?t=252867)

jlyne1234 12-10-2014 15:44

[TF2] Soundscape Fixer (v1.3.0 - 06/01/2014)
 
5 Attachment(s)
[TF2] Soundscape Fixer (1.3.0 06/01/2015)

I got bored of waiting and made this recently. It seems to be working well on the server I admin so I am releasing it to everyone.

Description

A plugin to get most soundscapes working while valve sort out the ongoing issues.
It plays the appropriate soundscape to players based on their position, taking into account the radius and visibility of nearby soundscapes.

Features
  • Bring the life back to custom maps! :)
  • Full support for playlooping/playrandom env_soundscape, env_soundscape_proxy and env_soundscape_triggerable entities
  • Respects volume and pitch values defined in the map's script file
  • /scvolume and /scpitch commands for changing the volume and pitch of soundscapes
  • One line per map configuration*
    • *90% of the time - see unsupported things
  • Small API for more complex maps that dynamically enable/disable soundscapes (e.g clocktown)
Unsupported things
  • playsoundscape sounds are ignored
  • dsp, soundlevel are ignored
  • Positional soundscapes will play from the player
  • No crossfading between soundscapes
  • Dynamic enabling/disabling of soundscapes is not detected. Custom code is needed to hook the entities that are enabling/disabling soundscapes on a per map basis.
Installation
  1. Copy soundscapes.smx to plugins
  2. Copy soundscapes-clocktown.smx to plugins if you have clocktown on your map rotation
  3. Copy soundscapes_config.txt to configs and update for your map rotation (see below)
  4. Copy soundscapes.inc to scripting/includes if you want to make a plugin that uses the natives
  5. Load a new map
  6. Enjoy the music :)

Configuration

In order to work, soundscape fixer just needs to know where each maps soundscape script lives. It will default to scripts/soundscapes_[map name].txt if no script is specified, which should work for most maps.
If this does not work, you can find the name of the file by opening the .bsp file with Pakrat and checking the scripts folder, or by asking the map creator.

The config file is expected to be located at "configs/soundscapes_config.txt" and take the following form:

Code:

"Soundscapes"
{
  "map name" "script location"
  "map name2" "script location2"
... etc
}

An example file is attached which contains the locations of the scripts of several maps.

Tested Maps
The plugin should work fully in the following maps:
  • trade_clocktown_b2a
  • trade_hyrule_oot3d_alpha_6
  • trade_franticfactory_v3p
  • rusty_bucket_bay
  • dm_mariokart3_v1
  • dm_mariokart2_b3
  • trade_windfallisland_final
Commands
sm_volume - changes volume of soundscapes that are played (0 - 1)
sm_scvolume - alias of sm_volume

sm_scpitch - changes pitch of soundscapes that are played (1 - 255. 100 is "normal" pitch. 0 resets pitch to script specified values)


API
As far as i am aware there are no outputs for when soundscapes are enabled or disabled, meaning there is nothing for this plugin to hook to determine whether a soundscape should be played.

To work around this, the plugin i
ncludes a few natives that allow soundscapes to be enabled and disabled using their name or entity id. This can fix maps with dynamic soundscapes by hooking the outputs of entities that are enabling/disabling soundscapes and calling the appropriate native to tell the plugin about the soundscapes new state.

Their documentation can be found in the inc file.

For enabling/disabling soundscapes on map load, there is also a OnSoundscapesLoaded() forward, which is called after the maps soundscapes have been found.

An example plugin that fixes the dynamic day soundscapes in clocktown (trade_clocktown_b2a) is attached.

Problems?
Feel free to ask if you have any problems. This is my first released plugin, and I would like to support it for as long soundscapes are broken.

Changelog

v 1.3.0 - 06/01/2014
  • Added clientpreferences support for /scpitch and /scvolume
  • Changed raytrace to filter out prop_dynamic entities
    • Fixes soundscapes being blocked in certain situations, such as in the clocktown clocktower if you spawn behind the pole in the center of the room.

v 1.2.4 - 26/12/2014
  • Changed /scpitch to accept values between 1-255 (same as the "pitch" keyvalue).
    • All soundscapes will play with the specified pitch, ignoring any script specified values
    • 100 is "normal" pitch
    • /scpitch 0 will reset the pitch to the script specified value
  • Fixed incorrect soundscapes playing when reloading the plugin without a map change
    • Clocktown will still need a reload due to the dynamic nature of the day soundscapes, and it being difficult to work out what "day" it is when a plugin is late loaded.

v 1.2.3 - 24/12/2014
  • Feature request: Added /scpitch command to control pitch of played soundscape. Didn't use /pitch to avoid possible collisions.
  • Added /scvolume command to be consistent with /scpitch


v 1.2.2 - 14/12/2014
  • Removed /closest debug command

v 1.2.1 - 14/12/2014

  • Plugin now attempts to load scripts/soundscapes_[map name].txt by default if no script is specified in the config
  • Fixed error spam when a client disconnects while within range of a playrandom soundscape
  • Fixed soundscapes not updating when spectating another player
  • Changed raytrace to not collide with other players
    • Should fix soundscapes not updating when entering crowded areas
  • Changed sounds to play on SNDCHAN_STATIC from SNDCHAN_AUTO
    • Hopefully this will fix sounds overlapping for some people. I've been unable to reproduce this myself so not sure.

v 1.2.0 - 12/12/2014

  • Added support for playrandom sounds
  • Added support for multiple sounds per soundscape
  • Fixed soundscapes not playing before the first round starts after a map change
  • Fixed some situations where soundscape entities were not disabled and continued playing
  • Updated the clocktown plugin to wait for the daystart sound to finish before playing day soundscapes
v 1.1.5 - 10/12/2014

  • Initial forum release
  • Added /volume command
  • Replaced hardcoded soundscapes with script file parsing
  • Added support for playlooping sounds with volume and pitch
v 1.0 - 8/12/2014
  • Initial release

Sreaper 12-10-2014 16:34

Re: [TF2] Soundscape Fixer
 
Good job on writing this plugin.

Powerlord 12-10-2014 16:59

Re: [TF2] Soundscape Fixer
 
Any particular reason playrandom doesn't work?

jlyne1234 12-10-2014 17:09

Re: [TF2] Soundscape Fixer
 
Nah theres nothing stopping me from adding it as far as i can tell.
I just originally made this as a quick fix and therefore didnt add anything "fancy" like that.
I'll have a go at implementing them when I get time, most likely tomorrow.

hannes96 12-11-2014 09:29

Re: [TF2] Soundscape Fixer
 
Thank you so much for this! The sm_volume command is quite helpful. Is it possible to have a plugin that can manage volume settings of map music after valve fixed the soundscape problems? (if they ever fix it)

Bjorngomes 12-11-2014 14:16

Re: [TF2] Soundscape Fixer
 
Just did some recently test dm_ScarletDevilMansion_XMAS Tested and Seems to work fine now.

Not sure if im testing the other ones too.

Phaiz 12-12-2014 09:04

Re: [TF2] Soundscape Fixer
 
I'll have to try this out. Soundscapes refuse to work on my custom map regardless of what i do.

jlyne1234 12-12-2014 17:12

Re: [TF2] Soundscape Fixer (v1.2.0 - 12/12/2014)
 
Version 1.2.0 has been released

Changes:
  • Added support for playrandom sounds
  • Added support for multiple sounds per soundscape
  • Fixed soundscapes not playing before the first round starts after a map change
  • Fixed some situations where soundscape entities were not disabled and continued playing
  • Updated the clocktown plugin to wait for the daystart sound to finish before playing day soundscapes

jlyne1234 12-12-2014 17:15

Re: [TF2] Soundscape Fixer
 
Quote:

Originally Posted by hannes96 (Post 2233894)
Thank you so much for this! The sm_volume command is quite helpful. Is it possible to have a plugin that can manage volume settings of map music after valve fixed the soundscape problems? (if they ever fix it)

I'll have a look into that.
What I do know is that sounds that begin with a '#' in soundscape scripts can be controlled by the music volume slider, as is the case with hyrule.

Phaiz 12-12-2014 18:12

Re: [TF2] Soundscape Fixer (v1.2.0 - 12/12/2014)
 
Well out of the gate it didn't work. I added a line to the cfg for my map as per your example, then I tried using pakrat. I've never used this but after scanning it says the soundscape txt file isn't found. Can you explain how to find it with pakrat?


All times are GMT -4. The time now is 04:49.

Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.