Skip to content

Lieut. support bots shouldn't fail to choose loadout #1619

@Rainyan

Description

@Rainyan

Build Info

4228d58

Description

When a support bot in CTG mode first reaches the lieutenant rank, for some reason they may attempt to pick a loadoutNumber loadout slot from s_LoadoutWeapons larger than the one of the PZ, which is the largest valid loadout value for supports. This leads to the bot requesting for the weapon named "weapon_empty".

Callstack:

 	server.dll!CNEO_Player::RequestSetLoadout(int loadoutNumber) Line 290	C++
>	server.dll!CNEO_Player::Spawn() Line 609	C++
 	server.dll!NextBotPlayer<CNEO_Player>::Spawn() Line 653	C++
 	server.dll!CNEOBot::Spawn() Line 640	C++
 	server.dll!CNEORules::StartNextRound() Line 2644	C++
 	server.dll!CNEORules::Think() Line 1205	C++
 	server.dll!CGameRules::FrameUpdatePostEntityThink() Line 614	C++
 	server.dll!CMultiplayRules::FrameUpdatePostEntityThink() Line 437	C++
 	server.dll!InvokePerFrameMethod(void(IGameSystemPerFrame::*)() f, const char * timed) Line 377	C++
 	server.dll!IGameSystem::FrameUpdatePostEntityThinkAllSystems() Line 338	C++
 	server.dll!CServerGameDLL::GameFrame(bool simulating) Line 1283	C++
 	[External Code]	

with locals:

+		this	0x0000023f7e272710 {m_bOnTarget=true m_qPrevShouldAim=ANSWER_YES (1) m_flLastShouldAimTime=1032.29993 ...}	CNEO_Player * {CNEOBot}
		classChosen	2	int
		iLoadoutClass	2	const int
		loadoutNumber	11	int
+		pEnt	{...}	CHandle<CBaseEntity>
+		pNeoWeapon	0xcccccccccccccccc {m_bWeaponIsLowered=??? m_weaponHandling={weaponID=??? spreadInfo=0xccccccccccccd41c {...} ...} ...}	CNEOBaseCombatWeapon *
+		pszWepName	0x0000023f29d69ae8 "weapon_empty"	const char *
		result	true (204)	bool
		retAssert	SPEW_DEBUGGER (0)	SpewRetval_t

Notice loadoutNumber being 11 (I also spotted the value 10 on another run).

To Reproduce

// load some CTG map
map ntre_saitama_ctg;

// join spectator, and let the bots join the match

// increase the round limit so the map won't change too soon
neo_round_limit 99;

// increase match speed, and wait for a support to gain the lieutenant rank
host_timescale 10;

Expected behavior

The lieutenant support picks a valid weapon loadout, and the below assertion/warning is not hit.

Actual behavior

The lieutenant support picks an incorrect loadout value, and the assertion fails:

if (!pEnt)
{
Assert(false);
Warning("NULL Ent in GiveLoadoutWeapon!\n");
return;
}

Operating System

  • Windows
  • Linux

Version/Distro

11

Additional context and Screenshots

  • I happened to stumble upon this with the commit 4228d58 during unrelated code review, so that's the build info reported, but I highly suspect this bug also exists in current master eae0d51.

  • Likely not limited to CTG mode, but I haven't tested it with other game modes.

Metadata

Metadata

Assignees

No one assigned

    Labels

    BotsRelated to bot playersBug ReportBug Reports made through the "Report Issue" interface in GitHub.

    Type

    Projects

    Status

    No status

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions