/Custom-Gmod-Bot

Originally a personal gmod bot that I decided to make public.

Primary LanguageLuaApache License 2.0Apache-2.0

Use

  • Install this addon: Place the Custom Gmod Bot folder (Unzipped) in your gmod addons folder OR install the addon with Steam.
  • Create an (at least) 2-player gmod server. This addon creates a "player" bot so you must have an open player spot because gmod will consider the bot a real player.
  • Create a bot using the TRizzleCreateBot Command. (See below)

This addon is on Steam, you can download it there instead: https://steamcommunity.com/sharedfiles/filedetails/?id=2969405101

Important contributions welcome HitCount

This mod is in Beta, there will be bugs, but constant updates with new features and fixes.

Although you can just clone the repository. (I will put updates into a secondary branch before releasing it) I would suggest downloading the latest release, Thank You!

Special thanks to Zenlenafelex [PSF] for helping me with the pathfinding code for the bot.

Why I made this mod

I made this because I usually have to play Gmod alone and I also wanted to see what I could do with the nextbot system. This is also a base bot addon, I will use this addon to make bots for other gamemodes.

Commands

CommandName, CommandParameters, Example

  • TRizzleCreateBot botname followdist dangerdist meleedist pistoldist shotgundist rifledist healthreshold combathealthreshold playermodel spawnwithpreferredweapons
    • TRizzleCreateBot Bot 200 300 80 1300 300 900 100 25 alyx 1
  • TBotSetFollowDist targetbot followdist
    • TBotSetFollowDist Bot 200
  • TBotSetDangerDist targetbot dangerdist
    • TBotSetDangerDist Bot 300
  • TBotRegisterWeapon weapon weaponType hasScope hasSecondaryAttack SecondaryAttackCooldown maxStoredAmmo ignoreAutomaticRange ReloadsSingly
    • TBotRegisterWeapon weapon_crossbow Sniper true false 30.0 12 false false
  • TBotAddPreferredWeapon targetbot weapon
    • TBotAddPreferredWeapon Bot weapon_crossbow
  • TBotRemovePreferredWeapon targetbot weapon
    • TBotRemovePreferredWeapon Bot weapon_crossbow
  • TBotClearPreferredWeaponList targetbot
    • TBotAddPreferredWeapon Bot
  • TBotSetMeleeDist targetbot meleedist
    • TBotSetMeleeDist Bot 80
  • TBotSetPistolDist targetbot pistoldist
    • TBotSetPistolDist Bot 1300
  • TBotSetShotgunDist targetbot shotgundist
    • TBotSetShotgunDist Bot 300
  • TBotSetRifleDist targetbot rifledist
    • TBotSetRifleDist Bot 900
  • TBotSetHealThreshold targetbot healthreshold
    • TBotSetHealThreshold Bot 100
  • TBotSetCombatHealThreshold targetbot combathealthreshold
    • TBotSetCombatHealThreshold Bot 25
  • TBotSetPlayerModel targetbot playermodel
    • TBotSetPlayerModel Bot alyx
  • TBotSpawnWithPreferredWeapons targetbot 1 or 0
    • TBotSpawnWithPreferredWeapons Bot 1
  • TBotSetModelSkin targetbot desiredskin
    • TBotSetModelSkin Bot 0
  • TBotSetModelBodyGroup targetbot row number
    • TBotSetModelBodyGroup Bot 0 0
  • TBotSetDefault targetbot
    • TBotSetDefault Bot

Current Features

  • The bot is a player bot
  • The bot can use ladders
  • The bot has "smooth aiming" (Won't instantly aim at enemies)
  • The bot can open doors
  • The bot has a LOS, "Line of Sight," and can't see behind itself
  • The bot remembers enemies it has seen recently
  • The bot can "hear" noises created by enemies
  • The bot will use its flashlight when in a dark area
  • The bot will attack any NPC that is hostile to them and its "owner" (The player that created it)
  • The bot, if it has a medkit, will heal itself and any players nearby it, prioritizing its owner.
  • The bot can enter the vehicle the bot's owner is in. This includes most modded vehicles and chairs. See "Issues"
  • Support for most custom/modded weapons.

Bot Cheats

I know what you are thinking, but these are needed to make the bot fun and easy to use.

  • The bot will slowly regenerate ammo for its weapons when not in combat. This prevents the player from having to "give" the bot ammo or it having to be programmed to "find" ammo. (Collect it from dead enemies)

Issues

  • The bot doesn't know if a Nextbot is hostile or friendly.
  • The bot has very basic driving support.
  • The bot can't tell the difference between projectile and tracer, "bullet," weapons.

Planned Features