You are viewing our Forum Archives. To view or take place in current topics click here.
[Re-Release] Toggle Zombify
Posted:

[Re-Release] Toggle ZombifyPosted:

Mikeeeey
  • Ladder Climber
Status: Offline
Joined: May 15, 201113Year Member
Posts: 350
Reputation Power: 26
Status: Offline
Joined: May 15, 201113Year Member
Posts: 350
Reputation Power: 26
Hey guys, nothing much but I thought some of you may like it, fully toggable except the angles dont reset. I someone figures it out, post it and I will update...

Obviously credit to Mike, this is in the GSCs though O.o
Please don't flame,


Thanks, Mikeeey

Tgl_Zombify()
{
        if( !IsDefined( self.Zombify ) )
        {
                self.Zombify = true;
                self thread ZombifyPlayer();
                self iPrintln( "Zombify ^2On" );
        }
        else
        {
                self thread EndZombify();
                self.Zombify = undefined;
                self iPrintln( "Zombify ^1Off" );

        }
}

EndZombify()
{
        self notify( "ZombifyOver" );
        self adjust_angles_to_player( ( 0, 0, 0 ) );
        self AllowProne( true );
        self AllowCrouch( true );
        self AllowSprint( true );
        self AllowJump( true );
        self EnableWeaponCycling();
        self EnableOffhandWeapons();
        self VisionSetNaked( "default", 1 );
        self.player_speed = 200;
        self.ignoreme = false;
        self.is_zombie = false;
        self.isai = false;
        self.ai = false;
        self.team = "allies";
        self setMoveSpeedScale( 1 );
        self setPlayerAngles( ( 0, 0, 0 ) );
        self maps\_utility::setClientSysState( "zombify", 0, self );
}

ZombifyPlayer()
{
        self endon( "ZombifyOver" );
        if( self.is_zombie == false || !IsDefined( self.is_zombie ) )
        {
                self thread CloseMenu();
                self AllowProne( false );
                self AllowCrouch( false );
                self AllowSprint( false );
                self AllowJump( false );
                self.ignoreme = true;
                self.is_zombie = true;
                self.isai = true;
                self.ai = true;
                self.zombification_time = getTime();
                self.team = "axis";
                self notify( "zombified" );
                if( IsDefined( self.revivetrigger ) )
                {
                        self.revivetrigger Delete();
                }
                self.revivetrigger = undefined;
                self setMoveSpeedScale( 0.3 );
                self reviveplayer();
                self TakeAllWeapons();
                self starttanning();
                self GiveWeapon( "zombie_melee", 0 );
                self SwitchToWeapon( "zombie_melee" );
                self DisableWeaponCycling();
                self DisableOffhandWeapons();
                self VisionSetNaked( "zombie_turned", 1 );
                self maps\_utility::setClientSysState( "zombify", 1, self );
                self thread InjuredWalk();
                self thread playerzombie_player_damage();
                self.human_model = self.model;
                self setmodel( getaiarray( "axis" )[randomint( getaiarray( "axis" ).size-1)].model );
        }
}

InjuredWalk()
{
        self endon( "ZombifyOver" );
        {
                self.ground_ref_ent = Spawn( "script_model", ( 0, 0, 0 ) );
                self.player_speed = 50;
                self PlayerSetGroundReferenceEnt( self.ground_ref_ent );
                self thread Limp();
        }
}

Limp()
{
        self endon( "ZombifyOver" );
        level endon( "ZombifyOver" );
        level endon( "disconnect" );
        level endon( "death" );
        stumble = 0;
        alt = 0;
        for( ;; )
        {
                velocity = self GetVelocity();
                player_speed = abs( velocity[0] ) + abs( velocity[1] );
                if( player_speed < 10 )
                {
                        wait( 0.05 );
                        continue;
                }
                speed_multiplier = player_speed / self.player_speed;
                p = RandomFloatRange( 3, 5 );
                if( RandomInt( 100 ) < 20 )
                {
                        p *= 3;
                }
                r = RandomFloatRange( 3, 7 );
                y = RandomFloatRange( -8, -2 );
                stumble_angles = ( p, y, r );
                stumble_angles = vector_multiply( stumble_angles, speed_multiplier );
                stumble_time = RandomFloatRange( .35, .45 );
                recover_time = RandomFloatRange( .65, .8 );
                stumble++;
                if( speed_multiplier > 1.3 )
                {
                        stumble++;
                }
                self thread stumble( stumble_angles, stumble_time, recover_time );
                level waittill( "recovered" );
        }
}

