--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 next_wall = wall1 local pressed = 0 function wall_jump2_init(e) end function wall_jump2_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 and pressed == 0 then pressed = 1 startheight = g_PlayerPosY wall1 = a for b = 1,3999 do if g_Entity[b] ~= nil and b ~= a then if weapon_name[b] == "wall jump" then if GetPlayerFlatDistance(b) <= distance_per_jump * 2 then wall2 = b next_wall = wall2 RotateToEntity(e,wall2) state = "active" break end end end end break end end end end end elseif state == "active" then if g_PlayerPosY > startheight + max_height * 0.75 then MoveForward(e,distance_per_jump) MoveUp(e,height_per_jump) TransportToIfUsed(e) if g_PlayerPosY > startheight + max_height then state = "wait" end else if next_wall == wall2 then if GetPlayerFlatDistance(wall2) > 30 then if GetPlayerFlatDistance(wall2) < 100 then Prompt("wall jump?") if GetScancode() == 57 and pressed == 0 then pressed = 1 RotateToEntity(e,wall1) MoveForward(e,distance_per_jump) MoveUp(e,height_per_jump) TransportToIfUsed(e) next_wall = wall1 end end MoveForward(e,distance_per_jump) MoveUp(e,height_per_jump) TransportToIfUsed(e) else state = "wait" end elseif next_wall == wall1 then if GetPlayerFlatDistance(wall1) > 30 then if GetPlayerFlatDistance(wall1) < 100 then Prompt("wall jump?") if GetScancode() == 57 and pressed == 0 then pressed = 1 RotateToEntity(e,wall2) MoveForward(e,distance_per_jump) MoveUp(e,height_per_jump) TransportToIfUsed(e) next_wall = wall2 end end MoveForward(e,distance_per_jump) MoveUp(e,height_per_jump) TransportToIfUsed(e) else state = "wait" end end end --[[ 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 if pressed == 1 and GetScancode() ~= 57 then pressed = 0 end 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