Half-Life Re-imagined competition results on their way...
Check out Skewing textures in Hammer, our newest tutorial!
Say hello to MD_AZMAL, our newest member!

logo

Site Stuff

Reference

Maps

Community

ShoutBOX

Poll

Feeling Blue

What's your favourite shade of blue?

Azure

8

Cobalt

18

Turquoise

4

Cyan

8

Royal

3

Teal

3

Onliners

1 secs

Snehk

3 mins

Windawz

3 mins

Penguinboy

9 mins

Solokiller

11 mins

Silvertongue

17 mins

Instant Mix

44 mins

Strider

Affiliates

A gaming and technology blog by TWHL admins Penguinboy and Ant. A music blog by TWHL users Ant and Hugh.

View Turrets through Barrel

By J.P.Barry

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.