Bot API

From Heroes of Newerth Wiki
Jump to: navigation, search

Below are the bot API functions available. A copy of the list can be found here.

Please use the documentation for HoN.DrawDebugLine as a template when adding new function pages. Leave out any empty categories and don't forget to add a minimal function description to this page.

Global functions[edit | edit source]

  • void AddBot(nTeam, sDefinitionName) - Add a bot with the provided definition name to the the provided team.
  • void StartGame(String type, String name, String options) - Start a game with the provided settings. Same as the equally named console command.
  • void Echo(String text) - Prints a line of text in the console.
  • Number GetTime()
  • Number GetTimeOfDawn()
  • void print(...) - Prints the provided text in the console. Does not start a new line.
  • Number Round(Number) - Rounds a floating number. Same as math.floor(Number + .5).
  • void StartProfile(sName) - Does not work in the retail client.
  • void StopProfile() - Does not work in the retail client.

Vector3 library[edit | edit source]

For a tutorial on Vector3 visit this thread.

  • Vector3 Vector3.Create([nX, nY, nZ]) - Create a new Vector3 instance.
  • Vector3 Vector3.Cross(vec1, vec2)
  • Number Vector3.Distance(vec1, vec2) - Calculate the 3D distance (x,y,z) between the two vectors. Expensive function. Should not be used.
  • Number Vector3.Distance2D(vec1, vec2) - Calculate the 2D distance (x,y) between two vectors. Expensive function. Should not be used. If you ever do need to calculate the 2D distance (e.g. for averages) you can use this snippet instead.
  • Number Vector3.Distance2DSq(vec1, vec2) - Calculate the 2D distance (x,y) between two vectors using a much cheaper formula. Should be used for most (if not all) distance calculations.
  • Number Vector3.DistanceSq(vec1, vec2) - Calculate the 3D distance (x,y,z) between two vectors. Vector3.Distance2DSq usually suffices.
  • Number Vector3.Dot(vec1, vec2)
  • Number Vector3.Length(vec)
  • Number Vector3.LengthSq(vec)
  • Vector3 Vector3.Normalize(vec)
  • Vector3 Vector3.Project(vecOnto, vecToProject)

HoN library[edit | edit source]

This section is for functions in the HoN library. The HoN library returns different information for each team and may not return anything useful when executed from the console.

CBotBrain members[edit | edit source]

CTeamBotBrain members[edit | edit source]

This section is for functions provided in the "object" variable of a TeamBotBrain.

IEntityAbility members[edit | edit source]

This section is for functions for unit abilities (heroes, pets, couriers, etc.).

IBehavior members[edit | edit source]

IUnitEntity members[edit | edit source]

IActionState members[edit | edit source]

CItemDefinition members[edit | edit source]

IEntityItem members[edit | edit source]

BotMetaData library[edit | edit source]

CBotMetaDataNode members[edit | edit source]

CBotMetaDataLink members[edit | edit source]


There is also a ton of useful functions in the scripts themselves (such as those in core and botbraincore), and on the snippets subforum.