-
Notifications
You must be signed in to change notification settings - Fork 12
Global AI API
These functions are globally accessible from within all AI in the framework, these functions give access to parts of the global dota 2 API plus some extra functions.
- AI_BuyItem
- AI_DebugDrawBox
- AI_DebugDrawCircle
- AI_DebugDrawLine
- AI_DebugDrawSphere
- AI_DebugDrawText
- AI_EntIndexToHScript
- AI_ExecuteOrderFromTable
- AI_FindUnitsInRadius
- AI_GetGameTime
- AI_Log
- AI_MinimapEvent
- AI_Say
#Function List
Buy an item on a unit.
- unit - The unit to buy the item on.
- itemName - The item to buy.
Does not exist in the original AI.
Draw a box.
- origin - The origin vector.
- min - A vector relative to the origin with the minimal coordinate corner.
- max - A vector relative to the origin with the maximal coordinate corner.
- r - The red component in the RGBA color (0-255).
- g - The green component in the RGBA color (0-255).
- b - The blue component in the RGBA color (0-255).
- a - The alpha component in the RGBA color (0-255).
- duration - The duration of the drawing in seconds.
Only works if AIManager.AllowDebugDrawing. Forces a certain color if AIManager.ForceDrawColor.
Draw a circle.
- center - The center of the circle
- vRgba - The color vector for the circle
- a - The alpha channel of the color.
- rad - The radius of the circle.
- ztest - Disable ztest?
- duration - The duration of the drawing
Only works if AIManager.AllowDebugDrawing. Forces a certain color if AIManager.ForceDrawColor.
Draw a line.
- origin - The origin vector (from).
- target - The target vector (to).
- r - The red component in the RGBA color (0-255).
- g - The green component in the RGBA color (0-255).
- b - The blue component in the RGBA color (0-255).
- ztest - Disable ztest?
- duration - The duration of the drawing in seconds.
Only works if AIManager.AllowDebugDrawing. Forces a certain color if AIManager.ForceDrawColor.
Draw a sphere.
- center - The center of the circle
- vRgba - The color vector for the circle
- a - The alpha channel of the color.
- rad - The radius of the circle.
- ztest - Disable ztest?
- duration - The duration of the drawing
Only works if AIManager.AllowDebugDrawing. Forces a certain color if AIManager.ForceDrawColor.
Draw text.
- origin - The origin vector (from).
- text - The text to display.
- viewCheck - Is the text aligned with the viewport?
- duration - The duration of the drawing in seconds.
Only works if AIManager.AllowDebugDrawing. Forces a certain color if AIManager.ForceDrawColor.
Return the entity by its entity index.
- ent_index - The entity index of a unit or ability.
Returns wrapped units/abilities.
Execute an order from a table
- table - The order table, contains the following parameters: * UnitIndex - The entity index of the unit the order is given to. * OrderType - The type of unit given. * TargetIndex - (OPTIONAL) The entity index of the target unit. * AbilityIndex - (OPTIONAL) The entity index of the target unit. * Position - (OPTIONAL) The (vector) position of the order. * Queue - (OPTIONAL) Queue the order or not (boolean).
Only works for units of the AI, and the target entity is not in fog.
Finds units in a radius with some parameters.
- Position - The center of the circle to search in
- Radius - The radius to search in
- TeamFilter - DOTA_UNIT_TARGET_TEAM_* filter.
- TypeFilter - DOTA_UNIT_TARGET_TYPE_* filter.
- FlagFilter - DOTA_UNIT_TARGET_FLAG_* filter.
- Order - The order to return results in.
- CanGrowCache - Can the search grow the cache.
Can only find units visible by the AI's team.
Type: integer
Description: a
Get the current game time.
-
Log functionality for AI.
- message - The message to log
-
Fire an event on the minimap.
- entity - Entity the event was fired on ( can be nil ).
- xCoord - The x-coordinate of the event.
- yCoord - The y-coordinate of the event.
- eventType - The type of the event, DOTA_MINIMAP_EVENT_*.
- eventDuration - The duration of the minimap event.
Removed team parameter, limited to entities in vision.
Make a player say something in chat.
- playerID - The id of the player doing the talking.
- message - The message.
- teamOnly - Is the message in team chat or not (boolean).
Only works for players owned by the AI, uses player ID instead of player.