• Do not use Works in Progress as a way of avoiding the releases system! Works in Progress can be used for sharing early betas and for getting suggestions for improvement. Releases of finished content are not allowed in this forum! If you would like to submit a finished addon, click here for instructions on how to do so.

Walking/Running Sounds

Status
Not open for further replies.
Title says it all, How do you make stepping sounds, (Multiple sounds) And similar to Tails from Sonic R Making step sounds when running: Flying sounds? Can somebody help me?
 
First you should check if the player is walking or running (using their stats.), then make a sound play at a regular interval (else it'll play every tic and hello earrape.)

I don't have time to write something (it'll be shitty anyway.), but you can help yourself with this: https://wiki.srb2.org/wiki/Lua/Userdata_structures
 
SRB2 Christmas v0.96 actually had this. Modify the player WALK states to where the frame where his foot is on the ground calls A_PlaySound.
 
Unfortunately, I am away from my personal computer, but I can post my current lua code on stepping that I am currently using for my mini Sonic-R mod later on today. Like with "Lat" sugessted, it uses the player's states to determine when/which stepping sound (left/right) it uses. It also has a similar system for underwater noises with one sound effect.
 
Last edited:
You could try something like this for the stepping sounds:

Code:
freeslot("sfx_runl")    //Run left
S_sfx[sfx_runl] = {false, 64, SF_NOMULTIPLESOUND|SF_OUTSIDESOUND}
freeslot("sfx_runr")    //Run right
S_sfx[sfx_runr] = {false, 64, SF_NOMULTIPLESOUND|SF_OUTSIDESOUND}
freeslot("sfx_runuw")    //Run underwater
S_sfx[sfx_runr] = {false, 64, SF_NOINTERRUPT|SF_OUTSIDESOUND}

addHook("ThinkFrame", do

    for player in players.iterate do

        if (player.mo)
        
            if (player.mo.eflags & MFE_UNDERWATER)
            
                if (player.mo.state==S_PLAY_RUN1) or (player.mo.state==S_PLAY_RUN8)
                    S_StartSound(player.mo, sfx_runuw)
                end
            
            else
        
                 if (player.mo.state==S_PLAY_RUN1) or  (player.mo.state==S_PLAY_RUN3) or (player.mo.state==S_PLAY_RUN5) or  (player.mo.state==S_PLAY_RUN7) or (player.mo.state==S_PLAY_SPD1) or  (player.mo.state==S_PLAY_SPD3)
                    if not (player.mo.eflags & MFE_GOOWATER)
                        if not (player.mo.eflags & MFE_TOUCHWATER)
                            S_StartSound(player.mo, sfx_runl)
                        end
                    end
                end

                 if (player.mo.state==S_PLAY_RUN2) or  (player.mo.state==S_PLAY_RUN4) or (player.mo.state==S_PLAY_RUN6) or  (player.mo.state==S_PLAY_RUN8) or (player.mo.state==S_PLAY_SPD2) or  (player.mo.state==S_PLAY_SPD4)
                    if not (player.mo.eflags & MFE_GOOWATER)
                        if not (player.mo.eflags & MFE_TOUCHWATER)
                            S_StartSound(player.mo, sfx_runr)
                        end
                    end
                end
            
            end

        end
    end    
end)

I haven't added code to prevent the sounds from playing while airwalking, and the code could be optimized, but this is the general idea.
 
Bonus points if you have it play different sounds based on what terrain the relevant foot is stepping on at the time.

Granted, it'd require some sort of giant lookup array to tie each flat to a type of terrain ("GFZGRASS" being "Grass", for instance), but nevertheless...
 
...I... think that much would be impossible because of how SRB2 works. At least, the "1 foot touching the sector" thing is. Either you're ALL in the grass sector or you're ALL in the metal sector, no inbetween, for example. Regardless what's the point in running and walking sounds? They'd be annoying and obnoxious like they are in Sonic R. Outright unncessary if you ask me. o3o;
 
No, It's not impossible at all, you'd just have to make it so that when it hits the frames where a foot is on the ground, (and a check to make sure you are on the ground.) it plays a sound. I think that may have even been possible with SOCs, but don't quote me on that.
 
It would be possible to change the action found in the player states so that the frame where the player steps on the ground would make some sort of stepping noise, but that's as far as you could go with SOC. You'd be hardpressed to try to make it a different noise on different textures, let alone trying to check to see if the player was even on the ground when they changed to that frame.

Definitely try coding it with Lua if at all possible.
 
Status
Not open for further replies.

Who is viewing this thread (Total: 1, Members: 0, Guests: 1)

Back
Top