Water Detection (LUA)

so basically you gotta
Lua:
addHook("PlayerThink", function(p)
    if (p.mo.skin == "yourskinnamehere") and (p.powers[pw_underwater])
        --underwater code here
    end
end)
 
Use MFE_UNDERWATER over p.powers[pw_underwater], since if you have a bubble or an elemental shield, since p.powers[pw_underwater] is how much air you have spent. Example, if the player spent 10 tics underwater, pw_underwater would be 10.
 

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

Back
Top