I do not know if you already seen it, so I post it again. Maybe it helps you:
-- PE: Simple system to get us up, when below water, this is where the real swimming below water should be made.
-- allow swimming with head above water.
if ( GetCameraPositionY(0) <= GetGamePlayerStateWaterlineY()+8.0 ) then
x_temp = 0
z_temp = 0
camera_direction = 1
Prompt("X: " .. g_PlayerAngX .. " Y: " .. g_PlayerAngY .. " Z: " .. g_PlayerAngZ)
-- check for space to move player slowly up when underwater.
if g_PlayerUnderwaterMode == 1 then
x_temp = math.sin(math.rad(g_PlayerAngY))
z_temp = math.cos(math.rad(g_PlayerAngY))
if g_PlrKeyW == 1 and g_PlrKeyS == 0 then
if g_PlrKeyA == 1 and g_PlrKeyD == 0 then
elseif g_PlrKeyA == 0 and g_PlrKeyD == 1 then
end
elseif g_PlrKeyW == 0 and g_PlrKeyS == 1 then
x_temp = x_temp*-1
z_temp = z_temp*-1
if g_PlrKeyA == 1 and g_PlrKeyD == 0 then
elseif g_PlrKeyA == 0 and g_PlrKeyD == 1 then
end
end
if (g_PlrKeySPACE == 1 or g_PlayerAngX>270) then
camera_direction = 1*(g_PlayerAngX/100)
elseif g_PlayerUnderwaterMode == 1 and g_PlayerAngX<90 and GetTerrainHeight(g_PlayerPosX,g_PlayerPosZ)+20 < g_PlayerPosY then
camera_direction = -1*(g_PlayerAngX/100)
end
if( GetCameraPositionY(0) >= GetGamePlayerStateWaterlineY()+7.0 ) then
SetFreezePosition(GetPlrObjectPositionX()+x_temp,GetPlrObjectPositionY()+(0.01*camera_direction),GetPlrObjectPositionZ()+z_temp) -- slow down
elseif( GetCameraPositionY(0) >= GetGamePlayerStateWaterlineY()+6.0 ) then
SetFreezePosition(GetPlrObjectPositionX()+x_temp,GetPlrObjectPositionY()+(0.075*camera_direction),GetPlrObjectPositionZ()+z_temp) -- slow down
else
SetFreezePosition(GetPlrObjectPositionX()+x_temp,GetPlrObjectPositionY()+(0.25*camera_direction),GetPlrObjectPositionZ()+z_temp) -- full speed up
end
SetFreezeAngle(GetCameraAngleX(0),GetCameraAngleY(0),GetCameraAngleZ(0))
TransportToFreezePosition()
end
end
It is very basic, but maybe you can use it or find a concept which you can include
Thanks for your work
Ebe Editor Free - Build your own EBE structures with easy and without editing any text files
Thread and Download