Keyboard shortcuts

Press or to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

bp_ort

(bots plugin or other)

the main feature of this plugin is ofc the bots. Other features that this plugin offers :

current sq api

bots

  • void function BotSetTitan(entity bot, string titan) sets the titan type for the bot
  • void function BotSetTargetPos(entity bot, vector target) sets a goal for goal follower ai to follow
  • void function BotSetSimulationType(entity bot, int sim_type) sets the bot index for a bot (doesn’t work when called right after a bot is spawned)
  • entity ornull function BotSpawn(string bot_name) spawns a bot with a name or if it is passed with “” the name is chosen randomly
  • void function AddBotName(string bot_name) adds a bot name to the random name list
  • void function ClearBotNames() removes all bot names from the random name list (scary!)
  • var ornull function NavigationCreate(int hull)
  • void function NavigationFindPath(var nav, vector start, vector end)
  • array<vector> function NavigationGetAllPoints(var nav)
  • vector ornull function NavigationNextPoint(var nav)

Code Callback - the plugin attempts to call the following functions when the player connects which are not defined anywhere (aka you can define them)

  • string function CodeCallBack_CanChangeName(string uid, string name)
  • string function CodeCallBack_CanChangeClangTag(string uid, string clan_tag)

name overrides

  • void function RememberNameOverride(entity player, string name, string clan_tag )

the plugin stores a name and clan tag for a player internally and will set them for the player on their next connection attempt

  • void function RememberNameOverrideUid(string uid, string name, string clan_tag )

bots

bot names

so bots have “unique” names derived from contributors to northstar to make bot puns (some are just “legacy names”)

if you have a good name idea you can make a pull request or message me on discord about it

bot names can also be provided to the command that spawns the bots

bot ai

the two most useful ones would be simply standing still (0) (for testing stuff) or the combat ai (6)

the combat ai is currently very not very smart since it just chases the closest enemy and tries to kill them

important convars for bots

  • bot_cmds_type <index:int> controls which behavior is the default for the bots

  • bot_clang_tag <tag:string> the clan tag the bots get on spawn (default is BOT)

most important command

  • bot_spawn <name:int> <team:int> <ai:int> spawns a bot with a given name team or ai index

other ones are found under bot_ namespace (they are not so important)

all the ai indices

  • 0 => stand still
  • 1 => crouch rapidly
  • 2 => walk around mp_box
  • 3 => chase player0
  • 4 => shoot at closest enemy
  • 5 => shoot at closest enemy + walk to them
  • 6 => “combat ai”
  • 7 => goal follower assigned from scripts
  • 8 => headhunter ai
  • 9 => ctf ai
  • 10 => amped hardpoint ai (requires navmesh)
  • 11 => reserved
  • 12 => slow crouching
  • 13 => follows farthest player
  • 14 => follows closest player
  • 15 => smth silly idk #1
  • 16 => smth silly idk #2
  • 17 => view debugger
  • 18 => battery yoinker
  • 19 => simply embarks into their titan
  • 20 => failed slide hopping
  • 21 => peaceful goal follower
  • 22 => clear goal
  • 23 => look at goal
  • 30 => use offhand ability 0
  • 31 => use offhand ability 1
  • 32 => use offhand ability 2
  • 33 => use offhand ability 3
  • 34 => use offhand ability 4
  • 100 => experimental wallrunning ai

6, 7, 8, 9, 10, 11, 13, 14, 19, and 21 require navmesh to be present on the map otherwise the game will crash (all of the standard mp maps have navmeshes)

comments on “combat ai” and it’s derivatives

it’s a general purpose routine for the bots to follow. it’s just shoot anything or walk to the closest enemy. it does support all facets of titanfall 2 gameplay (titan calling, embarking titans, using titans, pilot combat, etc) but it’s very basic. it also has a feature to actually make them a bit fair where they will get more aim spread the faster the target moves (only for pilots). the derivations like the headhunter ai try to play the objective of the gamemode but they are not auto activated and have to be manually set via the bot_cmds_type cvar auto activation is controlled is controlled by auto_select_gamemode in the mod.

like the one before it but it now accepts a uid so that it can be set before anyone joins

btw the cvar bot_uwufy controls if connecting players will get their name uwufied (it’s disabled by default now)

BotExtras

this a optional but recommend to have script mod for this plugin. it adds extra features on top of the plugin that are simply easier to implement in scripts.

it’s most critical feature is notifying the plugin of the current selected titan for the bot and swapping loadout for bots. it also adds mod settings integration for bp_ort.

