本文整理汇总了C++中CAI_BaseNPC::SetSquadName方法的典型用法代码示例。如果您正苦于以下问题:C++ CAI_BaseNPC::SetSquadName方法的具体用法?C++ CAI_BaseNPC::SetSquadName怎么用?C++ CAI_BaseNPC::SetSquadName使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CAI_BaseNPC
的用法示例。
在下文中一共展示了CAI_BaseNPC::SetSquadName方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: MakeNPC
//-----------------------------------------------------------------------------
// Purpose: Creates the NPC.
//-----------------------------------------------------------------------------
void CNPCMaker::MakeNPC( void )
{
if (!CanMakeNPC())
return;
CAI_BaseNPC *pent = (CAI_BaseNPC*)CreateEntityByName( STRING(m_iszNPCClassname) );
if ( !pent )
{
Warning("NULL Ent in NPCMaker!\n" );
return;
}
// ------------------------------------------------
// Intialize spawned NPC's relationships
// ------------------------------------------------
pent->SetRelationshipString( m_RelationshipString );
m_OnSpawnNPC.Set( pent, pent, this );
pent->SetAbsOrigin( GetAbsOrigin() );
// Strip pitch and roll from the spawner's angles. Pass only yaw to the spawned NPC.
QAngle angles = GetAbsAngles();
angles.x = 0.0;
angles.z = 0.0;
pent->SetAbsAngles( angles );
pent->AddSpawnFlags( SF_NPC_FALL_TO_GROUND );
if ( m_spawnflags & SF_NPCMAKER_FADE )
{
pent->AddSpawnFlags( SF_NPC_FADE_CORPSE );
}
pent->m_spawnEquipment = m_spawnEquipment;
pent->SetSquadName( m_SquadName );
pent->SetHintGroup( m_strHintGroup );
ChildPreSpawn( pent );
DispatchSpawn( pent );
pent->SetOwnerEntity( this );
DispatchActivate( pent );
if ( m_ChildTargetName != NULL_STRING )
{
// if I have a netname (overloaded), give the child NPC that name as a targetname
pent->SetName( m_ChildTargetName );
}
ChildPostSpawn( pent );
m_nLiveChildren++;// count this NPC
if (!(m_spawnflags & SF_NPCMAKER_INF_CHILD))
{
m_nMaxNumNPCs--;
if ( IsDepleted() )
{
m_OnAllSpawned.FireOutput( this, this );
// Disable this forever. Don't kill it because it still gets death notices
SetThink( NULL );
SetUse( NULL );
}
}
}
示例2: MakeNPC
//-----------------------------------------------------------------------------
// Purpose: Creates the NPC.
//-----------------------------------------------------------------------------
void CNPCMakerXenInvasion::MakeNPC(void)
{
if (!CanMakeNPC())
return;
if (g_pGameRules->bHasRandomized)
{
if (g_pGameRules->iRandomGamemode == FIREFIGHT_PRIMARY_XENINVASION)
{
int nNPCs = ARRAYSIZE(g_charNPCSXenInvasionSupport);
int randomChoice = rand() % nNPCs;
const char *pRandomName = g_charNPCSXenInvasionSupport[randomChoice];
CAI_BaseNPC *pent = (CAI_BaseNPC*)CreateEntityByName(pRandomName);
if (!pent)
{
Warning("npc_maker_firefight: Entity classname does not exist in database.\n");
return;
}
// ------------------------------------------------
// Intialize spawned NPC's relationships
// ------------------------------------------------
pent->SetRelationshipString(m_RelationshipString);
m_OnSpawnNPC.Set(pent, pent, this);
pent->SetAbsOrigin(GetAbsOrigin());
// Strip pitch and roll from the spawner's angles. Pass only yaw to the spawned NPC.
QAngle angles = GetAbsAngles();
angles.x = 0.0;
angles.z = 0.0;
pent->SetAbsAngles(angles);
pent->AddSpawnFlags(SF_NPC_FALL_TO_GROUND);
if (m_spawnflags & SF_NPCMAKER_FADE)
{
pent->AddSpawnFlags(SF_NPC_FADE_CORPSE);
}
pent->m_isRareEntity = false;
pent->SetSquadName(m_SquadName);
pent->SetHintGroup(m_strHintGroup);
ChildPreSpawn(pent);
DispatchSpawn(pent);
pent->SetOwnerEntity(this);
DispatchActivate(pent);
if (m_ChildTargetName != NULL_STRING)
{
// if I have a netname (overloaded), give the child NPC that name as a targetname
pent->SetName(m_ChildTargetName);
}
ChildPostSpawn(pent);
}
else
{
CAI_BaseNPC *pent = (CAI_BaseNPC*)CreateEntityByName(STRING(m_iszNPCClassname));
if (!pent)
{
Warning("npc_maker_firefight: Entity classname does not exist in database.\n");
return;
}
// ------------------------------------------------
// Intialize spawned NPC's relationships
// ------------------------------------------------
pent->SetRelationshipString(m_RelationshipString);
m_OnSpawnNPC.Set(pent, pent, this);
pent->SetAbsOrigin(GetAbsOrigin());
// Strip pitch and roll from the spawner's angles. Pass only yaw to the spawned NPC.
QAngle angles = GetAbsAngles();
angles.x = 0.0;
angles.z = 0.0;
pent->SetAbsAngles(angles);
pent->AddSpawnFlags(SF_NPC_FALL_TO_GROUND);
if (m_spawnflags & SF_NPCMAKER_FADE)
{
pent->AddSpawnFlags(SF_NPC_FADE_CORPSE);
}
pent->m_spawnEquipment = m_spawnEquipment;
pent->m_isRareEntity = false;
pent->SetSquadName(m_SquadName);
pent->SetHintGroup(m_strHintGroup);
//.........这里部分代码省略.........