Game Stuff
You can join and then control a game with 100% coverage.
Joining
This is obviously what you have to do first, which you can do in 2 ways:
[async] bot.createPrivateGame
Creates a private game with a specified region, mode, and map.
You can find a region list from the matchmaker guide. Modes can be found using the GameMode constant. Maps can be found using the Map constant. It’s just the map name.
[async] bot.initMatchmaker
This manually creates of a Matchmaker on a Bot. This is useful for finding public games.
You should, if logging in and attempting to find a publix game:
- Create a bot with
new Bot()
- Call
bot.login()
with the proper credentials - Call
bot.initMatchmaker()
- Call
bot.matchmaker.findPublicGame()
- Call
bot.join(name, code)
There are several important things about the matchmaker that don’t relate, so let’s use a bullet pointed list:
- If you don’t login before using initMatchmaker, it will first create an anonymous account, attach the anon account to the bot, then use that anon account until you call
login()
. This is why you should really calllogin()
first. - The matchmaker will use the proxy you used to create the bot.
- The Matchmaker will disconnect & (temporarily?) blacklist you if you spam
findPublicGame
on the same proxy ~10 times. - This will automatically be run anytime you use
bot.join()
orbot.createPrivateGame()
, so you don’t need to call this unless you’re doing something special (e.g. finding a public game and joining it).
[async] bot.join
Join a public game with the provided game code.
You can also pass a result directly from the Matchmaker:
bot.game
This has various information about the current game.
bot.game.code
- the game code of the gamebot.game.gameMode
- the game mode of the game (instanceof GameMode)bot.game.map
- the map of the game (instanceof Map)bot.game.playerLimit
- the player limit of the gamebot.game.isGameOwner
- if the bot is the game ownerbot.game.isPrivate
- if the game is privatebot.game.options
- the options of the gamebot.game.options.gravity
- the gravity of the gamebot.game.options.damage
- the damage of the gamebot.game.options.healthRegen
- the health regen of the gamebot.game.options.locked
- if the game is lockedbot.game.options.noTeamChange
- if the game has no team changebot.game.options.noTeamShuffle
- if the game has no team shufflebot.game.options.weaponsDisabled
- the weapons disabled in the game - in the order of GunList - 1 = disabled, 0 = enabledbot.game.options.mustUseSecondary
- if the player must use the secondary weapon due to all weapons being disabled
bot.game.teamScore
- the team score of the gamebot.game.spatula
- the spatula of the gamebot.game.spatula.coords
- the coords of the spatulabot.game.spatula.controlledBy
- the player id controlling the spatulabot.game.spatula.controlledByTeam
- the team controlling the spatula
bot.game.stage
- the stage of the game (instanceof CoopStates)bot.game.zoneNumber
- the active coop zone numberbot.game.activeZone
- an array of x/y/z coord objects that the current zone consists ofbot.game.capturing
- the users capturing the coopbot.game.captureProgress
- a number 1-1000 that signifies the progress of the capturebot.game.numCapturing
- the number of players capturingbot.game.stageName
- the name of the game stage (asbot.game.stage
is a number)bot.game.capturePercent
- the capture percent of the game (asbot.game.captureProgress
is a number, this is for convenience)bot.game.collectables
- an array with index 0 as an ammo array and index 1 as a grenade array — each ammo has an ID and an x/y/z coord
Game Actions
Here are some things you can do inside of a game.
bot.dispatch
Allows you to dispatch an action.
This is how you do most things. Read the dispatch guide for more information.
bot.quit
This closes the connection to the game, the matchmaker, and runs various cleanup functions.
Cleanup includes deleting things that are heavy on memory (like bot.account
, bot.game
, bot.players
, etc). That might not be something you want. If so, pass the first argument as true
to bot.quit
(so bot.quit(true)
).
Utilities
These are utilities that can be used in a game.
bot.canSee
This allows you to check if the bot can see a player.
The first argument is a GamePlayer
from bot.players
.
bot.getBestTarget
Returns the closest player that is in the bot’s LoS. Returns null
if no one is in the bot’s LoS.
bot.players
bot.players
is an array of players that have information about each player.
bot.players
object that represents you.bot.players[i].id
- the id of the player relative to the players- IDs are the index of
bot.players
the bot is - for example, ID 3 would be
bot.players[3]
- IDs are the index of
bot.players[i].team
- the team the player is onbot.players[i].name
- the name of the playerbot.players[i].uniqueId
- the unique id of the playerbot.players[i].position
- the position of the playerbot.players[i].position.x
- the x position of the playerbot.players[i].position.y
- the y position of the playerbot.players[i].position.z
- the z position of the player
bot.players[i].view
- the view of the playerbot.players[i].view.yaw
- the yaw of the playerbot.players[i].view.pitch
- the pitch of the player
bot.players[i].jumping
- if the player is jumpingbot.players[i].climbing
- if the player is climbingbot.players[i].character
- the character of the playerbot.players[i].character.eggColor
- the color of the player’s eggbot.players[i].character.primaryGun
- the primary gun of the playerbot.players[i].character.secondaryGun
- the secondary gun of the playerbot.players[i].character.stamp
- the stamp of the playerbot.players[i].character.hat
- the hat of the playerbot.players[i].character.grenade
- the grenade of the playerbot.players[i].character.melee
- the melee of the player
bot.players[i].activeGun
- the active gun of the player (primary or secondary)bot.players[i].selectedGun
- the selected gun of the player (eggk, crackshot, etc)bot.players[i].weapons
- the weapons of the playerbot.players[i].grenades
- the number of grenades the player hasbot.players[i].streak
- the killstreak of the playerbot.players[i].hp
- the health of the playerbot.players[i].hpShield
- the shield of the playerbot.players[i].streakRewards
- the rewards the player has for their streak - a list of the StreakRewards constantbot.players[i].socials
- an array of the player’s socials (twitch, youtube, tiktok, etc) withid
,url
,type
, andactive
properties. it will be null for players without any socials (average person)bot.players[i].isVip
- is the player wasting $5/month?bot.players[i].showBadge
- whether or not to show the badge of the player (either a social or the VIP badge)
Misc Attributes
Here are some extra attributes that you might want to note:
bot.pathing.followingPath
- if the bot is following a path- setting this to false/true can pause/“play” pathfinding
- there’s a lot more on
bot.pathing
, but it’s mostly for advanced users
bot.ping
- the websocket latency (ping)bot.matchmaker
- an instance of matchmaker that uses the bot’s proxy & auth