Walking sound effect
I was wondering, is there any way to set a certain sound effect for when Dink is moving, and would stop when Dink stands still?
Sure, you can. You could create a loop that checks Dink's X and Y and plays the sound when it changes, for example, or checks if Dink is going through one of his walking sequences. That would be quite a cool feature for a horror dmod, actually.
Crude example:
Crude example:
loop: int &crap = sp_pseq(1,-1) //^ not sure whether you should check sp_seq, or sp_pseq. Both probably work. &crap / 10 &crap * 10 //^ should remove the last digit, so that instead of 72 or something, the result we get will be 70 if (&crap == 70) &dinkysoundglobal = playsound(3,22050,0,1,0) if (&crap != 70) { //if the sound is currently playing, let's kill it abruptly if (&dinkysoundglobal != 0) { sp_active(&dinkysoundglobal,0) &dinkysoundglobal = 0 } } wait(100) goto loop
It works fine otherwise, but once I stop moving Dink will randomly disappear and the game freezes.
Removing sp_active(&dinkysoundglobal,0) appears to fix this, though.
Removing sp_active(&dinkysoundglobal,0) appears to fix this, though.
That's not good. Looking at the DinkC reference, the command to kill a sound is actually sound_set_kill(&dinkysoundglobal)... sp_active probably ends up killing something else each time (like Dink's sprite).