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 (const Unit *unit, AbilityID ability, bool queued_command=false)=0
 
virtual void UnitCommand (const Unit *unit, AbilityID ability, const Point2D &point, bool queued_command=false)=0
 
virtual void UnitCommand (const Unit *unit, AbilityID ability, const Unit *target, bool queued_command=false)=0
 
virtual void UnitCommand (const Units &units, AbilityID ability, bool queued_move=false)=0
 Issues a command to multiple units (prefer this where possible). Same as UnitCommand(Unit, AbilityID).
 
virtual void UnitCommand (const Units &units, AbilityID ability, const Point2D &point, bool queued_command=false)=0
 Issues a command to multiple units (prefer this where possible). Same as UnitCommand(Unit, AbilityID, Point2D).
 
virtual void UnitCommand (const Units &units, AbilityID ability, const Unit *target, bool queued_command=false)=0
 Issues a command to multiple units (prefer this where possible). Same as UnitCommand(Unit, AbilityID, Unit).
 
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 SendChat (const std::string &message, ChatChannel channel=ChatChannel::All)=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

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.
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.

virtual void sc2::ActionInterface::SendChat ( const std::string &  message,
ChatChannel  channel = ChatChannel::All 
)
pure virtual

Sends a message to the game chat.

Parameters
messageText of message to send.
channelWhich players will see the message.
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.
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.
virtual void sc2::ActionInterface::UnitCommand ( const Unit unit,
AbilityID  ability,
bool  queued_command = false 
)
pure virtual

Issues a command to a unit. Self targeting.

Parameters
unitThe unit to send the command to.
abilityThe ability id of the command.
virtual void sc2::ActionInterface::UnitCommand ( const Unit unit,
AbilityID  ability,
const Point2D point,
bool  queued_command = false 
)
pure virtual

Issues a command to a unit. Targets a point.

Parameters
unitThe unit to send the command to.
abilityThe ability id of the command.
pointThe 2D world position to target.
virtual void sc2::ActionInterface::UnitCommand ( const Unit unit,
AbilityID  ability,
const Unit target,
bool  queued_command = false 
)
pure virtual

Issues a command to a unit. Targets another unit.

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

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