Ejemplo n.º 1
0
/*
-------------------------
NPC_Sentry_Patrol
-------------------------
*/
void NPC_Sentry_Patrol( void ) {
    Sentry_MaintainHeight();

    //If we have somewhere to go, then do that
    if ( !NPC->enemy ) {
        if ( NPC_CheckPlayerTeamStealth() ) {
            //NPC_AngerSound();
            NPC_UpdateAngles( qtrue, qtrue );
            return;
        }

        if ( UpdateGoal() ) {
            //start loop sound once we move
            ucmd.buttons |= BUTTON_WALKING;
            NPC_MoveToGoal( qtrue );
        }

        //randomly talk
        if ( TIMER_Done( NPC, "patrolNoise" ) ) {
            G_SoundOnEnt( NPC, CHAN_AUTO, va( "sound/chars/sentry/misc/talk%d", Q_irand( 1, 3 ) ) );

            TIMER_Set( NPC, "patrolNoise", Q_irand( 2000, 4000 ) );
        }
    }

    NPC_UpdateAngles( qtrue, qtrue );
}
/*
-------------------------
Sentry_AttackDecision
-------------------------
*/
void Sentry_AttackDecision( void )
{
	float		distance;	
	qboolean	visible;
	qboolean	advance;

	// Always keep a good height off the ground
	Sentry_MaintainHeight();

	NPC->s.loopSound = G_SoundIndex( "sound/chars/sentry/misc/sentry_hover_2_lp" );

	//randomly talk
	if ( TIMER_Done(NPC,"patrolNoise") )
	{
		if (TIMER_Done(NPC,"angerNoise"))
		{
			G_SoundOnEnt( NPC, CHAN_AUTO, va("sound/chars/sentry/misc/talk%d", Q_irand(1, 3)) );

			TIMER_Set( NPC, "patrolNoise", Q_irand( 4000, 10000 ) );
		}
	}

	// He's dead.
	if (NPC->enemy->health<1)
	{
		NPC->enemy = NULL;
		Sentry_Idle();
		return;
	}

	// If we don't have an enemy, just idle
	if ( NPC_CheckEnemyExt(qfalse) == qfalse )
	{
		Sentry_Idle();
		return;
	}

	// Rate our distance to the target and visibilty
	distance	= (int) DistanceHorizontalSquared( NPC->r.currentOrigin, NPC->enemy->r.currentOrigin );	
	visible		= NPC_ClearLOS4( NPC->enemy );
	advance		= (qboolean)(distance > MIN_DISTANCE_SQR);

	// If we cannot see our target, move to see it
	if ( visible == qfalse )
	{
		if ( NPCInfo->scriptFlags & SCF_CHASE_ENEMIES )
		{
			Sentry_Hunt( visible, advance );
			return;
		}
	}

	NPC_FaceEnemy( qtrue );

	Sentry_RangedAttack( visible, advance );
}
Ejemplo n.º 3
0
/*
-------------------------
Sentry_Idle
-------------------------
*/
void Sentry_Idle( void ) {
    Sentry_MaintainHeight();

    // Is he waking up?
    if ( NPCInfo->localState == LSTATE_WAKEUP ) {
        if ( NPC->client->ps.torsoTimer <= 0 ) {
            NPCInfo->scriptFlags |= SCF_LOOK_FOR_ENEMIES;
            NPCInfo->burstCount = 0;
        }
    }
    else {
        NPC_SetAnim( NPC, SETANIM_BOTH, BOTH_SLEEP1, SETANIM_FLAG_OVERRIDE | SETANIM_FLAG_HOLD );
        NPC->flags |= FL_SHIELDED;

        NPC_BSIdle();
    }
}