Animated Morrowind bard does not play music
Animated Morrowind 1.0 download link: http://mw.modhistory.com/download-55-6351
Animated bard (Der Juvas in "Mournhold, the Winged Guar") does not plays a music.
A console output shows:
Playing music/am\am_music2.mp3 Playing music/explore/mx_explore_1.mp3
i.e. the bard music starts, but immediately replaced by explore music. I think there is a problem with StartScript - we should only register a script, but not run it until a next frame starts.
A problematic part of AM_Bard2_script:
if GetDisabled == 0 if Reposition == 0 if ( PLayonce == 0 ) startScript AM_StopMusic_Script ; <- the problem is here set Rand to random 10 if Rand < 5 StreamMusic,"AM\AM_music2.mp3" set playonce to 2 set timer to 0 else StreamMusic,"AM\AM_music3.mp3" set playonce to 3 set timer to 0 endif endif endif endif
AM_StopMusic_Script:
begin AM_StopMusic_Script short Rand if cellchanged == 1 set Rand to random 7 if Rand == 0 StreamMusic "Explore\MX_explore_1.mp3" elseif Rand == 1 StreamMusic "Explore\MX_explore_2.mp3" elseif Rand == 2 StreamMusic "Explore\MX_explore_3.mp3" elseif Rand == 3 StreamMusic "Explore\MX_explore_4.mp3" elseif Rand == 4 StreamMusic "Explore\MX_explore_5.mp3" elseif Rand == 5 StreamMusic "Explore\MX_explore_6.mp3" elseif Rand == 6 StreamMusic "Explore\MX_explore_7.mp3" endif stopScript AM_StopMusic_Script endif end
Morrowind behaviour:
PC enters a cell (cellchanged sets to 1)
AM_Bard2_script starts a music and starts AM_StopMusic_Script (but this script is not executed on current frame)
Next frame starts (cellchanged sets to 0)
AM_StopMusic_Script runs, but doing nothing (because cellchanged = 0)
PC leaves the cell (cellchanged sets to 1)
AM_StopMusic_Script correctly stops the music and stops itself
OpenMW behaviour:
PC enters a cell (cellchanged sets to 1)
AM_Bard2_script starts a music and starts AM_StopMusic_Script
AM_StopMusic_Script runs in current frame and stops a music and stops itself (because cellchanged = 1)
(RM-3823 from redmine: created on 2017-04-10 by Andrei Kortunov, , closed on 2018-05-23 by nobody)