_GOTOTRUE SND1
_COMPAREV gd0,1
_GOTOTRUE SND2
_COMPAREV gd0,2
_GOTOTRUE SND3
_COMPAREV gd0,3
_GOTOTRUE SND4
_COMPAREV gd0,4
_GOTOTRUE RESET
SND1 PLAYSOUNDV 1?
_GOTO END
SND2 PLAYSOUNDV 2?
_GOTO END
SND3 PLAYSOUNDV 3?
_GOTO END
SND4 PLAYSOUNDV 4?
_GOTO END
RESET SETV gd0,0
_GOTO END
END ADDV gd0,1
_QUIT
Does not work like I want it to. Yes, the underscores were replaced with spaces, and the numbers with a ? were replaced with the correct values. How it should work, is as follows:
Play SFX 60-63 when link swings his sword (either in order or randomly, doesn't matter). SFX 30 is just the "woosh" of the blade, 60-63 are 4 different yells. Scripts only make them overlap, hence why 30 is just the woosh.
What ends up happening is this:
1st swing, ONLY the woosh (sfx 30) is heard <---- not supposed to happen, sfx 30 with sfx 60 overlapped (both heard) is the desired behavior
2nd: 30 is heard with 61 overlapped <---- desired behavior
3rd: 30 + 62 <----- desired
4th: 30 + 63 <----- desired
Next swing: repeat.
CODE
import "std.zh"
item script SFX
{
void run()
{
int RandomNum = Floor(Rand(1) * 4);
if (RandomNum == 0.0)
{
Game->PlaySound(30);
}
else if (RandomNum == 1.0)
{
Game->PlaySound(60);
}
else if (RandomNum == 2.0)
{
Game->PlaySound(61);
}
else if (RandomNum == 3.0)
{
Game->PlaySound(62);
}
}
}
item script SFX
{
void run()
{
int RandomNum = Floor(Rand(1) * 4);
if (RandomNum == 0.0)
{
Game->PlaySound(30);
}
else if (RandomNum == 1.0)
{
Game->PlaySound(60);
}
else if (RandomNum == 2.0)
{
Game->PlaySound(61);
}
else if (RandomNum == 3.0)
{
Game->PlaySound(62);
}
}
}
This one also seems to be broken, as nothing happens when it is set up, or sometimes only 30 + 61 are heard.