I need some help with this lua script

luigi budd

luigi butt
EDIT: I've fixed this script, so yeah. I fixed it!

Hi guys! I've made this lua script for my character to do 2 taunts, but I've troubleshooted it a multitude of times, and yet, it does not work. I've checked for any errors in the console, but there are none. Please tell me if I'm doing something wrong, because I'm new to lua scripting and have no idea what I'm doing.

Here's the script, and some ifs for some variables I've used.

Constant Variables:
//set our constants
addHook("PlayerThink", function(p)
    if isDash then
        isDash = 1
    else
        isDash = 0
    end
   
    if P_IsObjectOnGround(p.mo) then
        onGround = 1
    else
        onGround = 0
    end
   
    if p.mo.skin == "soapthehedge" then
        isSoap = 1
    else
        isSoap = 0
    end
   
    if p.mo.valid then
        isValid = 1
    else
        isValid = 0
    end
   
    if p.mo.state == "S_PLAY_STND" then
        isIdle = 1
    else
        isIdle = 0
    end
end)

The taunt scripts:
addHook("ThinkFrame", function()
    if isSoap then
        if onGround and (player.cmd.buttons & BT_CUSTOM1) and isIdle then
            if laughing == 0 and isValid
                laughing = 1
                player.mo.state = "S_PLAY_SOAP_LAUGH"
                S_StartSound(player.mo, sfx_hahaha)
            end
        end
       
        if laughing then
            player.pflags = $1|PF_FULLSTASIS
            if not player.mo.state == "S_PLAY_SOAP_LAUGH" then
                laughing = 0
            end
        end
    end
end)

addHook("ThinkFrame", function() --paste this again so we can FLEX!!
    for player in players.iterate do
        if isSoap then
            if onGround and isValid and (player.cmd.buttons & BT_CUSTOM2) and isIdle then
                if playerFlexing == false
                    player.mo.state = S_PLAY_SOAP_FLEX
                    playerFlexing = true
                    S_StartSound(player.mo, sfx_flex)
                end
            end

            if playerFlexing then
                player.pflags = $1|PF_FULLSTASIS
                if player.mo.state == S_PLAY_STND then --so you dont go full stasis when restarting level
                    playerFlexing = false
                end
            end
           
            if P_PlayerInPain(player) and playerFlexing then
                playerFlexing = false
                player.mo.state = S_PLAY_PAIN
            end
        end
    end
end)
 
Last edited:

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

Back
Top