|
Unit
Class header file: BWAPI/Unit.h The Unit class is used to get information about individual units as well as issue orders to units. Each unit in the game has a unique Unit object, and Unit objects are not deleted until the end of the match (so you don't need to worry about unit pointers becoming invalid). Note: There are 4 tiers of unit accessibility that determine which functions AIs will have access to. If the Complete Map Information cheat flag is enabled, you have perfect information of every unit. Otherwise, the functions that will return information will be limited depending on the unit's visibility. To learn more about unit accessibility, read the BWAPI Overview page.
MethodsgetIDint getID() const; Returns a unique ID for this unit. getReplayIDint getReplayID() const; Returns the ID of the unit from a replay file's actions. This is only available when CompleteMapInformation is enabled. getPlayerPlayer* getPlayer() const; Returns a pointer to the player that owns this unit. getTypeUnitType getType() const; Returns the current type of the unit. getPositionPosition getPosition() const; Returns the position of the unit on the map. getRegionRegion *getRegion() const; Returns the Region that the unit is currently in. getTilePositionTilePosition getTilePosition() const; Returns the build tile position of the unit on the map. Useful if the unit is a building. The tile position is of the top left corner of the building. getLeftint getLeft() const; Returns the x position for the unit's left collision boundry. getTopint getTop() const; Returns the y position for the unit's top collision boundry. getRightint getRight() const; Returns the x position for the unit's right collision boundry. getBottomint getBottom() const; Returns the y position for the unit's bottom collision boundry. getAngledouble getAngle() const; Returns the direction the unit is facing, measured in radians. An angle of 0 means the unit is facing east. getVelocityXdouble getVelocityX() const; Returns the x component of the unit's velocity, measured in pixels per frame. getVelocityYdouble getVelocityY() const; Returns the y component of the unit's velocity, measured in pixels per frame. getHitPointsint getHitPoints() const; Returns the unit's current amount of hit points. getShieldsint getShields() const; Returns the unit's current amount of shields. getEnergyint getEnergy() const; Returns the unit's current amount of energy. getResourcesint getResources() const; Returns the unit's current amount of containing resources. Useful for determining how much minerals are left in a mineral patch, or how much gas is left in a geyser (can also be called on a refinery/assimilator/extractor). getResourceGroupint getResourceGroup() const; Returns the group index of a resource. Can be used to identify which resources belong to an expansion. getDistanceint getDistance(Unit* target) const; Returns the edge-to-edge distance between the current unit and the target unit. int getDistance(Position target) const; Returns the distance from the edge of the current unit to the target position. hasPathbool hasPath(Unit* target) const; bool hasPath(Position target) const; Returns true if the target is on the same island as the unit, and false if the unit supposedly can't reach the destination target. This is based on static map data. See also: Game::hasPath getLastCommandFrameint getLastCommandFrame() const; Returns the frame of the last successful command sent using BWAPI. For example, issuing an Attack command with BWAPI will record the frame it was issued in, and you retrieve the frame with this. getLastCommandUnitCommand getLastCommand() const; Returns the last successful command sent using BWAPI. For example, issuing a Move command with BWAPI will immediately result in this function returning a Move command (with the same target position). getLastAttackingPlayerPlayer * getLastAttackingPlayer() const; Returns the last player that attacked this unit, or NULL if it is not applicable. setClientInfovoid setClientInfo(void* clientinfo); Associates client info with the unit. The client is responsible for the allocation and deallocation of the client info pointer. getClientInfovoid* getClientInfo(); Retrieves the client info that was set by setClientInfo. The client is responsible for the allocation and deallocation of the client info pointer. getUpgradeLevelint getUpgradeLevel(UpgradeType upgrade) const; Returns true if the owner of this player has upgraded the given upgrade type, and this unit is affected by this upgrade. getInitialTypeUnitType getInitialType() const; Returns the initial type of the unit or Unknown if it wasn't a neutral unit at the beginning of the game. getInitialPositionPosition getInitialPosition() const; Returns the initial position of the unit on the map, or Positions::Unknown if the unit wasn't a neutral unit at the beginning of the game. getInitialTilePositionTilePosition getInitialTilePosition() const; Returns the initial build tile position of the unit on the map, or TilePositions::Unknown if the unit wasn't a neutral unit at the beginning of the game. The tile position is of the top left corner of the building. getInitialHitPointsint getInitialHitPoints() const; Returns the unit's initial amount of hit points, or 0 if it wasn't a neutral unit at the beginning of the game. getInitialResourcesint getInitialResources() const; Returns the unit's initial amount of containing resources, or 0 if the unit wasn't a neutral unit at the beginning of the game. getKillCountint getKillCount() const; Returns the unit's current kill count. getAcidSporeCountint getAcidSporeCount() const; Returns the unit's acid spore count. getInterceptorCountint getInterceptorCount() const; Returns the number of interceptors the Protoss Carrier has. getScarabCountint getScarabCount() const; Returns the number of scarabs in the Protoss Reaver. getSpiderMineCountint getSpiderMineCount() const; Returns the number of spider mines in the Terran Vulture. getGroundWeaponCooldownint getGroundWeaponCooldown() const; Returns unit's ground weapon cooldown. It is 0 if the unit is ready to attack. getAirWeaponCooldownint getAirWeaponCooldown() const; Returns unit's air weapon cooldown. It is 0 if the unit is ready to attack. getSpellCooldownint getSpellCooldown() const; Returns unit's spell cooldown. It is 0 if the unit is ready to cast a spell. getDefenseMatrixPointsint getDefenseMatrixPoints() const; Returns the remaining hit points of the defense matrix. Initially a defense Matrix has 250 points. See also: Unit::getDefenseMatrixTimer, Unit::isDefenseMatrixed. getDefenseMatrixTimerint getDefenseMatrixTimer() const; Returns the time until the defense matrix wears off. 0 -> No defense Matrix present. getEnsnareTimerint getEnsnareTimer() const; Returns the time until the ensnare effect wears off. 0 -> No ensnare effect present. getIrradiateTimerint getIrradiateTimer() const; Returns the time until the radiation wears off. 0 -> No radiation present. getLockdownTimerint getLockdownTimer() const; Returns the time until the lockdown wears off. 0 -> No lockdown present. getMaelstromTimerint getMaelstromTimer() const; Returns the time until the maelstrom wears off. 0 -> No maelstrom present. getOrderTimerint getOrderTimer() const; getPlagueTimerint getPlagueTimer() const; Returns the time until the plague wears off. 0 -> No plague present. getRemoveTimerint getRemoveTimer() const; Returns the amount of time until the unit is removed, or 0 if the unit does not have a remove timer. Used to determine how much time remains before hallucinated units, dark swarm, etc have until they are removed. getStasisTimerint getStasisTimer() const; Returns the time until the stasis field wears off. 0 -> No stasis field present. getStimTimerint getStimTimer() const; Returns the time until the stimpack wears off. 0 -> No stimpack boost present. getBuildTypeUnitType getBuildType() const; Returns the building type a worker is about to construct. If the unit is a morphing Zerg unit or an incomplete building, this returns the UnitType the unit is about to become upon completion. getTrainingQueuestd::list< UnitType > getTrainingQueue() const; Returns the list of units queued up to be trained. See also: Unit::train, Unit::cancelTrain, Unit::isTraining. getTechTechType getTech() const; Returns the tech that the unit is currently researching. If the unit is not researching anything, TechTypes::None is returned. See also: Unit::research, Unit::cancelResearch, Unit::isResearching, Unit::getRemainingResearchTime. getUpgradeUpgradeType getUpgrade() const; Returns the upgrade that the unit is currently upgrading. If the unit is not upgrading anything, UpgradeTypes::None is returned. See also: Unit::upgrade, Unit::cancelUpgrade, Unit::isUpgrading, Unit::getRemainingUpgradeTime. getRemainingBuildTimeint getRemainingBuildTime() const; Returns the remaining build time of a unit/building that is being constructed. getRemainingTrainTimeint getRemainingTrainTime() const; Returns the remaining time of the unit that is currently being trained. If the unit is a Hatchery, Lair, or Hive, this returns the amount of time until the next larva spawns, or 0 if the unit already has 3 larva. getRemainingResearchTimeint getRemainingResearchTime() const; Returns the amount of time until the unit is done researching its current tech. If the unit is not researching anything, 0 is returned. See also: Unit::research, Unit::cancelResearch, Unit::isResearching, Unit::getTech. getRemainingUpgradeTimeint getRemainingUpgradeTime() const; Returns the amount of time until the unit is done upgrading its current upgrade. If the unit is not upgrading anything, 0 is returned. See also: Unit::upgrade, Unit::cancelUpgrade, Unit::isUpgrading, Unit::getUpgrade. getBuildUnitUnit* getBuildUnit() const; If the unit is an SCV that is constructing a building, this will return the building it is constructing. If the unit is a Terran building that is being constructed, this will return the SCV that is constructing it. getUnitsInRadiusstd::set<Unit*>& getUnitsInRadius(int radius) const; Retrieves the set of all units that are within a certain radius of the unit's bounding box. See also: Game::getUnitsInRadius, Unit::getUnitsInWeaponRange getUnitsInWeaponRangestd::set<Unit*>& getUnitsInWeaponRange(WeaponType weapon) const; Retrieves the set of all units that are currently within the given weapon's range. See also: Unit::getUnitsInRadius getTargetUnit* getTarget() const; After issuing an order to a target unit, this returns the target that the unit should move to and returns NULL after the unit has reached its target. See also: Unit::getOrderTarget, See also: Unit::isInWeaponRange getTargetPositionPosition getTargetPosition() const; Returns the target position the unit is moving to (provided a valid path to the target position exists). getOrderOrder getOrder() const; Returns the Order that this unit is currently executing. getOrderTargetUnit* getOrderTarget() const; This is set when your unit has performed an order to a target unit and for targets that are automatically acquired. getSecondaryOrderOrder getSecondaryOrder() const; Returns the secondary Order that this unit is currently executing. getRallyPositionPosition getRallyPosition() const; Returns the position the building is rallied to. If the building does not produce units, Positions::None is returned. An unset rally position will return (0,0). See also: Unit::setRallyPoint, Unit::getRallyUnit. getRallyUnitUnit* getRallyUnit() const; Returns the unit the building is rallied to. If the building is not rallied to any unit, NULL is returned. See also: Unit::setRallyPoint, Unit::getRallyPosition. getAddonUnit* getAddon() const; Returns the add-on of this unit, or NULL if the unit doesn't have an add-on. getNydusExitUnit* getNydusExit() const; Returns the Nydus Canal unit that is connected to this Nydus Canal, or NULL if the unit doesn't have a connecting Nydus Canal. getTransportUnit* getTransport() const; Returns the dropship, shuttle, overlord, or bunker that is this unit is loaded in to. getLoadedUnitsstd::set<Unit*> getLoadedUnits() const; Returns the set of the units loaded into a Terran Bunker, Terran Dropship, Protoss Shuttle, Protoss Carrier, or Zerg Overlord. getCarrierUnit* getCarrier() const; Returns the carrier that this unit belongs to, or NULL if this unit is not an Interceptor or if its carrier has recently been destroyed. getInterceptorsstd::set<Unit*> getInterceptors() const; Returns the set of interceptors owned by this carrier. The interceptors inside the carrier can be obtained via getLoadedUnits, while the interceptors outside of the carrier is the difference of these two sets. getHatcheryUnit* getHatchery() const; For Zerg Larva, this returns the Hatchery, Lair, or Hive unit this Larva was spawned from. For all other unit types this function returns NULL. getLarvastd::set<Unit*> getLarva() const; Returns the set of larva spawned by this unit. If the unit has no larva, or is not a Hatchery, Lair, or Hive, this function returns an empty set. Equivalent to clicking "Select Larva" from the Starcraft GUI. getPowerUpUnit *getPowerUp() const; Returns the powerup a worker is holding (Capture the Flag for example), or NULL if there is none. existsbool exists() const; 3 cases to consider:
hasNukebool hasNuke() const; Returns true if the unit is a Terran Nuclear Missile Silo and has a Terran Nuclear Missile trained and ready to go. isAcceleratingbool isAccelerating() const; Returns true if the unit is currently accelerating. isAttackingbool isAttacking() const; Returns true if the unit is currently attacking. isAttackFramebool isAttackFrame () const; Returns true if the unit is currently starting an attack or playing an attack animation. Don't issue the unit another command until this returns false or else the next attack sequence may be interrupted. isBeingConstructedbool isBeingConstructed() const; Returns true if the unit is being constructed. Always true for incomplete Protoss and Zerg buildings, and true for incomplete Terran buildings that have an SCV constructing them. If the SCV halts construction, isBeingConstructed will return false. See also: Unit::build, Unit::cancelConstruction, Unit::haltConstruction, Unit::isConstructing. isBeingGatheredbool isBeingGathered() const; Returns true if the unit is a mineral patch or refinery that is being gathered. isBeingHealedbool isBeingHealed() const; Returns true if the unit is currently being healed by a Terran Medic. isBlindbool isBlind() const; Returns true if the unit is currently blind from a Medic's Optical Flare. isBrakingbool isBraking() const; Returns true if the unit is currently braking/slowing down. isBurrowedbool isBurrowed() const; Returns true if the unit is a Zerg unit that is current burrowed. See also: Unit::burrow, Unit::unburrow. isCarryingGasbool isCarryingGas() const; Returns true if the unit is a worker that is carrying gas. See also: Unit::returnCargo, Unit::isGatheringGas. isCarryingMineralsbool isCarryingMinerals() const; Returns true if the unit is a worker that is carrying minerals. See also: Unit::returnCargo, Unit::isGatheringMinerals. isCloakedbool isCloaked() const; Returns true if the unit is cloaked. See also: Unit::cloak, Unit::decloak. isCompletedbool isCompleted() const; Returns true if the unit has been completed. isConstructingbool isConstructing() const; Returns true when a unit has been issued an order to build a structure and is moving to the build location. Also returns true for Terran SCVs while they construct a building. See also: Unit::build, Unit::cancelConstruction, Unit::haltConstruction, Unit::isBeingConstructed. isDefenseMatrixedbool isDefenseMatrixed() const; Returns true if the unit has a defense matrix from a Terran Science Vessel. isDetectedbool isDetected() const; Returns true if the unit is visible and detected. If this is false and Unit::isVisible returns true, then the unit is only partially visible, and requires detection (such as from a science vessel or overlord) to become fully visible and selectable/targetable. isEnsnaredbool isEnsnared() const; Returns true if the unit has been ensnared by a Zerg Queen. isFollowingbool isFollowing() const; Returns true if the unit is following another unit. See also: Unit::follow, Unit::getTarget. isGatheringGasbool isGatheringGas() const; Returns true if the unit is in one of the four states for gathering gas (MoveToGas, WaitForGas, HarvestGas, ReturnGas). See also: Unit::isCarryingGas. isGatheringMineralsbool isGatheringMinerals() const; Returns true if the unit is in one of the four states for gathering minerals (MoveToMinerals, WaitForMinerals, MiningMinerals, ReturnMinerals). See also: Unit::isCarryingMinerals. isHallucinationbool isHallucination() const; Returns true for hallucinated units, false for normal units. Returns true for hallucinated enemy units only if Complete Map Information is enabled. See also: Unit::getRemoveTimer. isHoldingPositionbool isHoldingPosition() const; Returns true for units that are holding position. See also: Unit::holdPosition. isIdlebool isIdle() const; Returns true if the unit is not doing anything. isInterruptiblebool isInterruptible() const; Returns true if the unit can be interrupted by another order like move or attack, otherwise there are very few orders that can be issued such as Unburrow, LiftOff, and Cancel. isInvinciblebool isInvincible () const; Return true if the unit is currently invincible (stasis field, preplaced invincible setting(can apply to critters in melee), or Use Map Settings invincible trigger). isInWeaponRangebool isInWeaponRange(Unit *target) const; Returns true if the unit can immediately attack the target unit without any movement. isIrradiatedbool isIrradiated() const; Returns true if the unit is being irradiated by a Terran Science Vessel. See also: Unit::getIrradiateTimer. isLiftedbool isLifted() const; Returns true if the unit is a Terran building that is currently lifted off the ground. See also: Unit::lift,Unit::land. isLoadedbool isLoaded() const; Return true if the unit is loaded into a Terran Bunker, Terran Dropship, Protoss Shuttle, or Zerg Overlord. See also: Unit::load, Unit::unload, Unit::unloadAll. isLockedDownbool isLockedDown() const; Returns true if the unit is locked down by a Terran Ghost. See also: Unit::getLockdownTimer. isMaelstrommedbool isMaelstrommed() const; Returns true if the unit is being maelstrommed. See also: Unit::getMaelstromTimer. isMorphingbool isMorphing() const; Returns true if the unit is a zerg unit that is morphing. See also: Unit::morph, Unit::cancelMorph, Unit::getBuildType, Unit::getRemainingBuildTime. isMovingbool isMoving() const; Returns true if the unit is moving. See also: Unit::attack, Unit::stop. isParasitedbool isParasited() const; Returns true if the unit has been parasited by some other player. isPatrollingbool isPatrolling() const; Returns true if the unit is patrolling between two positions. isPlaguedbool isPlagued() const; Returns true if the unit has been plagued by a Zerg Defiler. See also: Unit::getPlagueTimer. isRepairingbool isRepairing() const; Returns true if the unit is a Terran SCV that is repairing or moving to repair another unit. isResearchingbool isResearching() const; Returns true if the unit is a building that is researching tech. See TechTypes for the complete list of available techs in Broodwar. See also: Unit::research, Unit::cancelResearch, Unit::getTech, Unit::getRemainingResearchTime. isSelectedbool isSelected() const; Returns true if the unit has been selected by the user via the starcraft GUI. Only available if you enable Flag::UserInput during AIModule::onStart. See also: Game::getSelectedUnits. isSiegedbool isSieged() const; Returns true if the unit is a Terran Siege Tank that is currently in Siege mode. See also: Unit::siege, Unit::unsiege. isStartingAttackbool isStartingAttack() const; Returns true if the unit is starting to attack. See also: Unit::attack, Unit::getGroundWeaponCooldown, Unit::getAirWeaponCooldown. isStasisedbool isStasised() const; Returns true if the unit has been stasised by a Protoss Arbiter. See also: Unit::getStasisTimer. isStimmedbool isStimmed() const; Returns true if the unit is currently stimmed. See also: Unit::getStimTimer. isStuckbool isStuck() const; Returns true if the unit is "stuck" on another unit, but not stuck behind a wall. isTrainingbool isTraining() const; Returns true if the unit is training units (i.e. a Barracks training Marines). See also: Unit::train, Unit::getTrainingQueue, Unit::cancelTrain, Unit::getRemainingTrainTime. isUnderAttackbool isUnderAttack() const; Returns true if the unit was recently attacked. isUnderDarkSwarmbool isUnderDarkSwarm() const; Returns true if the unit is under a Dark Swarm. isUnderDisruptionWebbool isUnderDisruptionWeb() const; Returns true if the unit is under a Disruption Web. isUnderStormbool isUnderStorm() const; Returns true if the unit is under a Protoss Psionic Storm. isUnpoweredbool isUnpowered() const; Returns true if the unit is a Protoss building that is unpowered because no pylons are in range. isUpgradingbool isUpgrading() const; Returns true if the unit is a building that is upgrading. See UpgradeTypes for the complete list of available upgrades in Broodwar. See also: Unit::upgrade, Unit::cancelUpgrade, Unit::getUpgrade, Unit::getRemainingUpgradeTime. isVisiblebool isVisible() const; bool isVisible(Player* player) const; Returns true if the unit is visible. If the CompleteMapInformation cheat flag is enabled, existing units hidden by the fog of war will be accessible, but isVisible will still return false. If a player is specified, this will return true if the unit is visible to the given player. This version of the function is only available in replays or if the CompleteMapInformation cheat flag is enabled. Unit CommandscanIssueCommandbool canIssueCommand (UnitCommand command); Returns true if the unit is able to execute the given command, or false if there is an error. For example Unit::canIssueCommand(UnitCommand(UnitCommandType::Attack_Position,NULL,50,60,0)) will return true if the unit can issue the attackMove command to the given position. issueCommandbool issueCommand(UnitCommand command); Issues the give unit command, or returns false if there is an error. For example Unit::issueCommand(UnitCommand(UnitCommandType::Attack_Position,NULL,50,60,0)) will order the unit to attack move to the Position (50,60). attackbool attack(Position target, bool shiftQueueCommand = false); bool attack(Unit* target, bool shiftQueueCommand = false); Orders the unit to attack move to a specified location or attack a single unit. After issuing, the unit's order will become Orders::AttackMove or Orders::AttackUnit, depending on how the call was made. This command can be queued by setting shiftQueueCommand to true. buildbool build(TilePosition target, UnitType type); Orders the unit to build the given unit type at the given position. Note that if the player does not have enough resources when the unit attempts to place the building down, the order will fail. The tile position specifies where the top left corner of the building will be placed. After issuing the unit's order will become Orders::PlaceBuilding. See also: haltConstruction, Unit::cancelConstruction, Unit::isConstructing, Unit::isBeingConstructed, Unit::getBuiltType, Unit::getBuildUnit, Unit::getRemainingBuildTime. buildAddonbool buildAddon( UnitType type); Orders the unit to build the given add-on. The unit must be a Terran building that can have an add-on and the specified unit type must be an add-on unit type. The build() command can also be used to build add-ons. See also: Unit::cancelAddon, Unit::isConstructing, Unit::getBuiltType, Unit::getBuildUnit, Unit::getRemainingBuildTime. trainbool train(UnitType type); Orders this unit to add the specified unit type to the training queue. Note that the player must have sufficient resources to train. If you wish to make units from a hatchery, use getLarva to get the larva associated with the hatchery and then call morph on the larva you want to morph. This command can also be used to make interceptors and scarabs. See also: Unit::cancelTrain, Unit::isTraining, Unit::getTrainingQueue, Unit::getRemainingTrainTime. morphbool morph(UnitType type); Orders the unit to morph into the specified unit type. Returns false if given a wrong type. See also: Unit::cancelMorph, Unit::isMorphing, Unit::getBuildType, Unit::getRemainingBuildTime. researchbool research(TechType tech); Orders the unit to research the given tech type. See also: Unit::cancelResearch, Unit::isResearching, Unit::getTech, Unit::getRemainingResearchTime. upgradebool upgrade(UpgradeType upgrade); Orders the unit to upgrade the given upgrade type. See also: Unit::cancelUpgrade, Unit::isUpgrading, Unit::getUpgrade, Unit::getRemainingUpgradeTime. setRallyPointbool setRallyPoint(Position target); bool setRallyPoint(Unit target); Orders the unit to set its rally position to the specified position or unit. See also: Unit::getRallyPosition, Unit::getRallyUnit. movebool move(Position target, bool shiftQueueCommand = false); Orders the unit to move to the specified position. After issuing, the unit's order will become Orders::Move. This command can be queued by setting shiftQueueCommand to true. See also: Unit::isMoving. patrolbool patrol(Position target, bool shiftQueueCommand = false); Orders the unit to patrol between its current position and the specified position. After issuing, the unit's order will become Orders::Patrol. This command can be queued by setting shiftQueueCommand to true. See also: Unit::isPatrolling. holdPositionbool holdPosition(bool shiftQueueCommand = false); Orders the unit to hold its position. Note: Reavers and Carriers can only hold position if they have at least one Scarab or Interceptor. After issuing, the unit's order will become Orders::HoldPosition. This command can be queued by setting shiftQueueCommand to true. See also: Unit::isHoldingPosition. stopbool stop(bool shiftQueueCommand = false); Orders the unit to stop. After issuing, the unit's order will become Orders::Stop. This command can be queued by setting shiftQueueCommand to true. See also: Unit::isMoving, Unit::isBraking. followbool follow(Unit target, bool shiftQueueCommand = false); Orders the unit to follow the specified unit. After issuing, the unit's order will become Orders::Follow. This command can be queued by setting shiftQueueCommand to true. See also: Unit::isFollowing. gatherbool gather(Unit* target, bool shiftQueueCommand = false); Orders the unit to gather the specified unit. Only workers can be ordered to gather, and the target must be a mineral patch, Refinery, Assimilator, or Extractor. This command can be queued by setting shiftQueueCommand to true. See also: Unit::isGatheringGas, Unit::isGatheringMinerals. returnCargobool returnCargo(bool shiftQueueCommand = false); Orders the unit to return its cargo to a nearby resource depot such as a Command Center. Only workers that are carrying minerals or gas can be ordered to return cargo. This command can be queued by setting shiftQueueCommand to true. See also: Unit::isCarryingGas, isCarryingMinerals, Unit::isGatheringGas, Unit::isGatheringMinerals. repairbool repair(Unit* target, bool shiftQueueCommand = false); Orders the unit to repair the specified unit. Only Terran SCVs can be ordered to repair, and the target must be a mechanical Terran unit or building. After issuing, the unit's order will become Orders::Repair. This command can be queued by setting shiftQueueCommand to true. See also: Unit::isRepairing. burrowbool burrow(); Orders the unit to burrow. Either the unit must be a Zerg Lurker, or the unit must be a Zerg ground unit and burrow tech must be researched. After issuing, the unit's order will become Orders::Burrowing while the unit transitions. See also: Unit::unburrow, Unit::isBurrowed. unburrowbool unburrow(); Orders the burrowed unit to unburrow. After issuing, the unit's order will become Orders::Unburrowing while the unit transitions. See also: Unit::burrow, Unit::isBurrowed. cloakbool cloak(); Orders the unit to cloak. See also: Unit::decloak, Unit::isCloaked. decloakbool decloak(); Orders the unit to decloak. See also: Unit::cloak, Unit::isCloaked. siegebool siege(); Orders the unit to siege. Note: unit must be a Terran siege tank. After issuing, the unit's order will become Orders::Sieging while the siege tank transitions. See also: Unit::unsiege, Unit::isSieged. unsiegebool unsiege(); Orders the unit to unsiege. Note: unit must be a Terran siege tank. After issuing, the unit's order will become Orders::Unsieging while the siege tank transitions. See also: Unit::siege, Unit::isSieged. liftbool lift(); Orders the unit to lift. Note: unit must be a Terran building that can be lifted. See also: Unit::land, Unit::isLifted. landbool land(TilePosition target); Orders the unit to land. Note: unit must be a Terran building that is currently lifted. See also: Unit::lift, Unit::isLifted. loadbool load(Unit* target, bool shiftQueueCommand = false); Orders the unit to load the target unit. This command can be queued by setting shiftQueueCommand to true. See also: Unit::unload, Unit::unloadAll, Unit::getLoadedUnits, Unit:isLoaded. unloadbool unload(Unit* target); Orders the unit to unload the target unit. See also: Unit::load, Unit::unloadAll, Unit::getLoadedUnits, Unit:isLoaded. unloadAllbool unloadAll(bool shiftQueueCommand = false); Orders the unit to unload all loaded units at the unit's current position. This command can be queued by setting shiftQueueCommand to true. See also: Unit::load, Unit::unload, Unit::unloadAll, Unit::getLoadedUnits, Unit:isLoaded. unloadAllbool unloadAll(Position target, bool shiftQueueCommand = false); Orders the unit to unload all loaded units at the specified location. Unit should be a Terran Dropship, Protoss Shuttle, or Zerg Overlord. If the unit is a Terran Bunker, the units will be unloaded right outside the bunker, like in the first version of unloadAll. This command can be queued by setting shiftQueueCommand to true. See also: Unit::load, Unit::unload, Unit::unloadAll, Unit::getLoadedUnits, Unit:isLoaded. rightClickbool rightClick(Position target, bool shiftQueueCommand = false); bool rightClick(Unit* target, bool shiftQueueCommand = false); Works like the right click in the GUI. Right click on a mineral patch to order a worker to mine, right click on an enemy to attack it. This command can be queued by setting shiftQueueCommand to true. haltConstructionbool haltConstruction(); Orders the SCV to stop constructing the building, and the building is left in a partially complete state until it is canceled, destroyed, or completed. See also: Unit::Unit::build, Unit::Unit::cancelConstruction, Unit::isConstructing. cancelConstructionbool cancelConstruction(); Orders the building to stop being constructed. See also: Unit::build, Unit::beingConstructed. cancelAddonbool cancelAddon(); Orders the unit to stop making the addon. See also: Unit::buildAddon. cancelTrainbool cancelTrain(int slot = -2); Orders the unit to remove the specified unit from its training queue. Leaving the default value will remove the last unit from the training queue. See also: Unit::train, Unit::isTraining, Unit::getTrainingQueue. cancelMorphbool cancelMorph(); Orders the unit to stop morphing. See also: Unit::morph, Unit::isMorphing. cancelResearchbool cancelResearch(); Orders the unit to cancel a research in progress. See also: Unit::research, Unit::isResearching, Unit::getTech. cancelUpgradebool cancelUpgrade(); Orders the unit to cancel an upgrade in progress. See also: Unit::upgrade, Unit::isUpgrading, Unit::getUpgrade. useTechbool useTech([TechType] tech); bool useTech([TechType] tech, Position position); bool useTech([TechType] tech, Unit* target); Orders the unit to use a technology either not requiring a target (i.e. Stim Pack), a target position (i.e. Spider Mines), or a target unit (i.e. Irradiate). Returns true if the tech can be used. placeCOPbool placeCOP(TilePosition target); Moves a Flag Beacon from its current location to the target location. | |
It would be really useful to move or copy the explanation of "accessibility" to the "UsingBWAPI" page, as this is a general concept within BWAPI. There are a few other pages that use this concept, which is really confusing, because it's not intuitive that the explanation would be found on the "Unit" page.