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

#include <sc2_interfaces.h>

Public Member Functions

virtual void UnitCommand (Tag unit_tag, AbilityID ability)=0
 
virtual void UnitCommand (Tag unit_tag, AbilityID ability, const Point2D &point)=0
 
virtual void UnitCommand (Tag unit_tag, AbilityID ability, Tag target_tag)=0
 
virtual void UnitCommand (const std::vector< Tag > &unit_tags, AbilityID ability)=0
 Issues a command to multiple units (prefer this where possible). Same as UnitCommand(Tag, AbilityID).
 
virtual void UnitCommand (const std::vector< Tag > &unit_tags, AbilityID ability, const Point2D &point)=0
 Issues a command to multiple units (prefer this where possible). Same as UnitCommand(Tag, AbilityID, Point2D).
 
virtual void UnitCommand (const std::vector< Tag > &unit_tags, AbilityID ability, Tag target_tag)=0
 Issues a command to multiple units (prefer this where possible). Same as UnitCommand(Tag, AbilityID, Tag).
 
virtual const std::vector< Tag > & Commands () const =0
 
virtual void ToggleAutocast (Tag unit_tag, AbilityID ability)=0
 
virtual void ToggleAutocast (const std::vector< Tag > &unit_tags, AbilityID ability)=0
 
virtual void SendActions ()=0
 

Detailed Description

The ActionInterface issues actions to units in a game. Not available in replays. Guaranteed to be valid when the OnStep event is called.

Member Function Documentation

◆ Commands()

virtual const std::vector<Tag>& sc2::ActionInterface::Commands ( ) const
pure virtual

Returns a list of unit tags that have sent commands out in the last call to SendActions. This will be used to determine if a unit actually has a command when the observation is received.

Returns
Array of units that have sent commands.

◆ SendActions()

virtual void sc2::ActionInterface::SendActions ( )
pure virtual

This function sends out all batched unit commands. You DO NOT need to call this function in non real time simulations since it is automatically called when stepping the simulation forward. You only need to call this function in a real time simulation. For example, if you wanted to move 20 marines to some position on the map you'd want to batch all of those unit commands and send them at once.

◆ ToggleAutocast() [1/2]

virtual void sc2::ActionInterface::ToggleAutocast ( Tag  unit_tag,
AbilityID  ability 
)
pure virtual

Enables or disables autocast of an ability on a unit.

Parameters
unit_tagThe unit to toggle the ability on.
abilityThe ability to be toggled.

◆ ToggleAutocast() [2/2]

virtual void sc2::ActionInterface::ToggleAutocast ( const std::vector< Tag > &  unit_tags,
AbilityID  ability 
)
pure virtual

Enables or disables autocast of an ability on a list of units.

Parameters
unit_tagsThe units to toggle the ability on.
abilityThe ability to be toggled.

◆ UnitCommand() [1/3]

virtual void sc2::ActionInterface::UnitCommand ( Tag  unit_tag,
AbilityID  ability 
)
pure virtual

Issues a command to a unit. Self targeting.

Parameters
unit_tagThe unit to send the command to.
abilityThe ability id of the command.

◆ UnitCommand() [2/3]

virtual void sc2::ActionInterface::UnitCommand ( Tag  unit_tag,
AbilityID  ability,
const Point2D point 
)
pure virtual

Issues a command to a unit. Targets a point.

Parameters
unit_tagThe unit to send the command to.
abilityThe ability id of the command.
pointThe 2D world position to target.

◆ UnitCommand() [3/3]

virtual void sc2::ActionInterface::UnitCommand ( Tag  unit_tag,
AbilityID  ability,
Tag  target_tag 
)
pure virtual

Issues a command to a unit. Targets another unit.

Parameters
unit_tagThe unit to send the command to.
abilityThe ability id of the command.
target_tagThe unit that is a target of the unit getting the command.

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