06-18-2013, 13:25
Hello
This is another code I found out while I was exploring my zombie mod folder, it is meant to be used on boxes, it spawns a shader over it that only appears when you are close and looking at it, it fades in and out to give a better effect.
Example of use:
Thanks for reading
This is another code I found out while I was exploring my zombie mod folder, it is meant to be used on boxes, it spawns a shader over it that only appears when you are close and looking at it, it fades in and out to give a better effect.
Code:
iShader( shader )
{
trigger = Spawn( "trigger_radius", self.origin, 0, 150, 72 );
icon = NewHudElem( );
icon SetShader( shader, 150, 150 );
icon.alpha = 0;
icon.color = ( 1, 1, 1 );
icon.x = self.origin[ 0 ];
icon.y = self.origin[ 1 ];
icon.z = self.origin[ 2 ] + 55;
icon SetWayPoint( true, true );
wait ( 0.05 );
while( 1 )
{
trigger waittill( "trigger", player );
if( !isplayer( player ) )
continue;
while( player IsTouching( trigger ) )
{
if( VectorDot( anglesToForward( player.angles ), VectorNormalize( trigger.origin - player.origin ) ) > 0.766 )
FadeIcon( icon, "in" );
else
FadeIcon( icon, "out" );
wait ( 0.25 );
}
FadeIcon( icon, "out" );
}
}
FadeIcon( icon, what )
{
if( what == "in" )
{
icon FadeOverTime( 0.2 );
icon.alpha = 1;
wait ( 0.2 );
}
else if( what == "out" )
{
icon FadeOverTime( 0.2 );
icon.alpha = 0;
wait ( 0.2 );
}
else
{
if( icon.alpha == 0 )
{
icon FadeOverTime( 0.2 );
icon.alpha = 1;
wait ( 0.2 );
}
else
{
icon FadeOverTime( 0.2 );
icon.alpha = 0;
wait ( 0.2 );
}
}
}
Example of use:
Code:
block = spawn( "script_model", ( 100, 30, -1000 ) );
block setModel( "com_plasticcase_beige_big" );
block thread iShader( "hudicon_neutral" );
Thanks for reading