Swarm ThirdPersonView: Difference between revisions
No edit summary |
No edit summary |
||
Line 1: | Line 1: | ||
[[Image:thirdpersonalienswarm001.gif|right|250px|thumb|Third Person View from this Tutorial]] | |||
== How to Create a Third Person View in a Alien Swarm Modification. == | == How to Create a Third Person View in a Alien Swarm Modification. == | ||
Revision as of 03:56, 3 July 2011
How to Create a Third Person View in a Alien Swarm Modification.
See Swarm SDK Create a Mod first.
Code:
- Changing asw_controls
Open this file:
- src\game\shared\swarm\asw_player_shared.cpp
First we change the value "1" to "0" in asw_controls otherwise the angle of the mouse will be wrong. (NOTICE: the panels and stuff will NOT work anymore, you have to fix that in asw_in_mouse reset and apply functions)
ConVar asw_controls("asw_controls", "1", FCVAR_REPLICATED | FCVAR_CHEAT, "Disable to get normal FPS controls (affects all players on the server)");
- Changing the Crosshair to look like a Shooter one.
Open this file:
- src\game\client\swarm\vgui\asw_hud_crosshair.cpp
and change the number in this entry to 0
ConVar asw_crosshair_use_perspective("asw_crosshair_use_perspective", "1", FCVAR_CHEAT, "Show the crosshair that has perspective or the old version?");
- Fixing the Shootposition
-
- src\game\shared\swarm\asw_marine_shared.cpp
search for
Vector CASW_Marine::Weapon_ShootPosition( )
and replace the whole function with this:
return EyePosition();
- Now we adjust the yaw and pitch code (copy and paste) [big thanks to Rehbock]
Open:
- src\game\client\swarm\asw_in_camera.cpp
search for :
return m_fCurrentCameraPitch;
(its in the float CASWInput::ASW_GetCameraPitch function) replace with this:
bool bIsThirdPerson = ( ::input->CAM_IsThirdPerson() != 0 );
if ( bIsThirdPerson )
{
//function:
float fPitchMovement;
C_ASW_Player *pPlayer = C_ASW_Player::GetLocalASWPlayer();
if (pPlayer && pPlayer->GetMarine())
{
fPitchMovement = pPlayer->EyeAngles()[PITCH];
float fRotate = fPitchMovement;
float fFullRotations = static_cast< int >( fRotate / 360.0f );
fRotate -= fFullRotations * 360.0f;
fRotate = AngleNormalize( fRotate );
return fRotate ;}
}
return m_fCurrentCameraPitch;
now the yaw movement (side) search for :
return asw_cam_marine_yaw.GetFloat();
(its in the float CASWInput::ASW_GetCamera function) replace with this:
bool bIsThirdPerson = ( ::input->CAM_IsThirdPerson() != 0 );
if ( bIsThirdPerson )
{
float fYawMovement;
C_ASW_Player *pPlayer = C_ASW_Player::GetLocalASWPlayer();
if (pPlayer && pPlayer->GetMarine())
{
fYawMovement = pPlayer->EyeAngles()[YAW];
float fRotate = fYawMovement;
float fFullRotations = static_cast< int >( fRotate / 360.0f );
fRotate -= fFullRotations * 360.0f;
fRotate = AngleNormalize( fRotate );
return fRotate ;
}
}
return asw_cam_marine_yaw.GetFloat();
- To change the distance you can change the value from
ConVar asw_cam_marine_dist( "asw_cam_marine_dist", "412", FCVAR_CHEAT, "Marine Camera: Distance from marine." );
I set it to the value "90" its also important to remove the shift function, just change the value "1" to "0"
ConVar asw_cam_marine_shift_enable( "asw_cam_marine_shift_enable", "0", FCVAR_CHEAT, "Camera shifting enable/disable." ); //default was 1
Thats it :-)
(NOTICE:You just have to fix the Shootpositions in some weapons!)