This article was recovered from an archive and needs to be reviewed
- The formatting may be incorrect as it was automatically converted to WikiCode from HTML, it needs to be revised and reformatted
- Some information may be out of date as it was written before Half-Life was available on Steam
- After the article is re-formatted and updated for Steam HL, remove this notice
- Please do not remove the archive notice from the bottom of the article.
- Some archive articles are no longer useful, or they duplicate information from other tutorials and entity guides. In this case, delete the page after merging any relevant information into other pages. Contact an admin to delete a page.
One of the most difficult things in Half-Life is trying to control the turrets. You never seem to have a good angle and it can take ages to get the hang of controlling them. This article describes how you can put the 'camera' so that it is looking straight out the barrel.
This is a very effective little trick, which requires barely two lines of code and the removal of a couple of lines. It works on virtually all the turrets in Half-Life.
First open up func_tank.cpp and scroll down to StartControl( ) and add the following to the sub
SET_VIEW( m_pController->edict(), ENT(pev));
This will set the view of the player ( m_pController ) to the view of me. Then go down to StopControl( ) and add the following
SET_VIEW( m_pController->edict(), m_pController->edict());
This should work a treat, then you have a small cosmetic issue. The flash of the gun barrel gets in the way, so go to Fire ( ) and remove or comment out..
if ( m_iszSpriteSmoke )
{
CSprite *pSprite = CSprite::SpriteCreate( STRING(m_iszSpriteSmoke),
barrelEnd, TRUE );
pSprite->AnimateAndDie( RANDOM_FLOAT( 15.0, 20.0 ) );
pSprite->SetTransparency( kRenderTransAlpha, pev->rendercolor.x,
pev->rendercolor.y, pev->rendercolor.z, 255, kRenderFxNone );
pSprite->pev->velocity.z = RANDOM_FLOAT(40, 80);
pSprite->SetScale( m_spriteScale );
}
if ( m_iszSpriteFlash )
{
CSprite *pSprite = CSprite::SpriteCreate( STRING(m_iszSpriteFlash),
barrelEnd, TRUE );
pSprite->AnimateAndDie( 60 );
pSprite->SetTransparency( kRenderTransAdd, 255, 255, 255, 255,
kRenderFxNoDissipation );
pSprite->SetScale( m_spriteScale );
// Hack Hack, make it stick around for at least 100 ms.pSprite->pev->nextthink += 0.1;
}
Thats it, now compile the dll and admire all your hard work.
This article was originally published on the
Valve Editing Resource Collective (VERC).
TWHL only archives articles from defunct websites. For more information on TWHL's archiving efforts, please visit the
TWHL Archiving Project page.