TODO move this into sub categories

bots

TODO

admin abuse

TODO

serialized_io

this is a plugin that provides serval io interactions with full serialization for any reasonable squirrel struct. this includes :

reflection

serialized_io provides a reflection api for registered squirrel structs which allows for those types to be serialized and deserialized. This is performed by calling BPRegisterType on a certain type which will then register a few register native squirrel functions for the rest of serialized_io’s api just for this type.

BPRegisterType

void functionref( string type )

Input

The type which needs to be reflected.

Errors

Will throw a script exception if the type could not get reflected. Errors will generally not be thrown since they will only occur if serialized_io finds a type that can’t be reflected.

a non exhaustive list of such types

  • entity
  • class
  • userdata
  • var
  • table (untyped)
  • array (untyped)
  • missing structs references

Usage

In your mod.json you need to add an init script with a call back to call BPRegisterType

{
  "InitScript": {
    "InitScript": "your_init_script.gnut",
    "InitScriptCallback": "InitCallback",
  }
}

and in the init script

global function InitCallback

global struct SerializableStruct {
    int a,
    string b, 
    array<string> c,
}

void function InitCallback() {
    BPRegisterType( "SerializableStruct" ) // registers the struct 
    BPRegisterType( "array< string >" ) // normal types also need to be registered
}

then the following types become available

  • BPSerialize<TypeName>
  • BPDeserialize<TypeName>
  • BPLoadFile<TypeName>
  • BPLoadFileAsync<TypeName>
  • BPSaveFile<TypeName>
  • BPSaveFileAsync<TypeName>

where TypeName is the registered type but in PascalCase

BPSerialize<TypeName>

string functionref( TypeName obj )

Serializes the type to json.

Errors

Will throw a script error if the serialization wasn’t successful.

BPDeserialize<TypeName>

TypeName functionref( string json )

Deserializes the type from json.

Errors

Will throw a script error if the deserialization wasn’t successful.

  • Note: currently the this function can crash if the json doesn’t follow the type schema tho this will be resolved soon (couldn’t be outdated by the time you are reading this lol)

safe io

a better implementation of safe io with serialization and no callbacks

BPLoadFileAsync<TypeName>

void functionref(string file_name, array<TypeName> out_param, array<string> ornull out_error)

Given a file it will read out and deserialize the contents for a given type. The output will override the 0th index of the out_param array. This function will override the contents of the file.

This function must be called from a thread, since it will pause the current squirrel thread to asynchronously load the file.

array<SerializableStruct> out;

BPLoadFileAsyncSerializableStruct("test", out, null)

print( out[0].a )

Errors

errors are optionally reported in the out_error out parameter.

BPSaveFileAsync<TypeName>

void functionref(string file_name, TypeName contents, array<string> ornull out_error)

Given a file it will save the contents provided and serialize them for a given type.

This function must be called from a thread, since it will pause the current squirrel thread to asynchronously save the file.

BPSaveFileAsyncStringArray("array", [ "1", "2", "3", "4" ], null)

Errors

errors are optionally reported in the out_error out parameter.

BPLoadFile<TypeName>

string ornull functionref(string file_name, array<TypeName> out_param)

Given a file it load the file contents into the out_param. This function will override the contents of the file.

This is a sync version of BPLoadFileAsync as such it can block the whole game.

Errors

errors are returned as string, null indicates no errors occurred

BPSaveFile<TypeName>

string ornull functionref(string file_name, TypeName contents)

Given a file it will save the provided contents.

This is a sync version of BPSaveFileAsync as such it can block the whole game.

Errors

errors are returned as string, null indicates no errors occurred

BPDeleteFile

string ornull functionref(string file_name)

Will delete the provided file from disc

Errors

errors are returned as string, null indicates no errors occurred

BPDeleteFile

string ornull functionref(string file_name)

Will delete the provided file from disc

Errors

errors are returned as string, null indicates no errors occurred

BPDoesFileExist

bool functionref(string file_name)

Will check if the provided file name exists in the file system. Returns true if it exists or false if it doesn’t.

true

Note

These functions can be used without <TypeName> suffix which will by default return a string of type var for loading and consume a string when saving

ranim

simple plugin that implements saving and loading of anims

RSaveRecordedAnimation

void functionref(var recording, string name)

just kind of saves the file to disk under this name

Errors

will throw an error if it isn’t able to save the file

RReadRecordedAnimation

var functionref(string name)

just kind of loads the file from disk under this name

Errors

will throw an error if it isn’t able to read the file

TODO

add recursive search to find recordings shipped with mods