burning infernal god
Member
so i've been inspired to make a horizontal wall run lua but i have no experience so i asked copilot and only got this when i tried to add this to my mod i didn't work and i don't know why. HELP WANTED PLEASE
addHook("ThinkFrame", function()
for player in players.iterate do
if player.mo and player.mo.valid then
if player.cmd.buttons & BT_CUSTOM1 then
-- Check if the player is near a wall
local mo = player.mo
local angle = mo.angle
local x = mo.x + FixedMul(cos(angle), mo.radius + 1)
local y = mo.y + FixedMul(sin(angle), mo.radius + 1)
local z = mo.z
if P_CheckPosition(mo, x, y, z) == false then
-- Perform horizontal wall run
mo.momz = 0
mo.momx = FixedMul(cos(angle), mo.speed)
mo.momy = FixedMul(sin(angle), mo.speed)
end
end
end
end
end)
addHook("ThinkFrame", function()
for player in players.iterate do
if player.mo and player.mo.valid then
if player.cmd.buttons & BT_CUSTOM1 then
-- Check if the player is near a wall
local mo = player.mo
local angle = mo.angle
local x = mo.x + FixedMul(cos(angle), mo.radius + 1)
local y = mo.y + FixedMul(sin(angle), mo.radius + 1)
local z = mo.z
if P_CheckPosition(mo, x, y, z) == false then
-- Perform horizontal wall run
mo.momz = 0
mo.momx = FixedMul(cos(angle), mo.speed)
mo.momy = FixedMul(sin(angle), mo.speed)
end
end
end
end
end)