This document lists all the AI functions used in Warhammer 40,000: Dawn of War.
void DesignerLock( Void )
unsigned long GetID( Void )
unsigned long GetType( Void )
Resource types:
bool IsLocked( Void )
bool IsValid( Void )
void Lock( Void )
void Unlock( Void )
unsigned long GetAbilityID( const char* name )
unsigned long GetAddOnID( const char* name )
const char* GetAddOnName( unsigned long addon_id )
unsigned long GetBuildingID( const char* name )
const char* GetBuildingName( unsigned long sbpid )
PlayerStatsAI::iterator GetPlayerStats( Void )
PlayerStatsAI* GetPlayerStatsFromID( unsigned long player_id )
unsigned long GetResearchID( const char* name )
const char* GetResearchName( unsigned long research_id )
unsigned long GetSquadID( const char* name )
const char* GetSquadName( unsigned long sbpid )
UnitStatsAI::iterator GetUnitStats( Void )
const UnitStatsAI* GetUnitStatsFromBPID( unsigned long bpid )
bool LoadUnitStats( const object stats_table )
void Update( Void )
Vector3f GetPosition( Void )
float GetThreatRating( Void )
bool HasAddOn( unsigned long addon_id )
bool IsStrategicObjective( Void )
float Set( ResourceType rt )
void Set( ResourceType rt, float val )
void BuildAddOn( unsigned long id )
void BuildResearch( unsigned long id )
void BuildSquad( unsigned long id )
BuildChannelAI.CanBuildResult CanAddToQueue( ItemType type, unsigned long index )
bool CanDeepStrike( Void )
bool CanOnlyDeepStrikeToEntity( Void )
summoning can only happen on an entity
bool ConstructionDone( Void )
void DoDeepStrikeToPos( const Math::Vector3f pos )
void DoDeepStrikeToSquad( const Squad* squad )
unsigned long GetBlueprintID( Void )
const Entity* GetEntity( Void )
ResourceAmount GetItemCostAt( ItemType type, unsigned long index)
unsigned long GetItemIDAt( ItemType type, unsigned long index)
unsigned long GetItemIndexFromID( ItemType type, unsigned long id)
const char* GetItemNameAt( ItemType type, unsigned long index)
size_t GetItemRequiredTicksAt( ItemType type, unsigned long index)
size_t GetNumberOfItems( ItemType type)
bool IsBuilding( Void )
void SetRallyPoint( Vector3f pos)
bool CanBuildSquad( unsigned long sbpid)
void CancelBuilding( unsigned long entity_id)
void ClearSquadLimits( Void )
unsigned long FindAnyUnfinishedBuildings( Void )
const Entity* FindUnfinishedBuilding( unsigned long ebpid)
unsigned long GetBuildableBuildingAt( unsigned long index)
returns the ID of a building
const BuildChannelAI::iterator GetBuildChannelAIs( Void )
size_t GetNumBuildableBuildings( Void )
unsigned long GetNumSquadsWithBPID( unsigned long sbpid)
unsigned long GetSquadCapCurrentMax( Void )
unsigned long GetSquadCapLeft( Void )
unsigned long GetSquadCapTotalMax( Void )
int GetSquadLimit( unsigned long sbpid)
unsigned long GetSupportCapCurrentMax( Void )
unsigned long GetSupportCapLeft( Void )
unsigned long GetSupportCapTotalMax( Void )
BuildChannelAI::iterator GetUnlockedBuildChannelAIs( Void )
bool IsGarrisonBuilding( unsigned long ebpid)
bool IsPowerGenerator( unsigned long ebpid)
void SetSquadLimit( const char* squad_name, int num)
void Update( Void )
unsigned long btype( Void )
void CpuBuildType( Void )
unsigned long name( Void )
unsigned long prereq_fulfilled( Void )
bool DoUpdate( Void )
void Enable( bool enable )
SquadAI* FindFirstCommanderEnemy( const Math::Vector3f from, float tolerance, unsigned long count)
SquadAI* FindFirstEnemy( const Math::Vector3f from, float tolerance, unsigned long count )
SquadAI* FindFirstHurtSquad( const Math::Vector3f from, float tolerance)
SquadAI* FindFirstInfantryEnemy( const Math::Vector3f from, float tolerance, unsigned long count)
SquadAI* FindFirstSquadInCombat( const Math::Vector3f from, float tolerance)
SquadAI* FindFirstVehicleEnemy( const Math::Vector3f from, float tolerance, unsigned long count)
BuildManager* GetBuildManager( Void )
AIDifficultyLevel GetDifficultyLevel( Void )
long GetGameTime( Void )
MilitaryManager* GetMilitaryManager( Void )
unsigned int GetPlayerRace( Void )
unsigned int GetPlayerTeam( Void )
ResourceManager* GetResourceManager( Void )
Math::Vector3f GetStartingPosition( Void )
AIStats* GetStats( Void )
CpuTerrainAnalyzer* GetTerrainAnalyzer( Void )
bool IsResearchComplete( const char* research_name )
void NetSay( unsigned int localized_id)
void CpuPrerequisites( CpuPlayer* player, const char* filename, BuildType)
Constructor
unsigned long GetNumUnfulfilledPrerequisites( Void )
CpuBuildType::iterator GetUnfulfilledPrerequisites( Void )
bool PrerequisitesFulfilled( Void )
bool UnfulfilledOwnership( Void )
bool UnfulfilledOwnership( Void )
bool FindClosestFreePosition( unsigned long building_id, const Math::Vector2f wantedPosition, const Math::Vector3f furthest_enemy, Math::Vector3f bestPosition )
MarkerIDs::iterator GetChokepointMarkerIDs( Void )
unsigned long GetClosestChokepointID( const Math::Vector3f pos ) : returns the id of the closest chokepoint -- 0 if no chokepoints are available
unsigned long GetMajorityClassType( Math::Vector3f pos, float tolerance )
Vector3f GetMarkerPositionByID( unsigned int marker_id )
float GetMarkerProximityByID( unsigned int marker_id )
float GetPathingDistance( const Math::Vector3f start_pos, const Math::Vector3f end_pos ) : returns negative value if can't find a path
void GetSafePointBeforeDest( Math::Vector3f best_position, const Math::Vector3f start_pos, const Math::Vector3f end_pos )
float GetThreatAtPos( const Math::Vector3f pos, float radius, bool ignore_friendly ) : If ignore_friendly == true, then don't count negative threat
bool HasThreat( const Math::Vector3f pos, float radius )
bool HasThreatOnPath( const Math::Vector3f start_pos, const Math::Vector3f end_pos, float tolerance )
bool Update( Void )
size_t GetID( Void )
Vector3f GetPosition( Void )
Squad* GetSquad( Void )
unsigned long GetNumEngineers( Void )
const SquadAI::iterator GetSquads( Void )
SquadAI::iterator GetUnlockedSquads( Void )
void Update( Void )
CpuPlayer* AI_GetCpuPlayerFromID( Void )
Returns the Cpu Player?
void aiassert( bool b )
void aiprofile_end( CpuPlayer* player )
void aiprofile_start( CpuPlayer* player )
void Plan:__init()
Ctor
string Plan:GetName()
Get the name of the plan
string needsname, function needs Plan:GetNeeds( )
Get the current needs function
float Plan:GetPriority()
string, function Plan:GetState()
Get the state name and function of this plan
string Plan:GetStatus()
Get the current status of the plan
string wantsname, function wants Plan:GetWants()
Get the current wants function
string Plan:HasResource( int id, AIResource.AI_ResourceType res_type)
Returns true if this plan owns a resource of id and type
Resource types:
void Plan:InvalidState()
State you go into when all else fails
bool Plan:IsComplete()
Returns true if this plan is ready to be deleted
void Plan:LockResource( Resource resource)
Lock the resource (take ownership)
void Plan:Needs()
Grab your needs
void Plan:NeedsFulfilled()
Use this need function when you don't need anything
void Plan:SetComplete( bool complete)
Set whether this plan is ready to be deleted
void Plan:SetName()
Set the name of the plan
void Plan:SetNeeds( function needs)
Set the needs function
void Plan:SetPriority( float priority)
void Plan:SetState( string statename, function state)
Set the current state of the plan
void Plan:SetStatus()
Set the current status of the plan
void Plan:SetWants( function wants)
Set the wants function
void Plan:UnlockAll()
Unlocks all resources this plan owns
void Plan:UnlockResource( Resource resource)
Unlocks a resource that this plan has locked
void Plan:Update()
Run the current state
void Plan:Wants()
Grab your wants
void Plan:WantsFulfilled()
Use this want function when you don't want anything (preposterous!)
float GetArmyCost( Void )
float GetArmyCostAt( const Vector3 pos, float tolerance )
const BaseAI::iterator GetBases( Void )
const EntityGroup::iterator GetBuildingsWithGuns( Void )
float GetClassRating( unsigned long unit_class )
float GetEffectivenessRating( unsigned long unit_class )
unsigned long GetMajorityClassType( Void )
unsigned long GetNumSquads( Void )
unsigned long GetPlayerID( Void )
unsigned long GetPlayerRace( Void )
const char* GetPlayerRaceName( Void )
unsigned long GetPlayerTeam( Void )
const SquadAI::iterator GetSquads( Void )
Math::Vector3f GetStartingPosition( Void )
bool IsEnemy( PlayerStatsAI* player )
bool IsPlayerDead( Void )
size_t GetNumOwnedPowerGenerators( Void )
size_t GetNumOwnedStrategicObjectives( Void )
size_t GetNumOwnedStrategicPoints( Void )
ResourceAmount GetResourceAmount( Void )
Returns the amount of resources this player has
ResourceAmount GetResourceRate( Void )
const SlagHeaps::iterator GetSlagHeaps( Void )
const StrategicPointAI::iterator GetStrategicPointAIs( Void )
size_t GetTotalNumStrategicObjectives( Void )
size_t GetTotalNumStrategicPoints( Void )
StrategicPointAI::iterator GetUnlockedStrategicPointAIs( Void )
StrategicPointAI* SearchForFlagToDisown( const SquadAI* squad, float tolerance_sqr)
void Update( ItemType type, unsigned long index)
Updates the resource knowledge base
void UpdateFreeSlagHeaps( unsigned long bigger_gen_bpid)
size_t GetRace( Void )
EntityGroup GetEntities( Void )
Vector3f GetPosition( Void )
float GetTightPackedSize( Void )
bool CanAttachTo( SquadAI* squad_ai )
SquadAI.CanBuildResult CanBuild( unsigned long ebpid)
returns a Squad AI.Can Build Result? enum — CANBUILD_Ok if the squad can build it
bool CanBuildAt( unsigned long ebpid, Vector3f pos)
returns true if this building can be built at that location
bool CanCapture( Void )
bool CanDoAbility( unsigned long ability_id )
bool CanJump( Void )
bool CanJumpToPosition( Math::Vector3f pos )
bool CanPossess( Void )
bool CanReceiveAttachment( Void )
bool CanReinforce( bool leader)
returns true if this squad can reinforce, or can have a leader
bool CanSummon( Void )
void DoAttachSquad( SquadAI* attach_to )
void DoAttackMove( const Vector3f pos)
bool DoBestUpgrade( unsigned long enemy_unit_class)
do the best upgrade I can given this enemy unit class — returns false if no upgrades available
void DoBuildBuilding( unsigned long ebpid, Vector3f pos )
void DoCapture( const Entity* strategic_point )
void DoDefault( const Entity* entity )
void DoDetachSquad( Void )
void DoFinishBuilding( const Entity* building )
void DoJump( Math::Vector3f pos )
void DoMove( const Vector3f pos )
bool DoMoveToClosestCover( float tolerance)
returns false if cover is further away than tolerance
void DoMoveToClosestSafePoint( Math::Vector3f best_position)
fills in best_position to be the position of the closest safe point
void DoPossess( Void )
void DoReinforce( bool leader )
void DoRepair( const Entity* building )
void DoSetDefaultMeleeStance( Void )
void DoSetMeleeStance( StanceTypeMelee stance )
void DoSetStance( StanceType stance )
void DoSpecialAbility( unsigned long ability_id )
void DoSpecialAbilityPos( unsigned long ability_id, const Vector3f pos )
void DoSpecialAbilitySquad( unsigned long ability_id, const Squad* squad )
void DoStop( Void )
float GetAbilityRange( unsigned long ability_id )
float GetAttachedHealthPercentage( Void )
void unsigned long GetBuildingEntityID( Void )
returns the entity id of the structure we're building
float GetHealthPercentage( Void )
float GetJumpDistance( Void )
StanceTypeMelee GetMeleeStance( Void )
float GetMoralePercentage( Void )
unsigned long GetNumTroopers( Void )
Vector3f GetPosition( Void )
float GetProRatedCost( Void )
const Squad* GetSquad( Void )
StanceType GetStance( Void )
const char* GetStateName( Void )
const UnitStatsAI* GetStats( Void )
NOTE: may return nil
Tactic* GetTactic( Void )
bool GetTargetPos( Math::Vector3f out )
bool HasLeader( Void )
bool HasSetupTime( Void )
bool HasSquadAttached( const char* squad_name )
bool HasUpgradableTrooper( Void )
bool IsAttached( Void )
bool IsBroken( Void )
unsigned long IsBuilding( Void )
returns the id of the thing we're building, or zero if none
bool IsBuildProgressing( Void )
bool IsCapturing( Void )
bool IsEngineer( Void )
bool IsIdle( Void )
bool IsInCombat( Void )
bool IsInStateAttackMove( Void )
bool IsInStateMove( Void )
bool IsRanged( Void )
bool IsReinforcing( Void )
covers reinforcing, building a leader and upgrading
bool IsUsingAbility( unsigned long ability_id )
bool IsValid( Void )
returns true if the squad still exists
bool WasAttackedSince( Void )
bool WasRecentlyHurt( Void )
bool FinishedCapturing( Void )
float GetCaptureProgress( Void )
percentage captured: [0,1]
const Entity* GetEntity( Void )
bool HasListeningPost( Void )
bool HasWeapons( Void )
bool IsBeingCaptured( Void )
bool IsStrategicObjective( Void )
bool IsTagged( Void )
returns true if an engineer already tagged this flag to get close to
size_t Owner( Void )
returns the ID of the owner — Zero if no owner
bool ShouldDisown( const Math::Vector3f from, unsigned long player_team, float tolerance_sqr)
void TagFlagForEngineer( bool tag)
tag to let engineers get close to flags that are about to be captured
void Strategy:__init()
Ctor
void Strategy:AddPlan( Plan plan)
Adds a plan to the strategy
void Strategy:AdoptStrategy( Strategy strategy)
Adpot control of all the plans that the strategy is running
void Strategy:BuildPrereq( CpuPrerequisites.BuildType build_type)
Builds creates a plan to build a prerequisite
void Strategy:DoPlan( Plan plan)
Updates a plan
string Strategy:FindPlan( string plan_name, int id, Plan plan)
Returns the name of the plan if plan is equal to the name and id passed in (nil otherwise)
void Strategy:ForceReleaseAll()
Forces the release of all resources the strategy owns
void Strategy:ForceReleaseResource( int!id!AIResource res_type)
Forces the release of a resource if the strategy owns it
string Strategy:GetName()
Get the name of the strategy
float Strategy:GetPriority()
void Strategy:IsBaseBeingAttacked()
returns the base being attacked, nil if none
bool Strategy:PlanExists( Plan plan, int id)
Returns true if this plan already exists
void Strategy:ResetDemand()
Reset all the demand tables
void Strategy:SetPriority( float priority)
void Strategy:TryBuild( int id)
Tries to build the squad, or it's prerequisites (may fail)
void Strategy:Update()
Update the current state of the strategy
float GetAverageEffectiveness( unsigned long unit_class )
float GetBaseEffectiveness( unsigned long unit_class )
unsigned long GetClass( Void )
float GetClassRating( Void )
float GetCost( ResourceAmount::ResourceType rt )
unsigned long GetID( Void )
unsigned long GetSquadCapReq( Void )
unsigned long GetSquadName( Void )
unsigned long GetSupportCapReq( Void )
long GetTicksToBuild( Void )
bool IsEngineer( Void )
float Length( Void )
float LengthSquared( Void )
Vector2f operator-( Vector2f c )
Vector2f operator+( Vector2f c )
void Vector2f( Vector2f c)
Copy Constructor
void Vector2f( Void )
Constructor
float x( Void )
attribute (not a function)
float y( Void )
attribute (not a function)
float Length( Void )
float LengthSquared( Void )
Vector3f operator-( Vector3f c)
Vector3f operator+( Vector3f c)
void Vector3f( float x, float y, float z)
Constructor
void Vector3f( Void )
Constructor
void Vector3f( Vector3f c)
Copy Constructor
float x( Void )
attribute (not a function)
float y( Void )
attribute (not a function)
float z( Void )
attribute (not a function)