--how close player needs to get to wall to start the jump local activate_range = 100 --how fast player will travel upwards local height_per_jump = 50 --how fast player will travel horizontally local distance_per_jump = 100 --height to keep jumping until (player moves slightly further horizontally on the last 25% of this value) local max_height = 300 -------- do not change below local state = "wait" local startheight = 0 local wall1 = 1 local wall2 = 1 local nearest_wall = wall1 function wall_jump_init(e) end function wall_jump_main(e) Hide(e) CollisionOff(e) if state == "wait" then SetPosition(e,g_PlayerPosX,g_PlayerPosY,g_PlayerPosZ) for a = 1,3999 do if g_Entity[a] ~= nil then if weapon_name[a] == "wall jump" then if GetPlayerDistance(a) <= activate_range then Prompt("wall jump?") if GetScancode() == 57 then startheight = g_PlayerPosY wall1 = a nearest_wall = wall1 state = "active" for b = 1,3999 do if g_Entity[b] ~= nil and b ~= a then if weapon_name[b] == "wall jump" then if GetPlayerDistance(b) <= distance_per_jump * 2 then wall2 = b RotateToEntity(e,wall1) break end end end end break end end end end end elseif state == "active" then if g_PlayerPosY < startheight + (max_height * 0.7) then if nearest_wall == wall1 then if GetPlayerFlatDistance(wall2) > 60 then RotateToEntity(e,wall2) else nearest_wall = wall2 end elseif nearest_wall == wall2 then if GetPlayerFlatDistance(wall1) > 60 then RotateToEntity(e,wall1) else nearest_wall = wall1 end end MoveForward(e,distance_per_jump) MoveUp(e,height_per_jump) TransportToIfUsed(e) elseif g_PlayerPosY < startheight + max_height then MoveForward(e,distance_per_jump*1.25) MoveUp(e,height_per_jump) TransportToIfUsed(e) else state = "wait" end end --state end --main function RotateToEntity(e,v) if g_Entity[e] ~= nil and g_Entity[e] ~= 0 and g_Entity[v] ~= nil and g_Entity[v] ~= 0 then local x = g_Entity[v]['x'] - g_Entity[e]['x'] local z = g_Entity[v]['z'] - g_Entity[e]['z'] local angle = math.atan2(x,z) angle = angle * (180.0 / math.pi) if angle < 0 then angle = 360 + angle elseif angle > 360 then angle = angle - 360 end SetRotation(e,0,angle,0) return angle end end function GetPlayerFlatDistance(e) tPlayerDX = (g_Entity[e]['x'] - g_PlayerPosX) tPlayerDZ = (g_Entity[e]['z'] - g_PlayerPosZ) return math.sqrt((tPlayerDX*tPlayerDX)+(tPlayerDZ*tPlayerDZ)); end