stumble( stumble_angles, stumble_time, recover_time, no_notify )
{
        self endon( "ZombifyOver" );
        stumble_angles = self adjust_angles_to_player( stumble_angles );
        self.ground_ref_ent RotateTo( stumble_angles, stumble_time, ( stumble_time/4*3 ), ( stumble_time/4 ) );
        self.ground_ref_ent waittill( "rotatedone" );
        base_angles = ( RandomFloat( 4 ) - 4, RandomFloat( 5 ), 0 );
        base_angles = self adjust_angles_to_player( base_angles );
        self.ground_ref_ent RotateTo( base_angles, recover_time, 0, ( recover_time / 2 ) );
        self.ground_ref_ent waittill( "rotatedone" );
        if( !IsDefined( no_notify ) )
        {
                level notify( "recovered" );
        }
}

adjust_angles_to_player( stumble_angles )
{
        self endon( "ZombifyOver" );
        {
                pa = stumble_angles[0];
                ra = stumble_angles[2];
                rv = AnglesToRight( self.angles );
                fv = AnglesToForward( self.angles );
                rva = ( rv[0], 0, rv[1]*-1 );
                fva = ( fv[0], 0, fv[1]*-1 );
                angles = vector_multiply( rva, pa );
                angles = angles + vector_multiply( fva, ra );
                return angles +( 0, stumble_angles[1], 0 );
        }
}

playerzombie_player_damage()
{
        self endon( "death" );
        self endon( "disconnect" );
        self endon( "ZombifyOver" );
        self.zombiehealth = level.zombie_health;
        while( 1 )
        {
                self waittill( "damage", amount, attacker, directionVec, point, type );
                if( !IsDefined( attacker ) || !IsPlayer( attacker ) )
                {
                        wait( 0.05 );
                        continue;
                }
                self.zombiehealth -= amount;
                if( self.zombiehealth <= 0 )
                {
                        self thread playerzombie_downed_state();
                        self waittill( "playerzombie_downed_state_done" );
                        self.zombiehealth = level.zombie_health;
                }
        }
}

playerzombie_downed_state()
{
        self endon( "death" );
        self endon( "ZombifyOver" );
        self endon( "disconnect" );
        downTime = 15;
        startTime = GetTime();
        endTime = startTime +( downTime * 1000 );
        self thread playerzombie_downed_hud();
        self.playerzombie_soundboard_disable = true;
        self DisableWeapons();
        self AllowStand( false );
        self AllowCrouch( false );
        self AllowProne( true );
        while( GetTime() < endTime )
        {
                wait( 0.05 );
        }
        self.playerzombie_soundboard_disable = false;
        self EnableWeapons();
        self AllowStand( true );
        self AllowCrouch( true );
        self AllowProne( true );
        self notify( "playerzombie_downed_state_done" );
}

playerzombie_downed_hud()
{
        self endon( "death" );
        self endon( "ZombifyOver" );
        self endon( "disconnect" );
        text = NewClientHudElem( self );
        text.alignX = "center";
        text.alignY = "middle";
        text.horzAlign = "center";
        text.vertAlign = "bottom";
        text.foreground = true;
        text.font = "default";
        text.fontScale = 1.8;
        text.alpha = 0;
        text.color = ( 1.0, 1.0, 1.0 );
        text SetText( &"ZOMBIE_PLAYERZOMBIE_DOWNED" );
        text.y = -113;
        if( IsSplitScreen() )
        {
                text.y = -137;
        }
        text FadeOverTime( 0.1 );
        text.alpha = 1;
        self waittill( "playerzombie_downed_state_done" );
        text FadeOverTime( 0.1 );
        text.alpha = 0;
}

The following 1 user thanked Mikeeeey for this useful post:

Done (09-17-2011)
#2. Posted:
xSonic
  • TTG Senior
Status: Offline
Joined: Oct 11, 201014Year Member
Posts: 1,789
Reputation Power: 88
Status: Offline
Joined: Oct 11, 201014Year Member
Posts: 1,789
Reputation Power: 88
Nice I Like it

ERROR:
self thread CloseMenu();

This will only work for pheonix unless removed or channged to suit your menu
Jump to:
You are viewing our Forum Archives. To view or take place in current topics click here.