Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Spy disguise name choice #368

Open
squeek502 opened this issue May 21, 2019 · 1 comment

Comments

Projects
None yet
2 participants
@squeek502
Copy link
Member

commented May 21, 2019

From Discord:

Have you considered adding the name for the person when disguised, so they know who to avoid.

me:

havent considered that about spy, would make sense

hm, actually looking at the code the name shown could possibly be different between players
so that would need to change too

it kind of does things in a silly way, could definitely be improved
if there's a player that is the class you're disguised as on the team, then the name shown is always the first match found, if there's no player with the class then it chooses a random player on that team
not very spy-friendly since it doesn't randomly pick between multiple players with the same class

Relevant code:

// Change name (if we can) to someone on the team iTeam
// that is playing the class this guy is disguised as
// Gonna generate an array of people on the team we're disguised as
// in case we have to randomly pick a name later
int iPlayers[ 128 ], iCount = 0;
bool bDone = false;
for( int i = 1; ( i < gpGlobals->maxClients ) && ( !bDone ); i++ )
{
// Skip this spy - kind of useless if it tells us
// our real name, eh? Using our real name is a last resort
if( i == pHitPlayer->index )
continue;
if( pGR->IsConnected( i ) )
{
// If the guy's on the team we're disguised as...
if( pGR->GetTeam( i ) == m_iTeam )
{
// Store off the player index since we found
// someone on the team we're disguised as
iPlayers[ iCount++ ] = i;
// If the guy's playing as the class we're disguised as...
if( pGR->GetClass( i ) == m_iClass )
{
// We're stealing this guys name
Q_strcpy( szName, pGR->GetPlayerName( i ) ) ;
bDone = true; // bail
}
}
}
}
// If no one was on the other team, add the real name
// to the array of possible choices
if( iCount == 0 )
iPlayers[ iCount++ ] = pHitPlayer->index;
// We iterated around and found no one on the team we're disguised as
// playing as the class we're disguised as so just pick a guy from
// the team we're disguised as (or use real name if iCount was 0)
if( !bDone )
{
// So we got an array of indexes to players of whom we can steal
// their name, so randomly steal one
Q_strcpy( szName, pGR->GetPlayerName( iPlayers[ random->RandomInt( 0, iCount - 1 ) ] ) );
}
// Store off the spies name, class & team in case we ID him again
// and he hasn't changed disguise
pPlayer->m_hSpyTracking[ pHitPlayer->index ].Set( szName, m_iTeam, m_iClass );

@ndo360

This comment has been minimized.

Copy link

commented May 21, 2019

So far the ideal system would be the following:

Disguising as an enemy.

  1. If a spy disguises as a enemy class, and someone on the other team matches that class. The spy gets their name, or one of the names if there is more than one. (Anyone looking at said Spy from the enemy team, will see the name he got.)

  2. If no players on the enemy team are the class the Spy has chosen, then they are randomly assigned an enemy name. (Anyone looking at said Spy from the enemy team, will see the name he got.)

  3. If there is no one on the enemy team, the spy is assigned their name. (Safety net to avoid errors, last resort. Have a console error alert the spy or something so developers will know via bug reports.)

For disguising as friendlies:

  1. If a spy disguises as a class, and someone on their own team is that class. You get their name, or one of the names if there is more than one players as the class he chose. (Anyone looking at said Spy from the enemy team, will see the name he got. Friendly's will see the spy icon, and the player's name.)

  2. If no players on the enemy team are the class the Spy has chosen, then he are assigned their own name. (This will ensure your cover is the best it can be, even when posing as an ally. This doesn't have the downside of 'Checking the leader board to see if that person is on my team' that disguising as an enemy has.)

Any thoughts form others?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.