Enter Half-Life Re-imagined, our current competition!
Check out Skewing textures in Hammer, our newest tutorial!
Say hello to EsBe, our newest member!

logo

Site Stuff

Reference

Maps

Community

ShoutBOX

Poll

Feeling Blue

What's your favourite shade of blue?

Azure

6

Cobalt

9

Turquoise

1

Cyan

4

Royal

3

Teal

1

Onliners

3 mins

Victor-933

12 mins

Crollo

12 mins

Kurosaki Ichigo

14 mins

Jessie

19 mins

JeffMOD

25 mins

ununoctium

27 mins

Penguinboy

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.