SC2API
An API for AI for StarCraft II
Public Member Functions | List of all members
sc2::ClientEvents Class Reference

A set of common events a user can override in their derived bot or replay observer class. More...

#include <sc2_client.h>

Inheritance diagram for sc2::ClientEvents:
sc2::Client sc2::Agent sc2::ReplayObserver

Public Member Functions

virtual void OnGameFullStart ()
 Called when a game is started after a load. Fast restarting will not call this.
 
virtual void OnGameStart ()
 Called when a game is started or restarted.
 
virtual void OnGameEnd ()
 Called when a game has ended.
 
virtual void OnStep ()
 
virtual void OnUnitDestroyed (const Unit *)
 
virtual void OnUnitCreated (const Unit *)
 
virtual void OnUnitIdle (const Unit *)
 
virtual void OnUpgradeCompleted (UpgradeID)
 
virtual void OnBuildingConstructionComplete (const Unit *)
 
virtual void OnNydusDetected ()
 Called when a nydus is placed.
 
virtual void OnNuclearLaunchDetected ()
 Called when a nuclear launch is detected.
 
virtual void OnUnitEnterVision (const Unit *)
 
virtual void OnError (const std::vector< ClientError > &, const std::vector< std::string > &={})
 Called for various errors the library can encounter. See ClientError enum for possible errors.
 

Detailed Description

A set of common events a user can override in their derived bot or replay observer class.

Member Function Documentation

virtual void sc2::ClientEvents::OnBuildingConstructionComplete ( const Unit )
inlinevirtual

Called when the unit in the previous step had a build progress less than 1.0 but is greater than or equal to 1.0 in the current step.

Parameters
unitThe constructed unit.
virtual void sc2::ClientEvents::OnStep ( )
inlinevirtual

In non realtime games this function gets called after each step as indicated by step size. In realtime this function gets called as often as possible after request/responses are received from the game gathering observation state.

virtual void sc2::ClientEvents::OnUnitCreated ( const Unit )
inlinevirtual

Called when a Unit has been created by the player.

Parameters
unitThe created unit.
virtual void sc2::ClientEvents::OnUnitDestroyed ( const Unit )
inlinevirtual

Called whenever one of the player's units has been destroyed.

Parameters
unitThe destroyed unit.
virtual void sc2::ClientEvents::OnUnitEnterVision ( const Unit )
inlinevirtual

Called when an enemy unit enters vision from out of fog of war.

Parameters
unitThe unit entering vision.
virtual void sc2::ClientEvents::OnUnitIdle ( const Unit )
inlinevirtual

Called when a unit becomes idle, this will only occur as an event so will only be called when the unit becomes idle and not a second time. Being idle is defined by having orders in the previous step and not currently having orders or if it did not exist in the previous step and now does, a unit being created, for instance, will call both OnUnitCreated and OnUnitIdle if it does not have a rally set.

Parameters
unitThe idle unit.
virtual void sc2::ClientEvents::OnUpgradeCompleted ( UpgradeID  )
inlinevirtual

Called when an upgrade is finished, warp gate, ground weapons, baneling speed, etc.

Parameters
upgradeThe completed upgrade.

The documentation for this class was generated from the following file: