//------------------------------------ void Seeker_Attack( void ) { float distance; qboolean visible, advance; // Always keep a good height off the ground Seeker_MaintainHeight(); // Rate our distance to the target, and our visibilty distance = DistanceHorizontalSquared( NPCS.NPC->r.currentOrigin, NPCS.NPC->enemy->r.currentOrigin ); visible = NPC_ClearLOS4( NPCS.NPC->enemy ); advance = (qboolean)(distance > MIN_DISTANCE_SQR); if ( NPCS.NPC->client->NPC_class == CLASS_BOBAFETT ) { advance = (qboolean)(distance>(200.0f*200.0f)); } // If we cannot see our target, move to see it if ( visible == qfalse ) { if ( NPCS.NPCInfo->scriptFlags & SCF_CHASE_ENEMIES ) { Seeker_Hunt( visible, advance ); return; } } Seeker_Ranged( visible, advance ); }
//------------------------------------ void Seeker_Ranged( qboolean visible, qboolean advance ) { if ( NPCS.NPC->client->NPC_class != CLASS_BOBAFETT ) { if ( NPCS.NPC->count > 0 ) { if ( TIMER_Done( NPCS.NPC, "attackDelay" )) // Attack? { TIMER_Set( NPCS.NPC, "attackDelay", Q_irand( 250, 2500 )); Seeker_Fire(); NPCS.NPC->count--; } } else { // out of ammo, so let it die...give it a push up so it can fall more and blow up on impact // NPC->client->ps.gravity = 900; // NPC->svFlags &= ~SVF_CUSTOM_GRAVITY; // NPC->client->ps.velocity[2] += 16; G_Damage( NPCS.NPC, NPCS.NPC, NPCS.NPC, NULL, NULL, 999, 0, MOD_UNKNOWN ); } } if ( NPCS.NPCInfo->scriptFlags & SCF_CHASE_ENEMIES ) { Seeker_Hunt( visible, advance ); } }
void Seeker_Attack( void ) { float distance; qboolean visible; qboolean advance; // Always keep a good height off the ground Seeker_MaintainHeight(); // Rate our distance to the target, and our visibilty distance = DistanceHorizontalSquared( NPC->r.currentOrigin, NPC->enemy->r.currentOrigin ); visible = NPC_ClearLOS4( NPC->enemy ); advance = (qboolean)(distance > MIN_DISTANCE_SQR); //[SeekerItemNpc] //dont shoot at dead people if(!NPC->enemy->inuse || NPC->enemy->health <= 0) { NPC->enemy = NULL; return; } //[/SeekerItemNpc] if ( NPC->client->NPC_class == CLASS_BOBAFETT ) { advance = (qboolean)(distance>(200.0f*200.0f)); } // If we cannot see our target, move to see it if ( visible == qfalse ) { if ( NPCInfo->scriptFlags & SCF_CHASE_ENEMIES ) { Seeker_Hunt( visible, advance ); return; } //[SeekerItemNpc] else { //we cant chase them? then return to the follow target NPC->enemy = NULL; if(NPC->client->leader) NPCInfo->goalEntity = NPC->client->leader; return; } //[/SeekerItemNpc] } Seeker_Ranged( visible, advance ); }
//------------------------------------ void Seeker_Ranged( qboolean visible, qboolean advance ) { if ( NPC->client->NPC_class != CLASS_BOBAFETT ) { //racc - boba fett doesn't run out of ammo. if ( NPC->count > 0 || NPC->count == -1) { //[SeekerItemNpc] //better than using the timer, and if the dynamic music is ever used, then we can apply it to them using the shootTime //meh, just using TIMER_ stuff for now, in case standard npc ai messes it up //if (NPCInfo->shotTime < level.time) // Attack? if ( TIMER_Done( NPC, "attackDelay" )) // Attack? { //NPCInfo->shotTime = level.time + NPC->delay + Q_irand(0, NPC->random); TIMER_Set( NPC, "attackDelay", Q_irand(NPC->genericValue1, NPC->genericValue2)); Seeker_Fire(); if(NPC->count != -1) NPC->count--; } /* if ( TIMER_Done( NPC, "attackDelay" )) // Attack? { TIMER_Set( NPC, "attackDelay", Q_irand( 250, 2500 )); Seeker_Fire(); NPC->count--; } */ //[/SeekerItemNpc] } else { //[SeekerItemNpc] what is wrong with this? re-enabling... //hmm, somewhere I saw code that handles the final death, but I cant find it anymore... //meh, disabling again // out of ammo, so let it die...give it a push up so it can fall more and blow up on impact //NPC->client->ps.gravity = 900; //NPC->svFlags &= ~SVF_CUSTOM_GRAVITY; //NPC->client->ps.velocity[2] += 16; G_Damage( NPC, NPC, NPC, NULL, NULL, NPC->health/*999*/, 0, MOD_UNKNOWN ); //[/SeekerItemNpc] } } if ( NPCInfo->scriptFlags & SCF_CHASE_ENEMIES ) { Seeker_Hunt( visible, advance ); } }