//----------------------------------------------------------------------------- // Purpose: // Input : // Output : //----------------------------------------------------------------------------- void CNPC_Headcrab::Spawn( void ) { Precache(); SetRenderColor( 255, 255, 255, 255 ); SetModel( "models/headcrab.mdl" ); m_iHealth = sk_headcrab_health.GetFloat(); SetHullType(HULL_TINY); SetHullSizeNormal(); SetSolid( SOLID_BBOX ); AddSolidFlags( FSOLID_NOT_STANDABLE ); SetMoveType( MOVETYPE_STEP ); SetViewOffset( Vector(6, 0, 11) ); // Position of the eyes relative to NPC's origin. m_bloodColor = BLOOD_COLOR_GREEN; m_flFieldOfView = 0.5; m_NPCState = NPC_STATE_NONE; m_nGibCount = HEADCRAB_ALL_GIB_COUNT; CapabilitiesClear(); CapabilitiesAdd( bits_CAP_MOVE_GROUND | bits_CAP_INNATE_RANGE_ATTACK1 ); NPCInit(); }
//----------------------------------------------------------------------------- // Purpose: // // //----------------------------------------------------------------------------- void CFastZombie::Spawn( void ) { Precache(); m_fJustJumped = false; m_fIsTorso = m_fIsHeadless = false; SetBloodColor( BLOOD_COLOR_YELLOW ); m_iHealth = 50; m_flFieldOfView = 0.2; CapabilitiesClear(); CapabilitiesAdd( bits_CAP_MOVE_CLIMB | bits_CAP_MOVE_JUMP | bits_CAP_MOVE_GROUND | bits_CAP_INNATE_RANGE_ATTACK1 | /*bits_CAP_INNATE_MELEE_ATTACK1 |*/ bits_CAP_DOORS_GROUP ); m_flNextAttack = gpGlobals->curtime; m_pLayer2 = NULL; m_iClimbCount = 0; m_flTimeUpdateSine = gpGlobals->curtime; m_fSineTrendUp = false; EndNavJump(); m_flDistFactor = 1.0; BaseClass::Spawn(); }
//----------------------------------------------------------------------------- // Purpose: // // //----------------------------------------------------------------------------- void CNPC_Blob::Spawn( void ) { Precache(); SetModel( NPC_BLOB_MODEL ); SetHullType(HULL_TINY); SetHullSizeNormal(); SetSolid( SOLID_NONE ); AddSolidFlags( FSOLID_NOT_STANDABLE ); SetMoveType( MOVETYPE_STEP ); SetBloodColor( BLOOD_COLOR_RED ); m_iHealth = INT_MAX; m_flFieldOfView = -1.0f; m_NPCState = NPC_STATE_NONE; CapabilitiesClear(); CapabilitiesAdd( bits_CAP_MOVE_GROUND ); m_Elements.RemoveAll(); NPCInit(); AddEffects( EF_NODRAW ); m_flMinElementDist = blob_mindist.GetFloat(); }
//----------------------------------------------------------------------------- // Purpose: // // //----------------------------------------------------------------------------- void CGoat::Spawn( void ) { Precache(); SetModel( GOAT_MODEL ); SetHullType(HULL_MEDIUM); SetHullSizeNormal(); SetSolid( SOLID_BBOX ); AddSolidFlags( FSOLID_NOT_STANDABLE ); SetMoveType( MOVETYPE_STEP ); SetBloodColor( BLOOD_COLOR_RED ); m_iHealth = sk_goat_health.GetFloat(); // m_iMaxHealth = m_iHealth; m_flFieldOfView = 0.5; // indicates the width of this NPC's forward view cone ( as a dotproduct result ) m_NPCState = NPC_STATE_NONE; CapabilitiesClear(); CapabilitiesAdd( bits_CAP_TURN_HEAD | bits_CAP_MOVE_GROUND ); // innate Range attack ( howling / shaking) CapabilitiesAdd( bits_CAP_INNATE_RANGE_ATTACK1 | bits_CAP_INNATE_RANGE_ATTACK2 ); // innate Melee attack ( charge+head attack / bite attack (from fish bite or byte missed with event ) CapabilitiesAdd( bits_CAP_INNATE_MELEE_ATTACK1 | bits_CAP_INNATE_MELEE_ATTACK2 ); BaseClass::Spawn(); }
//========================================================= // Spawn //========================================================= void CNPC_Bullsquid::Spawn() { Precache( ); SetModel( "models/bullsquid.mdl"); SetHullType(HULL_WIDE_SHORT); SetHullSizeNormal(); SetSolid( SOLID_BBOX ); AddSolidFlags( FSOLID_NOT_STANDABLE ); SetMoveType( MOVETYPE_STEP ); m_bloodColor = BLOOD_COLOR_GREEN; SetRenderColor( 255, 255, 255, 255 ); m_iHealth = sk_bullsquid_health.GetFloat(); m_flFieldOfView = 0.2;// indicates the width of this monster's forward view cone ( as a dotproduct result ) m_NPCState = NPC_STATE_NONE; CapabilitiesClear(); CapabilitiesAdd( bits_CAP_MOVE_GROUND | bits_CAP_INNATE_RANGE_ATTACK1 | bits_CAP_INNATE_MELEE_ATTACK1 | bits_CAP_INNATE_MELEE_ATTACK2 ); m_fCanThreatDisplay = TRUE; m_flNextSpitTime = gpGlobals->curtime; NPCInit(); m_flDistTooFar = 784; }
//----------------------------------------------------------------------------- //----------------------------------------------------------------------------- void CRebelZombie::Spawn( void ) { Precache(); m_fIsHeadless = false; m_iRebelZombieSkin = random->RandomInt(1,4); #ifdef HL2_EPISODIC SetBloodColor( BLOOD_COLOR_ZOMBIE ); #else SetBloodColor( BLOOD_COLOR_GREEN ); #endif // HL2_EPISODIC m_iHealth = sk_rebel_zombie_health.GetFloat(); m_flFieldOfView = 0.2; CapabilitiesClear(); CapabilitiesAdd( bits_CAP_USE_WEAPONS ); CapabilitiesAdd( bits_CAP_MOVE_SHOOT ); //GetNavigator()->SetRememberStaleNodes( false ); BaseClass::Spawn(); m_flNextMoanSound = gpGlobals->curtime + random->RandomFloat( 1.0, 4.0 ); }
//----------------------------------------------------------------------------- //----------------------------------------------------------------------------- void CZombie::Spawn( void ) { Precache(); if( FClassnameIs( this, "npc_zombie" ) ) { m_fIsTorso = false; } else { // This was placed as an npc_zombie_torso m_fIsTorso = true; } m_fIsHeadless = false; #ifdef HL2_EPISODIC SetBloodColor( BLOOD_COLOR_ZOMBIE ); #else SetBloodColor( BLOOD_COLOR_GREEN ); #endif // HL2_EPISODIC m_iHealth = sk_zombie_health.GetFloat(); m_flFieldOfView = 0.2; CapabilitiesClear(); //GetNavigator()->SetRememberStaleNodes( false ); BaseClass::Spawn(); m_flNextMoanSound = gpGlobals->curtime + random->RandomFloat( 1.0, 4.0 ); }
//========================================================= // Spawn //========================================================= void CNPC_HAssassin::Spawn() { Precache( ); SetModel( "models/hassassin.mdl"); SetHullType(HULL_HUMAN); SetHullSizeNormal(); SetNavType ( NAV_GROUND ); SetSolid( SOLID_BBOX ); AddSolidFlags( FSOLID_NOT_STANDABLE ); SetMoveType( MOVETYPE_STEP ); m_bloodColor = BLOOD_COLOR_RED; ClearEffects(); m_iHealth = sk_hassassin_health.GetFloat(); m_flFieldOfView = VIEW_FIELD_WIDE; // indicates the width of this monster's forward view cone ( as a dotproduct result ) m_NPCState = NPC_STATE_NONE; m_HackedGunPos = Vector( 0, 24, 48 ); m_iTargetRanderamt = 20; SetRenderColor( 255, 255, 255, 20 ); m_nRenderMode = kRenderTransTexture; CapabilitiesClear(); CapabilitiesAdd( bits_CAP_MOVE_GROUND ); CapabilitiesAdd( bits_CAP_INNATE_RANGE_ATTACK1 | bits_CAP_INNATE_RANGE_ATTACK2 | bits_CAP_INNATE_MELEE_ATTACK1 ); NPCInit(); }
//========================================================= // Spawn() // Crear un nuevo //========================================================= void CNPC_Scient::Spawn() { Precache(); // Modelo y color de sangre. SetModel(MODEL_BASE); SetBloodColor(BLOOD); // Tamaño SetHullType(HULL_WIDE_SHORT); SetHullSizeNormal(); // Navegación, estado físico y opciones extra. SetSolid(SOLID_BBOX); SetNavType(NAV_GROUND); AddSolidFlags(FSOLID_NOT_STANDABLE); SetMoveType(MOVETYPE_STEP); SetRenderColor(255, 255, 255, 255); SetDistLook(SEE_DIST); // Reseteo de variables. // Salud, estado del NPC y vista. m_iHealth = sk_scient_health.GetFloat(); m_NPCState = NPC_STATE_NONE; m_flFieldOfView = FOV; // Capacidades CapabilitiesClear(); CapabilitiesAdd(CAPABILITIES); NPCInit(); BaseClass::Spawn(); }
void CNPC_Controller::Spawn() { Precache( ); SetModel( "models/controller.mdl" ); UTIL_SetSize( this, Vector( -32, -32, 0 ), Vector( 32, 32, 64 )); SetSolid( SOLID_BBOX ); AddSolidFlags( FSOLID_NOT_STANDABLE ); SetMoveType( MOVETYPE_STEP ); SetGravity(0.001); m_bloodColor = BLOOD_COLOR_GREEN; m_iHealth = sk_controller_health.GetFloat(); m_flFieldOfView = VIEW_FIELD_FULL;// indicates the width of this monster's forward view cone ( as a dotproduct result ) m_NPCState = NPC_STATE_NONE; SetRenderColor( 255, 255, 255, 255 ); CapabilitiesClear(); AddFlag( FL_FLY ); SetNavType( NAV_FLY ); CapabilitiesAdd( bits_CAP_MOVE_FLY | bits_CAP_INNATE_RANGE_ATTACK1 | bits_CAP_INNATE_RANGE_ATTACK2 | bits_CAP_MOVE_SHOOT); NPCInit(); SetDefaultEyeOffset(); }
//========================================================= // Spawn //========================================================= void CNPC_HL1Barney::Spawn() { Precache( ); SetModel( "models/hl1bar.mdl"); SetRenderColor( 255, 255, 255, 255 ); SetHullType(HULL_HUMAN); SetHullSizeNormal(); SetSolid( SOLID_BBOX ); AddSolidFlags( FSOLID_NOT_STANDABLE ); SetMoveType( MOVETYPE_STEP ); m_bloodColor = BLOOD_COLOR_RED; m_iHealth = sk_barneyhl1_health.GetFloat(); SetViewOffset( Vector ( 0, 0, 100 ) );// position of the eyes relative to monster's origin. m_flFieldOfView = VIEW_FIELD_WIDE; // NOTE: we need a wide field of view so npc will notice player and say hello m_NPCState = NPC_STATE_NONE; SetBodygroup( 1, 0 ); m_fGunDrawn = false; CapabilitiesClear(); CapabilitiesAdd( bits_CAP_MOVE_GROUND | bits_CAP_OPEN_DOORS | bits_CAP_AUTO_DOORS | bits_CAP_USE | bits_CAP_DOORS_GROUP); CapabilitiesAdd( bits_CAP_INNATE_RANGE_ATTACK1 | bits_CAP_TURN_HEAD | bits_CAP_ANIMATEDFACE ); NPCInit(); SetUse( &CNPC_HL1Barney::FollowerUse ); }
void CNPC_Zombine::Spawn( void ) { Precache(); m_fIsTorso = false; m_fIsHeadless = false; #ifdef HL2_EPISODIC SetBloodColor( BLOOD_COLOR_ZOMBIE ); #else SetBloodColor( BLOOD_COLOR_GREEN ); #endif // HL2_EPISODIC m_iHealth = sk_zombie_soldier_health.GetFloat(); SetMaxHealth( m_iHealth ); m_flFieldOfView = 0.2; CapabilitiesClear(); BaseClass::Spawn(); m_flSprintTime = 0.0f; m_flSprintRestTime = 0.0f; m_flNextMoanSound = gpGlobals->curtime + random->RandomFloat( 1.0, 4.0 ); g_flZombineGrenadeTimes = gpGlobals->curtime; m_flGrenadePullTime = gpGlobals->curtime; m_iGrenadeCount = ZOMBINE_MAX_GRENADES; }
void CZombie::Spawn( void ) { if(FClassnameIs( this, "npc_zombie_bisou")) { m_iZombieType = ZOMBIE_BISOU; this->m_nSkin = RandomSkin(); } else m_iZombieType = ZOMBIE_EPICE; Precache(); m_fIsTorso = false; m_fIsHeadless = false; SetBloodColor( BLOOD_COLOR_RED ); //La vie initiale du zombie peut varier if(m_iZombieType == ZOMBIE_BISOU) m_iHealth = sk_zombie_bisou_health.GetInt() + sk_zombie_bisou_health.GetInt() * RandomFloat(-0.10f, 0.10f); else m_iHealth = sk_zombie_health.GetInt() + sk_zombie_health.GetInt() * RandomFloat(-0.10f, 0.10f); m_flFieldOfView = 0.2; CapabilitiesClear(); //GetNavigator()->SetRememberStaleNodes( false ); BaseClass::Spawn(); m_flNextMoanSound = gpGlobals->curtime + random->RandomFloat( 1.0, 4.0 ); }
//------------------------------------------------------------------------------ // Purpose : //------------------------------------------------------------------------------ void CNPC_APCDriver::Spawn( void ) { BaseClass::Spawn(); m_flTimeLastSeenEnemy = -NPC_APCDRIVER_REMEMBER_TIME; CapabilitiesClear(); CapabilitiesAdd( bits_CAP_INNATE_RANGE_ATTACK1 | bits_CAP_INNATE_RANGE_ATTACK2 ); m_bFiringDisabled = false; }
//----------------------------------------------------------------------------- // Purpose: // // //----------------------------------------------------------------------------- void CNPC_Roller::Spawn( void ) { Precache(); m_pRollSound = NULL; m_flForwardSpeed = ROLLER_FORWARD_SPEED; SetModel( "models/roller.mdl" ); SetHullType( HULL_TINY_CENTERED ); SetHullSizeNormal(); m_bloodColor = DONT_BLEED; m_iHealth = 20; m_flFieldOfView = 0.5; m_NPCState = NPC_STATE_NONE; m_fHACKJustSpawned = true; m_RollerController.Off(); m_flTimeMarcoSound = gpGlobals->curtime + ROLLER_MARCO_FREQUENCY * random->RandomFloat( 1, 3 ); m_flTimePoloSound = TIME_NEVER; CapabilitiesClear(); CapabilitiesAdd( bits_CAP_MOVE_GROUND ); m_iFail = 0; // Create the object in the physics system IPhysicsObject *pPhysicsObject = VPhysicsInitNormal( SOLID_BBOX, FSOLID_NOT_STANDABLE, false ); m_pMotionController = physenv->CreateMotionController( &m_RollerController ); m_pMotionController->AttachObject( pPhysicsObject ); NPCInit(); // Generate me an access code int i; int iLastDigit = -10; for( i = 0 ; i < ROLLER_CODE_DIGITS ; i++ ) { // Generate a digit, and make sure it's not the same // or sequential to the previous digit. do { m_iAccessCode[ i ] = rand() % 6; } while( abs(m_iAccessCode[ i ] - iLastDigit) <= 1 ); iLastDigit = m_iAccessCode[ i ]; } // this suppresses boatloads of warnings in the movement code. // (code that assumes everyone is propelled by animation). m_flGroundSpeed = 20; }
//----------------------------------------------------------------------------- // Purpose: // // //----------------------------------------------------------------------------- void CNPC_Assassin::Spawn( void ) { Precache(); SetModel( "models/fassassin.mdl" ); SetHullType(HULL_HUMAN); SetHullSizeNormal(); SetSolid( SOLID_BBOX ); AddSolidFlags( FSOLID_NOT_STANDABLE ); SetMoveType( MOVETYPE_STEP ); SetBloodColor( BLOOD_COLOR_RED ); m_iHealth = sk_assassin_health.GetFloat(); m_flFieldOfView = 0.1; m_NPCState = NPC_STATE_NONE; CapabilitiesClear(); CapabilitiesAdd( bits_CAP_MOVE_CLIMB | bits_CAP_MOVE_GROUND | bits_CAP_MOVE_JUMP ); CapabilitiesAdd( bits_CAP_SQUAD | bits_CAP_USE_WEAPONS | bits_CAP_AIM_GUN | bits_CAP_INNATE_RANGE_ATTACK1 | bits_CAP_INNATE_RANGE_ATTACK2 | bits_CAP_INNATE_MELEE_ATTACK1 ); //Turn on our guns SetBodygroup( 1, 1 ); int attachment = LookupAttachment( "Eye" ); // Start up the eye glow m_pEyeSprite = CSprite::SpriteCreate( "sprites/redglow1.vmt", GetLocalOrigin(), false ); if ( m_pEyeSprite != NULL ) { m_pEyeSprite->SetAttachment( this, attachment ); m_pEyeSprite->SetTransparency( kRenderTransAdd, 255, 255, 255, 200, kRenderFxNone ); m_pEyeSprite->SetScale( 0.25f ); } // Start up the eye trail m_pEyeTrail = CSpriteTrail::SpriteTrailCreate( "sprites/bluelaser1.vmt", GetLocalOrigin(), false ); if ( m_pEyeTrail != NULL ) { m_pEyeTrail->SetAttachment( this, attachment ); m_pEyeTrail->SetTransparency( kRenderTransAdd, 255, 0, 0, 200, kRenderFxNone ); m_pEyeTrail->SetStartWidth( 8.0f ); m_pEyeTrail->SetLifeTime( 0.75f ); } NPCInit(); m_bEvade = false; m_bAggressive = false; }
//------------------------------------------------------------------------------ // Purpose : //------------------------------------------------------------------------------ void CNPC_CraneDriver::Spawn( void ) { BaseClass::Spawn(); CapabilitiesClear(); CapabilitiesAdd( bits_CAP_INNATE_RANGE_ATTACK1 ); m_flDistTooFar = 2048.0; SetDistLook( 2048 ); m_PreviouslyPickedUpObjects.Purge(); m_hPickupTarget = NULL; m_bForcedPickup = false; m_bForcedDropoff = false; }
//------------------------------------------------------------------------------ // Purpose : //------------------------------------------------------------------------------ void CNPC_VehicleDriver::Spawn( void ) { Precache( ); BaseClass::Spawn(); CapabilitiesClear(); CapabilitiesAdd( bits_CAP_MOVE_GROUND ); CapabilitiesAdd( bits_CAP_MOVE_SHOOT ); SetModel( "models/roller_vehicledriver.mdl" ); SetHullType(HULL_LARGE); SetHullSizeNormal(); m_iMaxHealth = m_iHealth = 1; m_flFieldOfView = VIEW_FIELD_FULL; SetSolid( SOLID_BBOX ); AddSolidFlags( FSOLID_NOT_SOLID ); SetMoveType( MOVETYPE_NONE ); AddEffects( EF_NODRAW ); m_lifeState = LIFE_ALIVE; SetCycle( 0 ); ResetSequenceInfo(); AddFlag( FL_NPC ); m_flMaxSpeed = 0; m_flGoalSpeed = m_flInitialSpeed; m_vecDesiredVelocity = vec3_origin; m_vecPrevPoint = vec3_origin; m_vecPrevPrevPoint = vec3_origin; m_vecPostPoint = vec3_origin; m_vecPostPostPoint = vec3_origin; m_vecDesiredPosition = vec3_origin; m_flSteering = 45; m_flDistanceAlongSpline = 0.2; m_pCurrentWaypoint = m_pNextWaypoint = NULL; GetNavigator()->SetPathcornerPathfinding( false ); NPCInit(); m_takedamage = DAMAGE_NO; }
//----------------------------------------------------------------------------- // Purpose: //----------------------------------------------------------------------------- void CNPC_Monster::Spawn( void ) { ParseNPCScript( cScript.ToCStr() ); m_flLastBloodTrail = gpGlobals->curtime; m_flNextPainSoundTime = 0; m_fIsHeadless = true; AddSpawnFlags( SF_NPC_LONG_RANGE ); m_flFieldOfView = 0.2; CapabilitiesClear(); CapabilitiesAdd( bits_CAP_MOVE_GROUND | bits_CAP_INNATE_MELEE_ATTACK1 ); BaseClass::Spawn(); }
void CNPC_AlienGrunt::Spawn() { Precache(); SetModel( "models/agrunt.mdl"); UTIL_SetSize( this, Vector( -32, -32, 0 ), Vector( 32, 32, 64 ) ); SetSolid( SOLID_BBOX ); AddSolidFlags( FSOLID_NOT_STANDABLE ); Vector vecSurroundingMins( -32, -32, 0 ); Vector vecSurroundingMaxs( 32, 32, 85 ); CollisionProp()->SetSurroundingBoundsType( USE_SPECIFIED_BOUNDS, &vecSurroundingMins, &vecSurroundingMaxs ); SetMoveType( MOVETYPE_STEP ); m_bloodColor = BLOOD_COLOR_GREEN; ClearEffects(); m_iHealth = sk_agrunt_health.GetFloat(); m_flFieldOfView = 0.2;// indicates the width of this monster's forward view cone ( as a dotproduct result ) m_NPCState = NPC_STATE_NONE; CapabilitiesClear(); CapabilitiesAdd ( bits_CAP_SQUAD | bits_CAP_MOVE_GROUND ); CapabilitiesAdd(bits_CAP_INNATE_RANGE_ATTACK1 ); // Innate range attack for kicking CapabilitiesAdd(bits_CAP_INNATE_MELEE_ATTACK1 ); m_HackedGunPos = Vector( 24, 64, 48 ); m_flNextSpeakTime = m_flNextWordTime = gpGlobals->curtime + 10 + random->RandomInt( 0, 10 ); SetHullType(HULL_WIDE_HUMAN); SetHullSizeNormal(); SetRenderColor( 255, 255, 255, 255 ); NPCInit(); BaseClass::Spawn(); }
//----------------------------------------------------------------------------- //----------------------------------------------------------------------------- void CASW_Zombie::Spawn( void ) { Precache(); // asw: no placing just torsos //if( FClassnameIs( this, "asw_zombie" ) ) //{ m_fIsTorso = false; //} //else //{ // This was placed as an npc_zombie_torso //m_fIsTorso = true; //} m_fIsHeadless = false; SetBloodColor( BLOOD_COLOR_RED ); SetHealthByDifficultyLevel(); m_flFieldOfView = 0.2; SetDistLook( 768.0f ); m_flDistTooFar = 1024.0f; if ( HasSpawnFlags( SF_NPC_LONG_RANGE ) ) { m_flDistTooFar = 2248.0f; SetDistLook( 1200.0f ); } CapabilitiesClear(); //GetNavigator()->SetRememberStaleNodes( false ); BaseClass::Spawn(); m_flNextMoanSound = gpGlobals->curtime + random->RandomFloat( 1.0, 4.0 ); if (asw_zombie_eye_glow.GetBool()) CreateEyeGlows(); }
//----------------------------------------------------------------------------- // Purpose: // // //----------------------------------------------------------------------------- void CNewNPC::Spawn( void ) { Precache(); SetModel( "models/mymodel.mdl" ); SetHullType(HULL_HUMAN); SetHullSizeNormal(); SetSolid( SOLID_BBOX ); AddSolidFlags( FSOLID_NOT_STANDABLE ); SetMoveType( MOVETYPE_STEP ); SetBloodColor( BLOOD_COLOR_RED ); m_iHealth = 20; m_flFieldOfView = 0.5; m_NPCState = NPC_STATE_NONE; CapabilitiesClear(); //CapabilitiesAdd( bits_CAP_NONE ); NPCInit(); }
//----------------------------------------------------------------------------- // Purpose: Sets up the entity's initial state //----------------------------------------------------------------------------- void CTDPHeadcrab::Spawn( void ) { Precache(); // precache resources SetModel( ENTITY_MODEL ); // set the display model BaseClass::Spawn(); // init CAI_BaseNPC's member vars m_iHealth = 100.0; // set health of your crab; you'll want to make this a convar SetHullType(HULL_TINY); SetHullSizeNormal(); SetSolid( SOLID_BBOX ); // we don't want to allow others to stand on this critter AddSolidFlags( FSOLID_NOT_STANDABLE ); SetMoveType( MOVETYPE_STEP ); // have to look into this, the original crab has it's own collision SetCollisionGroup( COLLISION_GROUP_NPC ); // model defined in hl2 specific code SetViewOffset( Vector(6, 0, 11) ) ; // Position of the eyes relative to NPC's origin. SetBloodColor( BLOOD_COLOR_GREEN ); // guess ;-) m_flFieldOfView = 0.5; m_NPCState = NPC_STATE_NONE; CapabilitiesClear(); // crab can move around and start melee attack CapabilitiesAdd( bits_CAP_MOVE_GROUND | bits_CAP_INNATE_MELEE_ATTACK1 ); NPCInit(); // initialize our NPC // Crab hates player, set to D_FR to see it run away from player AddClassRelationship( CLASS_PLAYER, D_HT, 0 ); AddClassRelationship( CLASS_COMBINE, D_HT, 0 ); }
//========================================================= // Spawn //========================================================= void CNPC_Vortigaunt::Spawn() { Precache( ); SetModel( "models/islave.mdl" ); SetRenderColor( 255, 255, 255, 255 ); SetHullType(HULL_WIDE_HUMAN); SetHullSizeNormal(); SetSolid( SOLID_BBOX ); AddSolidFlags( FSOLID_NOT_STANDABLE ); SetMoveType( MOVETYPE_STEP ); m_bloodColor = BLOOD_COLOR_GREEN; m_fEffects = 0; m_iHealth = sk_islave_health.GetFloat(); //pev->view_ofs = VEC_VIEW;// position of the eyes relative to monster's origin. m_flFieldOfView = VIEW_FIELD_WIDE; m_NPCState = NPC_STATE_NONE; m_iVoicePitch = random->RandomInt( 85, 110 ); CapabilitiesClear(); CapabilitiesAdd( bits_CAP_MOVE_GROUND ); CapabilitiesAdd( bits_CAP_SQUAD ); CapabilitiesAdd( bits_CAP_TURN_HEAD | bits_CAP_DOORS_GROUP ); CapabilitiesAdd ( bits_CAP_INNATE_RANGE_ATTACK1 ); CapabilitiesAdd ( bits_CAP_INNATE_MELEE_ATTACK1 ); m_iBravery = 0; NPCInit(); BaseClass::Spawn(); }
//--------------------------------------------------------- //--------------------------------------------------------- void CNPC_MissileDefense::Spawn( void ) { Precache(); SetModel( "models/missile_defense.mdl" ); UTIL_SetSize( this, Vector( -36, -36 , 0 ), Vector( 36, 36, 64 ) ); SetSolid( SOLID_BBOX ); SetMoveType( MOVETYPE_NONE ); m_takedamage = DAMAGE_YES; SetBloodColor( DONT_BLEED ); m_iHealth = 10; m_flFieldOfView = 0.1; m_NPCState = NPC_STATE_NONE; CapabilitiesClear(); CapabilitiesAdd ( bits_CAP_INNATE_RANGE_ATTACK1 ); // Hate missiles AddClassRelationship( CLASS_MISSILE, D_HT, 5 ); m_spawnflags |= SF_NPC_LONG_RANGE; m_flReloadedTime = gpGlobals->curtime; InitBoneControllers(); NPCInit(); SetBoneController( MD_BC_YAW, 10 ); SetBoneController( MD_BC_PITCH, 0 ); SetBodygroup( 1, 1 ); SetBodygroup( 2, 1 ); SetBodygroup( 3, 1 ); SetBodygroup( 4, 1 ); m_NPCState = NPC_STATE_IDLE; }
//----------------------------------------------------------------------------- // Purpose: //----------------------------------------------------------------------------- void CNPC_Ichthyosaur::Spawn( void ) { Precache(); SetModel( ICHTHYOSAUR_MODEL ); SetHullType(HULL_LARGE_CENTERED); SetHullSizeNormal(); SetDefaultEyeOffset(); SetNavType( NAV_FLY ); m_NPCState = NPC_STATE_NONE; SetBloodColor( BLOOD_COLOR_RED ); m_iHealth = sk_ichthyosaur_health.GetFloat(); m_iMaxHealth = m_iHealth; m_flFieldOfView = -0.707; // 270 degrees SetDistLook( 1024 ); SetSolid( SOLID_BBOX ); AddSolidFlags( FSOLID_NOT_STANDABLE ); SetMoveType( MOVETYPE_STEP ); AddFlag( FL_FLY | FL_STEPMOVEMENT ); m_flGroundSpeed = ICH_SWIM_SPEED_RUN; m_bIgnoreSurface = false; m_flSwimSpeed = 0.0f; m_flTailYaw = 0.0f; m_flTailPitch = 0.0f; m_flNextBiteTime = gpGlobals->curtime; m_flHoldTime = gpGlobals->curtime; m_flNextPingTime = gpGlobals->curtime; m_flNextGrowlTime = gpGlobals->curtime; #if FEELER_COLLISION Vector forward; GetVectors( &forward, NULL, NULL ); m_vecCurrentVelocity = forward * m_flGroundSpeed; #endif //SetTouch( IchTouch ); CapabilitiesClear(); CapabilitiesAdd( bits_CAP_MOVE_FLY | bits_CAP_INNATE_MELEE_ATTACK1 ); NPCInit(); //m_pSwimSound = ENVELOPE_CONTROLLER.SoundCreate( edict(), CHAN_BODY, "xxxCONVERTTOGAMESOUNDS!!!npc/ichthyosaur/ich_amb1wav", ATTN_NORM ); //m_pVoiceSound = ENVELOPE_CONTROLLER.SoundCreate( edict(), CHAN_VOICE, "xxxCONVERTTOGAMESOUNDS!!!npc/ichthyosaur/water_breathwav", ATTN_IDLE ); //ENVELOPE_CONTROLLER.Play( m_pSwimSound, 1.0f, 100 ); //ENVELOPE_CONTROLLER.Play( m_pVoiceSound,1.0f, 100 ); BaseClass::Spawn(); }
//----------------------------------------------------------------------------- // Purpose: //----------------------------------------------------------------------------- void CNPC_PoisonZombie::Spawn( void ) { Precache(); m_fIsTorso = m_fIsHeadless = false; #ifdef HL2_EPISODIC SetBloodColor( BLOOD_COLOR_ZOMBIE ); #else SetBloodColor( BLOOD_COLOR_YELLOW ); #endif // HL2_EPISODIC m_iHealth = sk_zombie_poison_health.GetFloat(); m_flFieldOfView = 0.2; CapabilitiesClear(); CapabilitiesAdd( bits_CAP_MOVE_GROUND | bits_CAP_INNATE_MELEE_ATTACK1 | bits_CAP_INNATE_RANGE_ATTACK1 | bits_CAP_INNATE_RANGE_ATTACK2 ); BaseClass::Spawn(); CPASAttenuationFilter filter( this, ATTN_IDLE ); m_pFastBreathSound = ENVELOPE_CONTROLLER.SoundCreate( filter, entindex(), CHAN_ITEM, "NPC_PoisonZombie.FastBreath", ATTN_IDLE ); ENVELOPE_CONTROLLER.Play( m_pFastBreathSound, 0.0f, 100 ); CPASAttenuationFilter filter2( this ); m_pSlowBreathSound = ENVELOPE_CONTROLLER.SoundCreate( filter2, entindex(), CHAN_ITEM, "NPC_PoisonZombie.Moan1", ATTN_NORM ); ENVELOPE_CONTROLLER.Play( m_pSlowBreathSound, BREATH_VOL_MAX, 100 ); int nCrabs = m_nCrabCount; if ( !nCrabs ) { nCrabs = MAX_CRABS; } m_nCrabCount = 0; // // Generate a random set of crabs based on the crab count // specified by the level designer. // int nBits[] = { // One bit 0x01, 0x02, 0x04, // Two bits 0x03, 0x05, 0x06, }; int nBitMask = 7; if (nCrabs == 1) { nBitMask = nBits[random->RandomInt( 0, 2 )]; } else if (nCrabs == 2) { nBitMask = nBits[random->RandomInt( 3, 5 )]; } for ( int i = 0; i < MAX_CRABS; i++ ) { EnableCrab( i, ( nBitMask & ( 1 << i ) ) != 0 ); } }
void CNPC_Portal_GroundTurret::Spawn( void ) { Precache(); UTIL_SetModel( this, "models/combine_turrets/ground_turret.mdl" ); SetNavType( NAV_FLY ); SetSolid( SOLID_VPHYSICS ); SetBloodColor( DONT_BLEED ); m_iHealth = 125; m_flFieldOfView = cos( ((m_fViewconeDegrees / 2.0f) * M_PI / 180.0f) ); m_NPCState = NPC_STATE_NONE; m_vecSpread.x = 0.5; m_vecSpread.y = 0.5; m_vecSpread.z = 0.5; CapabilitiesClear(); AddEFlags( EFL_NO_DISSOLVE ); NPCInit(); CapabilitiesAdd( bits_CAP_SIMPLE_RADIUS_DAMAGE ); m_iAmmoType = GetAmmoDef()->Index( "PISTOL" ); m_pSmoke = NULL; m_bHasExploded = false; m_bEnabled = false; if( ai_newgroundturret.GetBool() ) { m_flSensingDist = 384; SetDistLook( m_flSensingDist ); } else { m_flSensingDist = 2048; } if( !GetParent() ) { DevMsg("ERROR! npc_ground_turret with no parent!\n"); UTIL_Remove(this); return; } m_flTimeNextShoot = gpGlobals->curtime; m_flTimeNextPing = gpGlobals->curtime; m_vecClosedPos = GetAbsOrigin(); StudioFrameAdvance(); Vector vecPos; GetAttachment( "eyes", vecPos ); SetViewOffset( vecPos - GetAbsOrigin() ); GetAttachment( "light", vecPos ); m_vecLightOffset = vecPos - GetAbsOrigin(); }
//----------------------------------------------------------------------------- // Purpose: //----------------------------------------------------------------------------- void CNPC_Combine_Cannon::Spawn( void ) { Precache(); /// HACK: SetModel( "models/combine_soldier.mdl" ); // Setup our ancillary beams but keep them hidden for now CreateLaser(); CreateAncillaryBeams(); m_iAmmoType = GetAmmoDef()->Index( "CombineHeavyCannon" ); SetHullType( HULL_HUMAN ); SetHullSizeNormal(); UTIL_SetSize( this, Vector( -16, -16 , 0 ), Vector( 16, 16, 64 ) ); SetSolid( SOLID_BBOX ); AddSolidFlags( FSOLID_NOT_STANDABLE ); SetMoveType( MOVETYPE_FLY ); m_bloodColor = DONT_BLEED; m_iHealth = 10; m_flFieldOfView = DOT_45DEGREE; m_NPCState = NPC_STATE_NONE; if( HasSpawnFlags( SF_STARTDISABLED ) ) { m_fEnabled = false; } else { m_fEnabled = true; } CapabilitiesClear(); CapabilitiesAdd( bits_CAP_INNATE_RANGE_ATTACK1 | bits_CAP_SIMPLE_RADIUS_DAMAGE ); m_HackedGunPos = Vector ( 0, 0, 0 ); AddSpawnFlags( SF_NPC_LONG_RANGE | SF_NPC_ALWAYSTHINK ); NPCInit(); // Limit our look distance SetDistLook( m_flSightDist ); AddEffects( EF_NODRAW ); AddSolidFlags( FSOLID_NOT_SOLID ); // Point the cursor straight ahead so that the sniper's // first sweep of the laser doesn't look weird. Vector vecForward; AngleVectors( GetLocalAngles(), &vecForward ); m_vecPaintCursor = GetBulletOrigin() + vecForward * 1024; // none! GetEnemies()->SetFreeKnowledgeDuration( 0.0f ); GetEnemies()->SetEnemyDiscardTime( 2.0f ); m_flTimeLastAttackedPlayer = 0.0f; }
//----------------------------------------------------------------------------- // Purpose: //----------------------------------------------------------------------------- void CNPC_Crow::Spawn( void ) { BaseClass::Spawn(); #ifdef _XBOX // Always fade the corpse AddSpawnFlags( SF_NPC_FADE_CORPSE ); #endif // _XBOX char *szModel = (char *)STRING( GetModelName() ); if (!szModel || !*szModel) { szModel = "models/crow.mdl"; SetModelName( AllocPooledString(szModel) ); } Precache(); SetModel( szModel ); m_iHealth = sk_crow_health.GetFloat(); SetHullType(HULL_TINY); SetHullSizeNormal(); SetSolid( SOLID_BBOX ); SetMoveType( MOVETYPE_STEP ); m_flFieldOfView = VIEW_FIELD_FULL; SetViewOffset( Vector(6, 0, 11) ); // Position of the eyes relative to NPC's origin. m_flGroundIdleMoveTime = gpGlobals->curtime + random->RandomFloat( 0.0f, 5.0f ); SetBloodColor( BLOOD_COLOR_RED ); m_NPCState = NPC_STATE_NONE; m_nMorale = random->RandomInt( 0, 12 ); SetCollisionGroup( HL2COLLISION_GROUP_CROW ); CapabilitiesClear(); bool bFlying = ( ( m_spawnflags & SF_CROW_FLYING ) != 0 ); SetFlyingState( bFlying ? FlyState_Flying : FlyState_Walking ); // We don't mind zombies so much. They smell good! AddClassRelationship( CLASS_ZOMBIE, D_NU, 0 ); m_bSoar = false; m_bOnJeep = false; m_flSoarTime = gpGlobals->curtime; NPCInit(); m_iBirdType = BIRDTYPE_CROW; m_vLastStoredOrigin = vec3_origin; m_flLastStuckCheck = gpGlobals->curtime; m_flDangerSoundTime = gpGlobals->curtime; SetGoalEnt( NULL ); }