An API for interacting with Starcraft: Broodwar (1.16.1)
Public Member Functions
|virtual void||onEnd (bool isWinner)|
|virtual void||onFrame ()|
|virtual void||onNukeDetect (Position target)|
|virtual void||onPlayerLeft (Player player)|
|virtual void||onReceiveText (Player player, std::string text)|
|virtual void||onSaveGame (std::string gameName)|
|virtual void||onSendText (std::string text)|
|virtual void||onStart ()|
|virtual void||onUnitComplete (Unit unit)|
|virtual void||onUnitCreate (Unit unit)|
|virtual void||onUnitDestroy (Unit unit)|
|virtual void||onUnitDiscover (Unit unit)|
|virtual void||onUnitEvade (Unit unit)|
|virtual void||onUnitHide (Unit unit)|
|virtual void||onUnitMorph (Unit unit)|
|virtual void||onUnitRenegade (Unit unit)|
|virtual void||onUnitShow (Unit unit)|
AIModule is a virtual class that is intended to be implemented or inherited by a custom AI class.
The Broodwar interface is guaranteed to be initialized if any of these predefined interface functions are invoked by BWAPI.
Called only once at the beginning of a game.
It is intended that the AI module do any data initialization in this function.
Called once at the end of a game.
|isWinner||A boolean value to determine if the current player has won the match. This value will be true if the current player has won, and false if either the player has lost or the game is actually a replay.|
Called once for every execution of a logical frame in Broodwar.
Users will generally put most of their code in this function.
Called when the user attempts to send a text message.
This function can be used to make the bot execute text commands entered by the user for debugging purposes.
|text||A string containing the exact text message that was sent by the user.|
Called when the client receives a message from another Player.
This function can be used to retrieve information from allies in team games, or just to respond to other players.
|player||The Player interface object representing the owner of the text message.|
|text||The text message that the |
Called when a Player leaves the game.
All of their units are automatically given to the neutral player with their colour and alliance parameters preserved.
|player||The Player interface object representing the player that left the game.|
Called when a Nuke has been launched somewhere on the map.
|target||A Position object containing the target location of the Nuke. If the target location is not visible and Flag::CompleteMapInformation is disabled, then target will be Positions::Unknown.|
Called when a Unit becomes accessible.
|unit||The Unit interface object representing the unit that has just become accessible.|
Called when a Unit becomes inaccessible.
|unit||The Unit interface object representing the unit that has just become inaccessible.|
Called when a previously invisible unit becomes visible.
|unit||The Unit interface object representing the unit that has just become visible.|
Called just as a visible unit is becoming invisible.
|unit||The Unit interface object representing the unit that is about to go out of scope.|
Called when any unit is created.
|unit||The Unit interface object representing the unit that has just been created.|
Called when a unit is removed from the game either through death or other means.
|unit||Unit object representing the unit that has just been destroyed or otherwise completely removed from the game.|
Called when a unit changes its UnitType.
For example, when a Drone transforms into a Hatchery, a Siege Tank uses Siege Mode, or a Vespene Geyser receives a Refinery.
|unit||Unit object representing the unit that had its UnitType change.|
Called when a unit changes ownership.
This occurs when the Protoss ability Mind Control is used, or if a unit changes ownership in Use Map Settings .
|unit||Unit interface object pertaining to the unit that has just changed ownership.|
Called when the state of the Broodwar game is saved to file.
|gameName||A String object containing the file name that the game was saved as.|
Called when the state of a unit changes from incomplete to complete.
|unit||The Unit object representing the Unit that has just finished training or constructing.|