So, this morning I created this actor that's supposed to be sort of a view-screen that flickers between different "screens" (i.e actions) and plays/stops certain sounds accordingly. The actor pretty much works without a hitch, but now every time I try to exit the game, if I've got this thing in the current map, eDuke crashes. I'm imagining it's probably my shoddy codework, so I'm posting it here in the hopes of getting some clarification. Of course, sound effects and gamevars are all declared in another con file...
eventloadactor HYPNOSCREEN
getactor[THISACTOR].hitag hitagsaved
setactor[THISACTOR].hitag 0
enda
// ^^ Eventloadactor code for the screen. Just grabs the actor's hitag value.
action HS_STANDBY 0 0 1 1 56
action HS_STATIC 1 5 1 1 10
action HS_PRESENT 6 0 1 1 56
action HS_LSD 7 0 1 1 56
// ^^ These are the different "screens" that the actor flickers to. Each screen changes out after an intermittent bout of static (the second action listed), and it all loops around to the STANDBY screen.
useractor notenemy HYPNOSCREEN 0 HS_STANDBY
getactorvar[THISACTOR].hitagsaved temp1
ifvarn temp1 0 { // if the actor's hitag is a nonzero value...
ifaction HS_STANDBY { // if it's on the STANDBY screen.
stopsound WHITENOISE //stop the WHITENOISE sound
soundonce AMBIENCE7 // and start this AMBIENCE sound
ifactioncount 10 {
action HS_STATIC addvar temp2 1 break } // when its actioncount hits 10, start the STATIC action, and add 1 to variable "temp2"
}
else
ifaction HS_PRESENT {
stopsound WHITENOISE
ifactioncount 10 {
action HS_STATIC addvar temp2 1 break }
}
else
ifaction HS_LSD {
stopsound WHITENOISE
ifactioncount 10 {
action HS_STATIC addvar temp2 1 break }
}
// ^^ The other actions pretty much do the same thing, apart from playing the AMBIENCE7 sound
else
ifaction HS_STATIC { // if the STATIC action is playing...
stopsound AMBIENCE7
soundonce WHITENOISE // stop the AMBIENCE7 sound, and start the WHITENOISE sound.
ifactioncount 40 { // when the actioncount hits 40...
ifvare temp2 1 { action HS_PRESENT break } // if the temp2 variable is only at 1, start the HS_PRESENT action.
else
ifvare temp2 2 { action HS_LSD break } // if it's at 2, start the LSD action.
else
ifvare temp2 3 { action HS_STANDBY setvar temp2 0 break } // if it's at 3, take it back to the STANDBY action, and reset the temp2 variable to zero, so it can all start over again.
}
}
}
enda
Again, this actor works just fine. There's no warnings, no errors, no bugs when it's doing its thing in-game. The game only crashes when I attempt to exit, and since that happens, eDuke can't spit out a log over it either. I've narrowed the problem with this actor down to the sound commands being used. When I first wrote the code, I was only using the WHITENOISE sound (no AMBIENCE7) and I was using the stopactorsound to stop it, for obvious reasons. When I noticed the crash, I changed it to just stopsound, and the crashes became less frequent. But then I added the AMBIENCE7 sound, and it's gone right back to crashing nearly every time I try to exit. Is it how I've set up the code, or am I just using the commands in a way they're not intended to be used?