D12 Posted December 5, 2020 (edited) I wanna make a low pass filter effect on my Map, whenever I'm closer to an area the music gets louder and more closer. And vice versa if I move away from it. Is there a script that can make this work? Thx for your time and reply. Edit: My Game Data is UDMF and my wad is ran with GzDoom. Edited December 5, 2020 by D12 0 Share this post Link to post
Mordeth Posted December 5, 2020 Assuming you use GZDoom, you may want to look at this dynamic music project. 2 Share this post Link to post
D12 Posted December 5, 2020 (edited) 33 minutes ago, Mordeth said: Assuming you use GZDoom, you may want to look at this dynamic music project. Yes I uze Gzdoom, Gzdoombuilder as well. Thx for your help. Edit: But does it work for low pass filter effects? 0 Share this post Link to post
Simomarchi Posted December 5, 2020 (edited) If you are using GZDoom and your map is in UDMF map format you can actually use an ACS script to obtain the effect that you desire First of all you need to place a MapSpot (you can find it in the ZDoom folder of the thing panel) in the center of the area that will control your music volume. Then assign a TID to that MapSpot. In this example we will assume that the TID is 1. After that you have to open your script editor and write the following code: Spoiler #include "zcommon.acs" Script 1 ENTER { SetMusicVolume (0.0); while (TRUE) { Int xa = GetActorX (0); Int ya = GetActorY (0); Int xb = GetActorX (1); Int yb = GetActorY (1); Int x = xa*xa + xb*xb -2*xa*xb; Int y = ya*ya + yb*yb - 2*ya*yb; Int distance = sqrt (x + y); If (distance <= 1000) SetMusicVolume (1.1 - (distance/1000)); delay (1); } } NOTES: The first 7 rows inside the while at here only to calculate the distance between you and the MapSpot. I'm quite sure that there is a better way to calculate it, so if if you know it just replace them with it. The variables xb, yb refer to the MapSpot, that probably is a stationary point. I've used the proper command only to create the most general script possible. You can easily replace them with the actual coordinates of your MapSpot to make every other calculation easier. So for example: int xb = 10; int yb = 24; This script assumes that there is no music at the start of the level, and the music will start to become louder only if you get at least 1000 map units from the MapSpot. You can change this last number in the "if" and in the last SetMusicVolume. The code in this spoiler has not been tested and I have the strong suspect that it will not work properly. But at least it is an idea. Edited December 5, 2020 by Simomarchi 0 Share this post Link to post
D12 Posted December 5, 2020 11 minutes ago, Simomarchi said: If you are using GZDoom and your map is in UDMF map format you can actually use an ACS script to obtain the effect that you desire First of all you need to place a MapSpot (you can find it in the ZDoom folder of the thing panel) in the center of the area that will control your music volume. Then assign a TID to that MapSpot. In this example we will assume that the TID is 1. After that you have to open your script editor and write the following code: Hide contents #include "zcommon.acs" Script 1 ENTER { SetMusicVolume (0.0); while (TRUE) { Int xa = GetActorX (0); Int ya = GetActorY (0); Int xb = GetActorX (1); Int yb = GetActorY (1); Int x = xa*xa + xb*xb -2*xa*xb; Int y = ya*ya + yb*yb - 2*ya*yb; Int distance = sqrt (x + y); If (distance <= 1000) SetMusicVolume (1.1 - (distance/1000)); delay (1); } } NOTES: The first 7 rows inside the while at here only to calculate the distance between you and the MapSpot. I'm quite sure that there is a better way to calculate it, so if if you know it just replace them with it. The variables xb, yb refer to the MapSpot, that probably is a stationary point. I've used the proper command only to create the most general script possible. You can easily replace them with the actual coordinates of your MapSpot to make every other calculation easier. So for example: int xb = 10; int yb = 24; This script assumes that there is no music at the start of the level, and the music will start to become louder only if you get at least 1000 map units from the MapSpot. You can change this last number in the "if" and in the last SetMusicVolume. The code in this spoiler has not been tested and I have the strong suspect that it will not work properly. But at least it is an idea. I really appreciatte your time for this, thank you. I will try this out later! since I have no rush :) 0 Share this post Link to post