void asw_drone_cycle_f() { CBaseEntity* pEntity = NULL; while ((pEntity = gEntList.FindEntityByClassname( pEntity, "asw_drone" )) != NULL) { CAI_BaseNPC* pAI = dynamic_cast<CAI_BaseNPC*>(pEntity); if (pAI) { Msg("[%d:%s] Cycle=%f", pAI->entindex(), pAI->GetClassname(), pAI->GetCycle()); int iLayers = pAI->GetNumAnimOverlays(); for (int i=0;i<iLayers;i++) { Msg(" L%d: Cycle=%f Weight=%f\n", i, pAI->GetLayerCycle(i), pAI->GetLayerWeight(i)); } } } }
//========================================================= // Crea un Zombi. //========================================================= CAI_BaseNPC *CDirectorSpawn::MakeNPC(bool Horde, bool disclosePlayer, bool checkRadius) { // Desactivado // Esta entidad no funciona en Multiplayer. if ( Disabled ) return NULL; // Seleccionamos una clase de NPC para crear. const char *pClass = SelectRandom(); CAI_BaseNPC *pNPC = VerifyClass(pClass); // Emm... ¿puso todas las clases en "no crear"? :genius: if ( !pNPC ) { Warning("[DIRECTOR SPAWN] Ha ocurrido un problema al intentar crear un NPC. \r\n"); return NULL; } Vector origin; // Verificamos si podemos crear un zombi en el radio. if ( checkRadius ) { if ( !CanMakeNPC(pNPC, &origin) ) return NULL; } // Lugar de creación. pNPC->SetAbsOrigin(origin); QAngle angles = GetAbsAngles(); angles.x = 0.0; angles.z = 0.0; pNPC->SetAbsAngles(angles); // Tiene que caer al suelo. pNPC->AddSpawnFlags(SF_NPC_FALL_TO_GROUND); // Su cuerpo tiene que desaparecer al morir. pNPC->AddSpawnFlags(SF_NPC_FADE_CORPSE); // Creamos al NPC, le decimos quien es su dios (creador) y lo activamos. DispatchSpawn(pNPC); pNPC->SetOwnerEntity(this); DispatchActivate(pNPC); // Al parecer se atoro en una pared. if ( !PostSpawn(pNPC) ) return NULL; // Nombre del NPC. pNPC->SetName(MAKE_STRING(CHILD_NAME)); #ifdef APOCALYPSE // Skin al azar. if ( pNPC->GetClassname() == "npc_zombie" ) pNPC->m_nSkin = random->RandomInt(1, 4); #endif // Es un NPC para la horda ¡woot! if ( Horde ) { AddHealth(pNPC); #ifdef APOCALYPSE // Más rápido. pNPC->SetAddAccel(40); // No colisiona con otros NPC's. (Zombis) if ( random->RandomInt(1, 4) == 2 ) pNPC->SetCollisionGroup(COLLISION_GROUP_SPECIAL_NPC); #endif } // Debe conocer la ubicación del jugador (Su enemigo) if ( disclosePlayer ) { CIN_Player *pPlayer = UTIL_GetRandomInPlayer(); if ( pPlayer ) pNPC->UpdateEnemyMemory(pPlayer, pPlayer->GetAbsOrigin()); } Childs++; ChildsAlive++; LastSpawn = gpGlobals->curtime; OnSpawnNPC.FireOutput(pNPC, this); return pNPC; }