smilz0 / Left4Bots

Improvements for the L4D2 survivor bots
https://steamcommunity.com/sharedfiles/filedetails/?id=3022416274
34 stars 4 forks source link

Player survivors getting force-swapped away from pills/adrenaline after pickup #83

Closed Shadowysn closed 7 months ago

Shadowysn commented 7 months ago

Describe the bug Player survivors are being affected by a function meant to stop bots from eating pills/adrenaline they have been given. This can throw off player survivors who want to use newly-discovered pills/adrenaline immediately and delay them from consuming or, if they are erratic enough, even cause them to shoot unintentionally.

To Reproduce Steps to reproduce the behavior:

  1. Spawn or find pills/adrenaline on the floor.
  2. Try to use the temp health item immediately after picking it up. (Ensure you're hurt enough to use pills)

Additional context There are no IsPlayerABot checks for the function tree that causes this switch. I think ideally the bot check should be placed in the item_pickup event hook as part of the if that checks for "pain_pills" or "adrenaline" item.

::Left4Bots.Events.OnGameEvent_item_pickup -> (calls on AddTimer) ::Left4Bots.CheckBotPickup -> ::Left4Bots.BotSwitchToAnotherWeapon (uses SwitchToItem)

smilz0 commented 7 months ago

Thank you!

smilz0 commented 7 months ago

It should be fixed now. Let me know if it's not.

Shadowysn commented 6 months ago

Can confirm it's stopped swapping players to the last weapon after picking up and trying to use adrenaline/pain pills immediately. 👍