void COsprey :: DeployThink( void ) { UTIL_MakeAimVectors( pev->angles ); Vector vecForward = gpGlobals->v_forward; Vector vecRight = gpGlobals->v_right; Vector vecUp = gpGlobals->v_up; Vector vecSrc; TraceResult tr; UTIL_TraceLine( pev->origin, pev->origin + Vector( 0, 0, -4096.0), ignore_monsters, ENT(pev), &tr); CSoundEnt::InsertSound ( bits_SOUND_DANGER, tr.vecEndPos, 400, 0.3 ); vecSrc = pev->origin + vecForward * 32 + vecRight * 100 + vecUp * -96; m_hRepel[0] = MakeGrunt( vecSrc ); vecSrc = pev->origin + vecForward * -64 + vecRight * 100 + vecUp * -96; m_hRepel[1] = MakeGrunt( vecSrc ); vecSrc = pev->origin + vecForward * 32 + vecRight * -100 + vecUp * -96; m_hRepel[2] = MakeGrunt( vecSrc ); vecSrc = pev->origin + vecForward * -64 + vecRight * -100 + vecUp * -96; m_hRepel[3] = MakeGrunt( vecSrc ); SetThink(&COsprey :: HoverThink ); SetNextThink( 0.1 ); }
void COsprey :: DeployThink( void ) { UTIL_MakeAimVectors( GetAbsAngles() ); Vector vecForward = gpGlobals->v_forward; Vector vecRight = gpGlobals->v_right; Vector vecUp = gpGlobals->v_up; Vector vecSrc; TraceResult tr; UTIL_TraceLine( GetAbsOrigin(), GetAbsOrigin() + Vector( 0, 0, -4096.0), ignore_monsters, ENT(pev), &tr); CSoundEnt::InsertSound ( bits_SOUND_DANGER, tr.vecEndPos, 400, 0.3 ); vecSrc = GetAbsOrigin() + vecForward * 32 + vecRight * 100 + vecUp * -96; m_hRepel[0] = MakeGrunt( vecSrc ); vecSrc = GetAbsOrigin() + vecForward * -64 + vecRight * 100 + vecUp * -96; m_hRepel[1] = MakeGrunt( vecSrc ); vecSrc = GetAbsOrigin() + vecForward * 32 + vecRight * -100 + vecUp * -96; m_hRepel[2] = MakeGrunt( vecSrc ); vecSrc = GetAbsOrigin() + vecForward * -64 + vecRight * -100 + vecUp * -96; m_hRepel[3] = MakeGrunt( vecSrc ); SetThink( HoverThink ); pev->nextthink = gpGlobals->time + 0.1; }
//========================================================= // Crea un Zombi. //========================================================= CAI_BaseNPC *CSurvivalZombieSpawn::MakeNPC() { // Desactivado if ( Disabled || !sv_spawn_zombies.GetBool() ) return NULL; // Seleccionamos una clase de zombi para crear. const char *pZombieClass = SelectRandomZombie(); // El elegido es un Grunt. if ( pZombieClass == "npc_grunt" ) return MakeGrunt(); // Creamos al zombi. CAI_BaseNPC *pZombie = (CAI_BaseNPC *)CreateEntityByName(pZombieClass); // Emm... ¿puso todas las clases en "no crear"? :genius: if ( !pZombie ) { Warning("[SURVIVAL ZOMBIE MAKER] Ha ocurrido un problema al intentar crear un zombie. \r\n"); return NULL; } Vector origin; if ( !CanMakeNPC(pZombie, &origin) ) return NULL; // Lugar de creación. pZombie->SetAbsOrigin(origin); // Nombre del zombie. // [¡NO CAMBIAR!] Es utilizado por otras entidades para referirse a los zombis creados por esta entidad. pZombie->SetName(MAKE_STRING("survival_zombie")); QAngle angles = GetAbsAngles(); angles.x = 0.0; angles.z = 0.0; pZombie->SetAbsAngles(angles); // Tiene que caer al suelo. pZombie->AddSpawnFlags(SF_NPC_FALL_TO_GROUND); // Su cuerpo tiene que desaparecer al morir. pZombie->AddSpawnFlags(SF_NPC_FADE_CORPSE); // No colisionan con otros NPC's. (Zombis) if ( random->RandomInt(1, 3) == 2 ) pZombie->SetCollisionGroup(COLLISION_GROUP_SPECIAL_NPC); // Creamos al zombi, le decimos quien es su dios (creador) y lo activamos. DispatchSpawn(pZombie); pZombie->SetOwnerEntity(this); DispatchActivate(pZombie); // Skin al azar. pZombie->m_nSkin = random->RandomInt(1, 4); Childs++; ChildsAlive++; LastSpawn = gpGlobals->curtime; OnSpawnZombie.FireOutput(pZombie, this); return pZombie; }