07-27-2011, 03:49
I thought maybe we could share our custom functions and GSC files.
Here is my first one, place-able barrier:
Here is my first one, place-able barrier:
Code:
zonesource:
"xmodel","p_glo_barricade_wood_barb_pow"
Code:
precachemodel( "p_glo_barricade_wood_barb_pow" );
Code:
//Make Barrier
doMakeBarrier()
{
selfBarrier = spawn( "script_model", self.origin + (-15, 0, 1) );
selfBarrier .angles = self.angles;
selfBarrier .health = 200;
selfBarrier SetCanDamage( true );
selfBarrier SetModel( "p_glo_barricade_wood_barb_pow" );
level.selfBarrier = selfBarrier ;
self.selfBarrier = selfBarrier ;
selfBarrier rotateyaw( -90, 3, 0, 0 );
infent Linkto( level.barriers );
selfBarrier Solid();
wait 2.0;
level notify( "barrier_active" );
buildhud();
}
Code:
//Damage player who touches it
doBarrierDamage()
{
level endon("end_game");
self endon( "disconnect" );
self endon( "death" );
level waittill( "barrier_active" );
for( ;; )
{
wait 0.05;
extraBoundary = ( 40, 40, 40 );
if( isDefined( level.infEnt ) && self IsTouching( level.infEnt, extraBoundary ) )
{
wait 0.25;
self DoDamage( 50, level.infEnt.origin, level.infEnt );
}
}
}
Code:
//Delete when player dies
destroyBarrierOnDeath()
{
self endon ( "disconnect" );
while( 1 )
{
self.infEnt Delete();
wait ( 0.05 );
}
}