A couple of lua related questions

Status
Not open for further replies.

akb778

aka Sutekh94
1. I am currently making a character with a lot of custom states. One of those states deals with a custom flight animation with custom sound effect (sfx_pudpud), but, for some reason, the default flying sound (sfx_putput I think?) still plays; see this video for what I mean. How could I stop the default sound from playing?

2. Also, how would it be possible to go between custom states/sprites? I am trying to get her to switch from a custom standing state to a custom sitting state without much success.

Here's the relevant lua code:

Code:
states[S_PLAY_LSTN1] = {SPR_LSTN, 0, 4, nil, 0, 0, S_PLAY_LSTN2}
states[S_PLAY_LSTN2] = {SPR_LSTN, 1, 4, nil, 0, 0, S_PLAY_LSTN3}
states[S_PLAY_LSTN3] = {SPR_LSTN, 2, 4, nil, 0, 0, S_PLAY_LSTN4}
states[S_PLAY_LSTN4] = {SPR_LSTN, 3, 4, nil, 0, 0, S_PLAY_LSTN5}
states[S_PLAY_LSTN5] = {SPR_LSTN, 4, 4, nil, 0, 0, S_PLAY_LSTN6}
states[S_PLAY_LSTN6] = {SPR_LSTN, 5, 4, nil, 0, 0, S_PLAY_LSTN1}
states[S_PLAY_LSIT1] = {SPR_LSIT, 0, 4, nil, 0, 0, S_PLAY_LSIT2}
states[S_PLAY_LSIT2] = {SPR_LSIT, 1, 4, nil, 0, 0, S_PLAY_LSIT3}
states[S_PLAY_LSIT3] = {SPR_LSIT, 2, 4, nil, 0, 0, S_PLAY_LSIT4}
states[S_PLAY_LSIT4] = {SPR_LSIT, 3, 4, nil, 0, 0, S_PLAY_LSIT5}
states[S_PLAY_LSIT5] = {SPR_LSIT, 4, 4, nil, 0, 0, S_PLAY_LSIT6}
states[S_PLAY_LSIT6] = {SPR_LSIT, 5, 4, nil, 0, 0, S_PLAY_LSIT1}
states[S_PLAY_LFLY1] = {SPR_LFLY, 0, 4, nil, 0, 0, S_PLAY_LFLY2}
states[S_PLAY_LFLY2] = {SPR_LFLY, 1, 4, nil, 0, 0, S_PLAY_LFLY3}
states[S_PLAY_LFLY3] = {SPR_LFLY, 2, 4, nil, 0, 0, S_PLAY_LFLY4}
states[S_PLAY_LFLY4] = {SPR_LFLY, 3, 4, nil, 0, 0, S_PLAY_LFLY5}
states[S_PLAY_LFLY5] = {SPR_LFLY, 4, 4, nil, 0, 0, S_PLAY_LFLY6}
states[S_PLAY_LFLY6] = {SPR_LFLY, 5, 4, A_PlaySound, sfx_pudpud, 0, S_PLAY_LFLY1}

addHook("ThinkFrame", do
    for player in players.iterate
        if player.mo and player.mo.skin == "luna" 
        and not (player.pflags & PF_NIGHTSMODE) // Even though she is the princess of the night, she ain't the princess of NiGHTS...
            local standcounter = 0    
            if (player.mo.state == S_PLAY_STND) // for the animated standing frame
                player.mo.state = S_PLAY_LSTN1
                //for standcounter = 0, 6, 1 do
                //print(standcounter)
                if (player.mo.state == S_PLAY_LSTN1)
                    standcounter = standcounter + 1
                end
                if (player.mo.state == S_PLAY_LSTN6)
                    player.mo.state = S_PLAY_LSTN1
                end
                if (standcounter == 5)
                    player.panim = S_PLAY_LSIT1
                    standcounter = 0
                end
                //end
            end
            if ((player.mo.state >= S_PLAY_LSTN1) and (player.mo.state <= S_PLAY_LSTN6)) 
            or ((player.mo.state >= S_PLAY_LSIT1) and (player.mo.state <= S_PLAY_LSIT6))
                player.mo.panim = PA_ABILITY
                if P_GetPlayerControlDirection(player) == 1
                    player.mo.state = S_PLAY_RUN1
                end
            end
            if (player.mo.state == S_PLAY_ABL1)
                player.mo.state = S_PLAY_LFLY1
            end
            if ((player.mo.state >= S_PLAY_LFLY1) and (player.mo.state <= S_PLAY_LFLY6))
                player.panim = PA_ABILITY
            end
        end
    end
end)
In case you're wondering, the rest of the code is just freeslot declarations.
 
Status
Not open for further replies.

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

Back
Top