For a start in swimming, you can take my first tries in gameplayercontroller.lua
replace this:
if ( GetCameraPositionY(0) <= GetGamePlayerStateWaterlineY()+8.0 ) then
-- check for space to move player slowly up when underwater.
if ( g_PlayerUnderwaterMode == 1 and g_PlrKeySPACE == 1 ) then
if( GetCameraPositionY(0) >= GetGamePlayerStateWaterlineY()+7.0 ) then
SetFreezePosition(GetPlrObjectPositionX(),GetPlrObjectPositionY()+0.01,GetPlrObjectPositionZ()) -- slow down
elseif( GetCameraPositionY(0) >= GetGamePlayerStateWaterlineY()+6.0 ) then
SetFreezePosition(GetPlrObjectPositionX(),GetPlrObjectPositionY()+0.075,GetPlrObjectPositionZ()) -- slow down
else
SetFreezePosition(GetPlrObjectPositionX(),GetPlrObjectPositionY()+0.25,GetPlrObjectPositionZ()) -- full speed up
end
SetFreezeAngle(GetCameraAngleX(0),GetCameraAngleY(0),GetCameraAngleZ(0))
TransportToFreezePosition()
end
end
with this:
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 pre alpha and a lot of code is missing but it gives a first impression, what I want to do
Ebe Editor Free - Build your own EBE structures with easy and without editing any text files
Thread and Download