unit object
object +-- commandobject +-- unit
Description
Object unit is base object for units of different types (like tanks,
builders, harvesters etc.). This object implements functions common for all types of
units.
Usually functions which are returning pointer to objects are returning unit
type (at least in objects derived from unit).
Unit is not base type for user unit scripts. You should use particular
objects like civil, tank, repairer etc.
Functions
int GetIFF() int GetIFFNumber() int IsBuilding() int IsLandTarget() int IsLandUnit() int IsHelicopter() int IsBuilder() int IsCarrier() int IsHarvester() int IsRepairer() int IsSapper() int IsSupplier() int IsTransporter() int IsPassive() int GetBuildingType() void CallFreeze(int nFreezeTicks) int IsFroozen() void NextCommand(int nPrevCommandStatus) int HaveEmptyCall() int GetSideColor() int GetPlayerSideColor() int IsBlackFog(int nX, int nY, int nZ) int IsResourceInPoint(int nX, int nY, int nZ) int GetResourcesCount(int nX, int nY, int nZ) int IsContainerInPoint(int nX, int nY, int nZ) int IsEnemy(unit uTarget) int IsNeutral(unit uTarget) int IsAlliance(unit uTarget) int IsVisible(unit uTarget) int GetWorldLeft() int GetWorldTop() int GetWorldRight() int GetWorldBottom() int DistanceTo(int nX, int nY) void CallMoveToPoint(int nX, int nY, int nZ) void CallMoveToPointForce(int nX, int nY, int nZ) void CallMoveAndLandToPointForce(int nX, int nY, int nZ) void CallMoveLowToPoint(int nX, int nY, int nZ) void CallMoveLowToPointForce(int nX, int nY, int nZ) void CallMoveOneField(int nX, int nY, int nZ) void CallMoveCountFields(int nX, int nY, int nZ, int nCount) void CallMoveInsideObject(unit uTarget) void CallStopMoving() void CallLand() void CallTurnToAngle(int nAlphaAngle) void CallGetFlyingSupply() int IsMoving() int IsGettingSupply() int IsLive() int IsDisabled() int GetHP() int GetMaxHP() int GetLocationX() int GetLocationY() int GetLocationZ() int GetAlphaAngle() int GetMoveLocationX() int GetMoveLocationY() int GetMoveLocationZ() int GetMoveLocationAngle() void SetLightsMode(int nMode) int IsFreePoint(int nX, int nY, int nZ) int IsOnGround() void SendSupplyRequest() unit GetAttacker() void ClearAttacker() void SetTargetObject(unit uTarget) int GetAngleToTarget(unit uTarget) int GetAngleToPoint(int nX, int nY, int nZ) unit FindTarget(int nTargetType, int nSideSelection, int nKindSelection, int nDestinationSelection) void BuildTargetsArray(int nTargetType, int nSideSelection, int nDestinationSelection) void BuildTargetsArray(int nTargetType, int nSideSelection, int nDestinationSelection, int nXFrom, int nYFrom, int nZFrom, int nRange) void SortFoundTargetsArray() int GetTargetsCount() int StartEnumTargetsArray() unit GetNextTarget() void EndEnumTargetsArray() unit FindClosestEnemy() unit FindClosestEnemyEx(int nTargetType) unit FindClosestEnemyUnitOrBuilding(int nTargetType) int FindArtefact(int nArtefactMask) int FindArtefact(int nArtefactMask, int nFindRange) int GetFoundArtefactX() int GetFoundArtefactY() int GetFoundArtefactZ() void AllowScriptWithdraw(int nAllow) int IsAllowingWithdraw() int FindSupplyCenterPlace() int GetFoundSupplyCenterPlaceX() int GetFoundSupplyCenterPlaceY() int GetFoundSupplyCenterPlaceZ() int GetCurrSupplyCenterAssemblyPositionX() int GetCurrSupplyCenterAssemblyPositionY() int GetCurrSupplyCenterAssemblyPositionZ() int IsOnWorkingSupplyCenter() int IsWorkingSupplyCenterInPoint(int nX, int nY, int nZ) int HaveBanner() int HaveRadar() int HaveScreamer() int HaveShadow() void MessageTalk(int nMessageNum) int InPlatoon() int IsPlayer(int nIFFNum) int CanBeTransported() int IsTransported() int SetUnitName(string sName) string GetUnitName()
Events
int OnHit() int OnCannonLowAmmo(int nCannonNum) int OnCannonNoAmmo(int nCannonNum) int OnCannonFoundTarget(int nCannonNum, unit uTarget) int OnCannonEndFire(int nCannonNum, int nEndStatus) int OnFreezeForSupplyOrRepair(int nFreezeTicks) int OnTransportedToNewWorld() int OnConvertedToNewPlayer() int OnKilledSupplyCenterBuilding()
Enums
Building types:
buildingNormal buildingPowerPlant buildingSolarPower buildingEnergyTransmitter buildingEnergyBattery buildingBase buildingFactory buildingWaterBase buildingSupplyCenter buildingMine buildingRefinery buildingResourceTransportBase buildingResearchCenter buildingHeadquater buildingBBC buildingPlasmaControl buildingTeleport buildingSDIDefence buildingShadowTower buildingRadar buildingSilos buildingPlasmaCannon buildingGenerator buildingSolarBattery buildingWeatherControl buildingTunnelEntrance buildingCopula buildingLaserWall buildingSpaceStation buildingTransportCenter buildingRecycleCenter [MP] buildingMinningRefinery buildingMinningResourceTransportBase buildingBaseFactory (LC) buildingBadRaceBuilding buildingWaitingForCopulaOpen buildingTransportedDownArtefact masks [MP]:
artefactRegenerateHP artefactRegenerateTemperature artefactRegenerateElectronics artefactRegenerateShield artefactRegenerateExternalAmmo artefactRegenerateEnergyAmmo artefactGiveShieldGenerator artefactGiveMoney artefactShowMap artefactSpecialAI