| Home Page | Recent Changes | Preferences

# GameObjective

UT2003 :: Actor >> NavigationPoint >> JumpDest >> JumpSpot >> GameObjective

Actors of class GameObjective (or rather subclasses thereof) are part of UT2003's bot support.

While a GameObjective is "active", bot?s of one team seek it out, bots of the other try and defend it. When the attacking team reaches it, they "disable" it in some way – the various subclasses tell the bots that they need to do (can a coder confirm this bit?)

Ways to disable:

- DestroyableObjective does it when the objective's Health reaches zero.
- KeyInventory? in conjunction with a LockedObjective when a player bearing the key approaches the locked objective.
- TriggeredObjective when a player triggers the objective.

The GameObjective actor can be tied to defense points created with UnrealScriptedSequences, and routes to the objective are defined with AssaultPaths.

## Coding with GameObjectives

Normally, a GameObjective will be added to a map manually by level designers, but it is possible to have game code spawn GameObjective objects (of subclasses where bStatic and bNoDelete are both set to False), but since they're not part of the navigation network bots won't find them. To facilitate that anyway, overwrite TellBotHowToDisable in your GameObjective subclass and direct the bot to a nearby regular actor (either a static NavigationPoint that has been pathed or an actor not derived from NavigationPoint at all).

You might also need to set the bCollideWhenPlacing property to False so that the spawn actually succeeds if you try to spawn it at the map origin. This is one reason why the code might work on some maps and not on others.

## Editable Properties

### General

(Events) name Event
  Event that is fired when this objective has been disabled.
bool bTeamControlled
  Disabling this objective changes the objective's team rather than removing it. (Used for Domination control points.)
bool bAccruePoints
  If set, the controlling team accrues points. (Can be used for Unreal Tournament-style Domination control points.)
byte DefenderTeamIndex
  Team number of the team defending this objective (0 = red, 1 = blue).
byte DefensePriority
  Relative defense priority for this objective. Higher values mean higher priority.
int Score
  If the bAccruePoints property is set, score given to the team holding this objective every second. Otherwise, score given to player who completes/disables this objective.

### Bot Support

name DefenseScriptTags
  Tag of UnrealScriptedSequences used by bots that defend this objective.
name AreaVolumeTag
  Optional tag of a Volume defining the base area around this objective. Used by the game to determine whether a bot is close to this objective.
float BaseRadius
  Radius of a simple base area around this objective. Can be used instead of or in addition to AreaVolumeTag.
float BaseExitTime
  Time (in seconds) it takes a bot to get entirely away from the base. In CTF, used by bots to make a guess whether an enemy has already left the base after taking the flag.

### Information

string ObjectiveName (localized)
  Human-readable name of this objective.
string DestructionMessage (localized)
  Message displayed when this objective has been destroyed.
string LocationPrefix (localized)
string LocationPostfix (localized)
  Text displayed before/after the human-readable objective name as a player's location in the scoreboard.

## Variables

### General

bool bDisabled
  Set by DisableObjective when this objective has been disabled/destroyed.
byte StartTeam
  Initial value of DefenderTeamIndex. Set by PostBeginPlay and used solely by the Reset function.

### Bot Support

UnrealScriptedSequence DefenseScripts
  First UnrealScriptedSequence in a linked list of defense scripts associated with this objective. PostBeginPlay looks for scripts whose Tag matches the objective's DefenseScriptTags property and initializes the DefenseScripts variable with a reference to the first script in the linked list.
bool bHasShootSpots
  Used exclusively by [Bombing Run]? bot support and specifies whether a goal has associated ShootSpot?s from where the bomb can be shot through the hoop. Set by PostBeginPlay in xBombDelivery, used by BombingRunSquadAI?.
AssaultPath AlternatePaths
  Not used anywhere.
Volume MyBaseVolume
  Initialized with a reference to the volume specified by the AreaVolumeTag property (see above). Used by BotNearObjective.

### Internal

bool bFirstObjective
  Used internally to link all objectives by their NextObjective property in PostBeginPlay. Set to True only for the first objective in the linked list.
GameObjective NextObjective
  Links to the next objective in the linked objective list.

## Functions

### General

PostBeginPlay()
  Performs several initialization tasks:
  - Finds the first UnrealScriptedSequence in the linked list whose Tag matches the tag given by the DefenseScriptTags property and stores a reference to it in the DefenseScripts variable.
  - Chains all GameObjective actors found in the map to a list linked by the NextObjective variable. The first GameObjective actor in the list has its bFirstObjective variable set to `True`. The SetObjectiveLists function in TeamAI (and other functions there) use this to find the start of the chain.
  - Finds the Volume specified by the AreaVolumeTag property and stores a reference to it in the MyBaseVolume variable.
  - If the bAccruePoints property is set, starts the timer with a one-second interval.
Timer()
  If the bAccruePoints property is set, adds the number of points specified in the Score property to the total score of the team currently holding this objective.
float GetDifficulty()
  Returns a generic "difficulty" value. Only implemented by the xBombDelivery subclass of GameObjective and used by function PreferShootScore in BombingRunSquadAI? to make a decision whether a bot prefers shooting through the hoop or making a touchdown.
function PlayAlarm()
  Can be overwritten in subclasses to play an alarm (for instance when a domination point or a flag is taken). Must be explicitely called.
DisableObjective(Pawn Instigator)
  Called when this objective has been disabled. The default implementation fires the objective's Event, gives points to the attackers and changes the attacking bots' orders. Various other classes call DisableObjective:
  - DestroyableObjective does it when the objective's Health reaches zero.
  - KeyInventory? in conjunction with a LockedObjective when a player bearing the key approaches the locked objective.
  - TriggeredObjective when a player triggers the objective.

### Bot Support

bool BotNearObjective(Bot B)
  Returns whether the given Bot? is "near" this objective. Uses the volume specified through the AreaVolumeTag property and the BaseRadius property to figure that out.
bool OwnsDefenseScript(UnrealScriptedSequence S)
  Checks and returns whether the given UnrealScriptedSequence is in the list of defense scripts for this objective.
bool TellBotHowToDisable(Bot B)
  Tells the given bot how to disable this objective; the default implementation simply shows the bot a path to it. Only returns True if valid and useable orders were given to the bot. Called by CheckSquadObjectives in SquadAI (which in turn is indirectly called by a Bot? itself).
int GetNumDefenders()
  Returns the number of players and bots currently defending this objective. Used by the GetLeastDefendedObjective and GetMostDefendedObjective functions in TeamAI (which in turn are used to make a decision about where to send bots for attack or defense).

### Information

string GetHumanReadableName() (simulated)
  Inherited from Actor. Returns a human-readable name for this objective. Used for logging.
bool BetterObjectiveThan(GameObjective Best, byte DesiredTeamNum, byte RequesterTeamNum)
  Solely used to display WillowWhisp?s to show (human) players the path to the next objective.

## Subclasses

- CTFBase
- DestroyableObjective
- DominationPoint?
- LockedObjective
- TouchableObjective (custom class)
- TriggeredObjective
- xBombDelivery
- xBombSpawn

## Related Topics

- Bot Support
- TeamAI
- SquadAI

Category Class (UT2003)

The Unreal Engine Documentation Site

Wiki Community

Topic Categories

Image Uploads

Random Page

Recent Changes

Offline Wiki

Unreal Engine

Console Commands

Terminology

Mapping Topics

Mapping Lessons

UnrealEd Interface

Questions&Answers

Scripting Topics

Scripting Lessons

Making Mods

Class Tree

Questions&Answers

Modeling Topics

Questions&Answers

Log In