Skip to content

Bots loot weapons they could not select on spawn due to class restrictions#1997

Open
sunzenshen wants to merge 2 commits into
NeotokyoRebuild:masterfrom
sunzenshen:bot-pickup-other-class-weps
Open

Bots loot weapons they could not select on spawn due to class restrictions#1997
sunzenshen wants to merge 2 commits into
NeotokyoRebuild:masterfrom
sunzenshen:bot-pickup-other-class-weps

Conversation

@sunzenshen

Copy link
Copy Markdown
Contributor

Description

Introduces a configuration for bots to loot weapons that they could not select on spawn due to class restrictions.

Toolchain

  • Windows MSVC VS2022

Linked Issues

corporal "jittescoped"
sergeant "zr68c"
lieutenant "supa7"
loot "zr68s mx mx_silenced aa13"

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I initially considered allowing the specification of relative class-exclusive weapon preferences by ranking, but having that level of control turned out to be both messy, and in my opinion not that useful.

One can see the prototype for the rank-specific preference here in this earlier commit:
66f7eaf

It seems easier to just assume that any class-exclusive looting preferences should apply to the LT level, mostly because when I tried to come up with initial configurations I ended up putting most preferences at the LT level anyway.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also for reference, since I needed to consider whether selections would have been redundant and already possible with #1800, these are the weapons that each class can never select even if they were LT rank:

Recon:

  • ZR suppressed
  • MX
  • MX suppressed
  • SRS
  • AA13

Assault:

  • SRM suppressed
  • Jitte suppressed
  • ZR68 scoped
  • PZ

Support:

  • SRM suppressed
  • Jitte suppresed
  • ZR suppressed
  • ZR scoped
  • SRS
  • AA13

For testing, the permutations are kind of tricky, but a basic test is to set all bots to Recon with bot_class 0, spawn as an Assault with a ZR suppressed, and throw it at a friendly recon bot. Before with #1800 the bots would not consider the swap.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Was wondering why it's all tied to LT rank but checking GetBotWeaponPreferenceRank function made sense. So LGTM

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, I thought maybe bots may want to loot intermediate rank weapons at lower ranks, but in practice I didn't feel that the benefits were worth it for the extra complication of the loot preferences config population code, especially since there's already other options provided by the spawn selection preferences.

@sunzenshen sunzenshen requested a review from a team June 19, 2026 08:48
@sunzenshen sunzenshen added the Bots Related to bot players label Jun 19, 2026
@sunzenshen sunzenshen requested a review from nullsystem June 19, 2026 09:11
Comment on lines +254 to +255
const int idxLieutenant = NEO_RANK__TOTAL - 1;
pProfile->flagsLootWepPrefs[idxClass][idxLieutenant] |= lootFlags;

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nit: idxLieutenant -> IDX_LIEUTENANT

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

With other coding guidelines that I've worked under, we tended to reserve all caps for just macro definitions, though I have have also heard of capitalizing all constants in some other style guidelines.

In this case, I wanted to keep the naming similar to idxClass since it might be distracting to have them look different like,
[idxClass][IDX_LIEUTENANT]

corporal "jittescoped"
sergeant "zr68c"
lieutenant "supa7"
loot "zr68s mx mx_silenced aa13"

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Was wondering why it's all tied to LT rank but checking GetBotWeaponPreferenceRank function made sense. So LGTM

@nullsystem nullsystem requested a review from a team June 20, 2026 11:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Bots Related to bot players

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants