Dynamic Music 2.0
Forum rules
Before asking on how to use a ZDoom feature, read the ZDoom wiki first. This forum is archived - please use this set of forums to ask new questions.
Before asking on how to use a ZDoom feature, read the ZDoom wiki first. This forum is archived - please use this set of forums to ask new questions.
Dynamic Music 2.0
I posted about this a year or two ago and never came to a proper solution, but recently Eradrop shared a cool new project, Hide and Seek, which actually uses a form of dynamic music.
The way his works: the script triggers several events in order, starting with switching the music from "Relax" to "Fight" using SetMusic, then after a delay of 3000 tics the music changes back to the standard theme on its own. This is almost like how it's done in IM Meen for DOS, where the battle theme is triggered and plays for a limited time before changing back.
The thing I have in mind is tougher: once the script activates, it keeps checking until the tagged ambush monsters are dead. If they are, it changes the music back, else it keeps looping. I'm not experienced with ACS scripting apart from a few things I learned with conversation trees here on the forum, so I don't know how to translate the idea into a script. If someone can walk me through that, I'm more than capable of tweaking and testing 'til I get something that works well enough for others in the community to use at their leisure.
I'm also wondering if there's a way to have it check to see if the script is already executed, so if the battle music is already playing, it ignores any additional activation attempts.
The way his works: the script triggers several events in order, starting with switching the music from "Relax" to "Fight" using SetMusic, then after a delay of 3000 tics the music changes back to the standard theme on its own. This is almost like how it's done in IM Meen for DOS, where the battle theme is triggered and plays for a limited time before changing back.
The thing I have in mind is tougher: once the script activates, it keeps checking until the tagged ambush monsters are dead. If they are, it changes the music back, else it keeps looping. I'm not experienced with ACS scripting apart from a few things I learned with conversation trees here on the forum, so I don't know how to translate the idea into a script. If someone can walk me through that, I'm more than capable of tweaking and testing 'til I get something that works well enough for others in the community to use at their leisure.
I'm also wondering if there's a way to have it check to see if the script is already executed, so if the battle music is already playing, it ignores any additional activation attempts.
Re: Dynamic Music 2.0
This is why I'm always asking for help. I dunno why this script doesn't work. It keeps highlighting the "else" case but doesn't tell me why.
Code: Select all
Script 1 Enter // => Starting Script.
{
SetMusic("SniperC", 0, 0);
}
Script 2 (void) // => First sniper fight.
{
Thing_Activate(100);
SetMusic("SniperF", 0, 0);
While(ThingCount(0, 100) > 0)
{
Delay(1);
}
else
{
SetMusic("SniperC", 0, 0)
terminate;
}
}
Re: Dynamic Music 2.0
There is no "if" for the "else". Simply take the SetMusic() out of the else {} and don't even bother with the terminate - you don't need it.
Re: Dynamic Music 2.0
Ahh, okay so it basically keeps checking on its own, and continues once the "while" parameter is met.Rachael wrote:There is no "if" for the "else". Simply take the SetMusic() out of the else {} and don't even bother with the terminate - you don't need it.
Except now it's flagging the stuff at the beginning o the script, before the "while" state. Didn't i type all that correctly?
Re: Dynamic Music 2.0
Code: Select all
Script 1 Enter // => Starting Script.
{
SetMusic("SniperC", 0, 0);
}
Script 2 (void) // => First sniper fight.
{
Thing_Activate(100);
SetMusic("SniperF", 0, 0);
while(ThingCount(0, 100) > 0)
{
Delay(1);
}
SetMusic("SniperC", 0, 0)
}
Re: Dynamic Music 2.0
You might be right, cos else and if are always lower-cased. Weird. I'll give that a try.Rachael wrote:Something like this, I think. ("while" may be case sensitive, I can't remember if that's the case for ACS)
EDIT: Nope, it's still pissed at the stuff before the while case.
Last edited by ImpieTwo on Sun Aug 06, 2017 9:32 pm, edited 1 time in total.
Re: Dynamic Music 2.0
I don't know, then. >_<
- Ed the Bat
- Posts: 3060
- Joined: Thu May 03, 2012 1:18 pm
- Graphics Processor: nVidia with Vulkan support
- Location: Maryland, US
- Contact:
Re: Dynamic Music 2.0
It is recommended that you not give SetMusic a third parameter. In fact, since your second paramter is 0, that's redundant to begin with.
Re: Dynamic Music 2.0
Figured it out finally. I forgot the damn "include" for common acs commands. Now it's working.
Re: Dynamic Music 2.0
Also this
can be reduced to
Just a cosmetic thing but it helps me with visualization of a script. Note you can only do this with single actions inside a block. Two or more actions require the block.
Code: Select all
while(ThingCount(0, 100) > 0)
{
Delay(1);
}
Code: Select all
while(ThingCount(0, 100) > 0) Delay(1);