Jump to content

Photo

More script help


  • Please log in to reply
1 reply to this topic

#1 Majora

Majora

    Unironic Marxist-Leninist

  • Members

Posted 10 January 2008 - 05:49 PM

_COMPAREV gd0,0
_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);
        }
    }
}


This one also seems to be broken, as nothing happens when it is set up, or sometimes only 30 + 61 are heard.




#2 Joe123

Joe123

    Retired

  • Members

Posted 10 January 2008 - 06:31 PM

Here's a general tip:
Don't bother with ZASM, because noone else really codes in it, and you'll find it hard to get help.

And here's a script:
CODE
item script swordsfx{
    void run(int move){
        int sfx = Rand(4);
        Game->PlaySound(sfx+move);
        }
    }
}


At the moment, it plays one of 4 random sound effects.
Change the number 4 if you want more or less.

D0 on the item is what you want the first of the 4 sfx to be, and the other 3 follow after that one.
However, they all have to be next to each other, so no more 32.
Sorry.


1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users