G1R AngelScript
Scripting reference for the Gothic 1 Remake
Loading...
Searching...
No Matches
UGameplayAbility_CharacterAI Class Reference

Characters that have this ability will have the ability to think for themselves! More...

Public Member Functions

Functions
AGothicCharacter GetSelf () const
 Character this state belongs to.
UGothicAIGroup GetGroupOfClass (TSubclassOf< UGothicAIGroup > GroupClass) const
UCharacterAIState FindActiveStateByClass (TSubclassOf< UCharacterAIState > StateClass) const
UAIValueSet SpawnedStorage (TSubclassOf< UAIValueSet > ValueSetClass) const
UAIValueSet PermanentStorage (TSubclassOf< UAIValueSet > ValueSetClass) const
bool AssessEvent (FGameplayTag AIEventTag, FRememberedPerception FromPerception)
 Call this from a PerceptionHandler (or somewhere else) when a certain event happened and you want the AI to react to that. Returns true, if a response was found and executed. False if no response was configured/wanted by the current AI state.
void AssessEventFromPerception (FRememberedPerception Perception, FPerceptionShortTermMemory Memory, FGameplayTag Assess)
 Performs an AssessEvent from the given perception.
bool AssessEventWithExtraTags (FGameplayTag AIEventTag, FRememberedPerception FromPerception, FGameplayTagContainer ExtraEventTags)
 Same as AssessEvent, but allows passing ExtraEventTags along with the Assessment.
int64 EvaluateAssessmentConditions (int64 RequiredConditionBits, FGameplayTag ForEvent, FRememberedPerception ForPerception)
 Override this to evaluate the condition bits as requested in RequiredConditionBits for an incmming event assessment.
void HandleKilledCharacter (AGothicCharacterState KilledCharacter, TSubclassOf< UWeaponDefinition > UsedWeapon, FGameplayTagContainer &OutAdditionalMemoryTags)
 Called when this character killed another character. Can be used to modify the death-memory event tags.
void HandleRevivedInSimulation ()
 Called when this NPC was revived during DailyRoutineSimulation.
void SetupPerceptions (UCharacterPerceptionComponent Perception)
 Override this to setup the perception handlers for this Ability.
int CancelAITasksOfClass (TSubclassOf< UAbilityTask_AI > Class)
 Cancels all currently running AI tasks (not states!) of the given class. Returns the number of cancelled tasks.
void CancelAllExceptRootState ()
 Cancels all currently running tasks/substates, except our current root state.
void CancelAllStatesAndTasks ()
 Cancel everything that us currently running. Leaves the AI without anything to do, also leaves all states.
void CancelConversationStateAndDoDailyRoutine ()
 Cancels the the ConversationState if active and does DailyRoutine if nothing else has been scheduled.
int CancelStatesOfClass (TSubclassOf< UCharacterAIState > Class)
 Cancels all currently running tasks/substates of the given class. Returns the number of cancelled states.
UGothicAIGroup CreateAndJoinGroup (TSubclassOf< UGothicAIGroup > GroupClass)
 If this npc is not already part of the given group, creates one, joins it and returns the newly created group. Otherwise the group we're already part of is returned.
void EndAllStatesAndTasks ()
 Force-end everything that us currently running. Leaves the AI without anything to do, also leaves all states.
UWeaponMeleeDefinition FindBestMeleeWeapon ()
UWeaponArcheryDefinition FindBestRangedWeapon ()
TSet< UGothicAIGroup > FindGroupInCharactersAtLocation (TSubclassOf< UGothicAIGroup > GroupClass, FVector Location, float32 Radius)
 Returns all active kinds of the given group that are at the given location within the given radius.
TSet< UGothicAIGroup > FindGroupInPerceivedCharacters (TSubclassOf< UGothicAIGroup > GroupClass)
 Returns all active kinds of the given group that are available among the perceived characters.
TArray< UAbilityTaskGeneric > GetActiveTasksOfClass (TSubclassOf< UAbilityTaskGeneric > TaskClass)
 Returns all tasks of the given class that are currently active on the AI.
UCharacterAIState GetCurrentRootState () const
 Returns the currently active state (bottom of the stack).
UCharacterAIState GetCurrentState () const
 Returns the currently active state (top of the stack).
const UTerritoryConfig GetCurrentTerritory () const
 Returns Config of Territory at the location this Character would be supposed to be at based on Daily Routine.
TSubclassOf< UTerritoryConfig > GetCurrentTerritoryClass () const
 Returns Config of Territory at the location this Character would be supposed to be at based on Daily Routine.
UAIState_DailyRoutine GetDailyRoutineIfActive () const
 Returns the daily routine state, if it's currently active. nullptr otherwise.
UAIState_DailyRoutine GetDailyRoutineTemplate () const
 Returns the currently configured daily routine template, no matter whether the routine is active or now.
AActor GetPersistentSelf () const
 Actor that is always available, even when the character is despawned (FIXME: Remove after the proxy-refactor).
const UCharacterAIState GetScheduledDailyRoutineAIStateTemplate () const
 Returns the template of AIState that would be active if the DailyRoutine was running. Null if no daily routine exists.
void BindAssessmentToPerception (FPerceptionHandler &PerceptionHandler, FGameplayTag WhenGained=FGameplayTag ::Empty, FGameplayTag WhenLost=FGameplayTag ::Empty)
AGothicCharacter GetTargetEnemy () const
 Returns the currently targeted enemy character.
bool HasCurrentTerritoryOfClass (TSubclassOf< UTerritoryConfig > TerritoryClass)
 Returns true if this Character currently belongs to the given territory.
bool HasInPermanentStorage (TSubclassOf< UAIValueSet > ValueSetClass) const
 Returns true if the given ValueSet already exists in PermanentStorage.
bool HasInSpawnedStorage (TSubclassOf< UAIValueSet > ValueSetClass) const
 Returns true if the given ValueSet already exists in SpawnedStorage.
bool HasPendingScheduledState () const
 Returns true, if there is any pending AIState to be activated when the current state ends.
bool IsDoingAITaskOfClass (TSubclassOf< UAbilityTask_AI > AITaskClass) const
 Returns true if the character is doing an AITask of the given class.
bool IsDoingConversationState () const
 Whether this character is doing its conversation state right now (.
bool IsDoingDailyRoutine () const
 Whether this character is doing its daily routine right now (.
bool IsFocusedBy (AGothicCharacter Other)
 Returns true of the given other Character is focusing this NPC.
bool IsInState (TSubclassOf< UCharacterAIState > StateClass) const
 Returns true if this character is currently doing the given state.
bool IsUnconscious () const
 True while being defeated, frozen, etc.
void JoinGroup (UGothicAIGroup Group)
 Joins the given group. The NPC must not be part of a group with the same class already!
void LeaveAllGroups ()
 Removes the NPC from all groups.
void LeaveGroupsWithClass (TSubclassOf< UGothicAIGroup > GroupClass)
 Removes the NPC from all groups that are based on the given class.
void ProcessAllPendingAssessments ()
 Executes all pending assessment calls, ignoring any budgeting.
float32 RateMeleeWeaponStrength (UWeaponMeleeDefinition Weapon)
float32 RateRangedWeaponStrength (UWeaponArcheryDefinition Weapon)
void RemoveFromPermanentStorage (TSubclassOf< UAIValueSet > ValueSetClass)
 Forcefully removes the given value set from PermanentStorage.
void RemoveFromSpawnedStorage (TSubclassOf< UAIValueSet > ValueSetClass)
 Forcefully removes the given value set from SpawnedStorage.
bool ResolveLocationByName (FName KnownLocationName, FVector &OutVector) const
 Looks up the location vector to the given name. The name could be any waypoint, freepoint, preferred location. If the Character doesn't "know" this location, it's assumed to be some freepoint or waypoint in the world.
void SetTargetEnemy (AGothicCharacter EnemyActor, EGothicFocusPriority FocusPriority, UAbilityTaskGeneric TaskLifeAnchor=nullptr)
 Keeps the character oriented towards this character, if possible.
void SetTargetEnemyComponent (USceneComponent EnemyActorComponent, EGothicFocusPriority FocusPriority, UAbilityTaskGeneric TaskLifeAnchor=nullptr, FName SocketName=NAME_None)
 Keeps the character oriented towards this Component, if possible. (Must be attached to an AGothicCharacter) @oaram FocusPriority Priority that the focus should have.
void StopTargetingEnemy (EGothicFocusPriority FocusPriority)
 Stops targeting whatever we're currently targeting.
void SwitchAIState (UCharacterAIState State, AGothicCharacter Other=nullptr)
 Switches to the given AI state. The current state will be given a chance to gracefully exit.
void SwitchAIStateImmediately (UCharacterAIState State, AGothicCharacter Other=nullptr)
 Hard-cancels the current AI state and immediately switches to the given state. The currently active task will NOT be given a chance to perform any graceful exit.
void SwitchAIStateImmediatelyToClass (TSubclassOf< UCharacterAIState > StateClass, AGothicCharacter Other=nullptr)
 Hard-cancels the current AI state and immediately creates and switches to the given state. The currently active task will NOT be given a chance to perform any graceful exit.
void SwitchAIStateWithOthers (UCharacterAIState State, TArray< AGothicCharacter > Others)
 Switches to the given AI state. The current state will be given a chance to gracefully exit.
void SwitchAIStateWithOthersImmediately (UCharacterAIState State, TArray< AGothicCharacter > Others)
 Hard-cancels the current AI state and immediately switches to the given state. The currently active task will NOT be given a chance to perform any graceful exit.
void SwitchToConversationState ()
 Switches to the ConversationState if no other states are currently active.
void SwitchToDailyRoutine ()
 Switches to the DailyRoutine if no other states are currently active.
void SwitchToDailyRoutineIfNothingElseToDo ()
 Switches to the DailyRoutine if no other states are currently active.
Public Member Functions inherited from UGameplayAbility_AI
AGothicCharacter GetCharacter () const
 Character this ability belongs to (If the owner is a character).
AGothicCharacterState GetCharacterState () const
 Character State this ability belongs to.
AGothicNPCState GetNPCState () const
 Character State this ability belongs to (If owner is an NPC).
AGothicAIController GetAIController () const
 AIController if the owning character has one.
Public Member Functions inherited from UGameplayAbilityBase
bool Getm_bCanEverTick () const
void TriggerEndOn (const FGameplayTag Tag)
 To be called in the constructor. Cancels this ability when an event with the given GameplayTag fires.
bool Getm_ActivateAbilityOnGranted () const
void Setm_ActivateAbilityOnGranted (bool Value)
bool Getm_TickEnabled () const
void Setm_TickEnabled (bool Value)
void TriggerBeginOn (const FGameplayTag Tag, EGameplayAbilityTriggerSource TriggerSource=EGameplayAbilityTriggerSource ::GameplayEvent)
 To be called in the constructor. Lets this ability start when an event with the given GameplayTag fires.
void Setm_bCanEverTick (bool Value)
bool Getm_FinishOnInputReleased () const
void Setm_FinishOnInputReleased (bool Value)
bool Getm_OnlyPlayer () const
void Setm_OnlyPlayer (bool Value)
Public Member Functions inherited from UGameplayAbility
UObject GetSourceObject (FGameplayAbilitySpecHandle Handle, FGameplayAbilityActorInfo ActorInfo) const
void MontageJumpToSection (FName SectionName)
 Immediately jumps the active montage to a section.
void MontageStop (float32 OverrideBlendOutTime=- 1.000000)
 Stops the current animation montage.
void MontageSetNextSectionName (FName FromSectionName, FName ToSectionName)
 Sets pending section on active montage.
UAnimMontage GetCurrentMontage () const
 Returns the currently playing montage for this ability, if any.
TArray< FActiveGameplayEffectHandle > ApplyGameplayEffectSpecToTarget (const FGameplayEffectSpecHandle EffectSpecHandle, FGameplayAbilityTargetDataHandle TargetData)
 Apply a previously created gameplay effect spec to a target.
TArray< FActiveGameplayEffectHandle > ApplyGameplayEffectToTarget (FGameplayAbilityTargetDataHandle TargetData, TSubclassOf< UGameplayEffect > GameplayEffectClass, int GameplayEffectLevel=1, int Stacks=1)
 Apply a gameplay effect to a Target.
void RemoveGameplayEffectFromOwnerWithAssetTags (FGameplayTagContainer WithAssetTags, int StacksToRemove=- 1)
 Removes GameplayEffects from owner which match the given asset level tags.
void RemoveGameplayEffectFromOwnerWithGrantedTags (FGameplayTagContainer WithGrantedTags, int StacksToRemove=- 1)
 Removes GameplayEffects from owner which grant the given tags.
void RemoveGameplayEffectFromOwnerWithHandle (FActiveGameplayEffectHandle Handle, int StacksToRemove=- 1)
 Removes GameplayEffect from owner that match the given handle.
void CancelTaskByInstanceName (FName InstanceName)
 Add any task with this instance name to a list to be canceled (not ended) next frame. See also EndTaskByInstanceName.
void ConfirmTaskByInstanceName (FName InstanceName, bool bEndTask)
 Finds all currently active tasks named InstanceName and confirms them. What this means depends on the individual task. By default, this does nothing other than ending if bEndTask is true.
void EndAbilityState (FName OptionalStateNameToEnd)
 Ends any active ability state task with the given name. If name is 'None' all active states will be ended (in an arbitrary order).
void EndTaskByInstanceName (FName InstanceName)
 Add any task with this instance name to a list to be ended (not canceled) next frame. See also CancelTaskByInstanceName.
int GetAbilityLevel () const
 Returns current level of the Ability.
int GetAbilityLevel_BP (FGameplayAbilitySpecHandle Handle, FGameplayAbilityActorInfo ActorInfo) const
 Returns current ability level for non instanced abilities. You must call this version in these contexts!
UAbilitySystemComponent GetAbilitySystemComponentFromActorInfo () const
 Returns the AbilitySystemComponent that is activating this ability.
FGameplayAbilityActorInfo GetActorInfo () const
 Returns the actor info associated with this ability, has cached pointers to useful objects.
AActor GetAvatarActorFromActorInfo () const
 Returns the physical actor that is executing this ability. May be null.
FGameplayEffectContextHandle GetContextFromOwner (FGameplayAbilityTargetDataHandle OptionalTargetData) const
 Generates a GameplayEffectContextHandle from our owner and an optional TargetData.
float32 GetCooldownTimeRemaining () const
 Returns the time in seconds remaining on the currently active cooldown.
void CommitExecute ()
 BP event called from CommitAbility.
UObject GetCurrentSourceObject () const
 Retrieves the SourceObject associated with this ability. Can only be called on instanced abilities.
FGameplayEffectContextHandle GetGrantedByEffectContext () const
 Retrieves the EffectContext of the GameplayEffect that granted this ability. Can only be called on instanced abilities.
AActor GetOwningActorFromActorInfo () const
 Returns the actor that owns this ability, which may not have a physical location.
USkeletalMeshComponent GetOwningComponentFromActorInfo () const
 Convenience method for abilities to get skeletal mesh component - useful for aiming abilities.
UObject GetSourceObject_BP (FGameplayAbilitySpecHandle Handle, FGameplayAbilityActorInfo ActorInfo) const
 Retrieves the SourceObject associated with this ability. Callable on non instanced.
void InvalidateClientPredictionKey () const
 Invalidates the current prediction key. This should be used in cases where there is a valid prediction window, but the server is doing logic that only it can do, and afterwards performs an action that the client could predict (had the client been able to run the server-only code prior). This returns instantly and has no other side effects other than clearing the current prediction key.
bool IsLocallyControlled () const
 True if the owning actor is locally controlled, true in single player.
void ActivateAbility ()
 The main function that defines what an ability does. -Child classes will want to override this -This function graph should call CommitAbility -This function graph should call EndAbility.
void ActivateAbilityFromEvent (FGameplayEventData EventData)
void AddGameplayCue (FGameplayTag GameplayCueTag, FGameplayEffectContextHandle Context, bool bRemoveOnAbilityEnd=true)
 Adds a persistent gameplay cue to the ability owner. Optionally will remove if ability ends.
void AddGameplayCueWithParams (FGameplayTag GameplayCueTag, FGameplayCueParameters GameplayCueParameter, bool bRemoveOnAbilityEnd=true)
 Adds a persistent gameplay cue to the ability owner. Optionally will remove if ability ends.
FActiveGameplayEffectHandle ApplyGameplayEffectSpecToOwner (const FGameplayEffectSpecHandle EffectSpecHandle)
 Apply a previously created gameplay effect spec to the owner of this ability.
FActiveGameplayEffectHandle ApplyGameplayEffectToOwner (TSubclassOf< UGameplayEffect > GameplayEffectClass, int GameplayEffectLevel=1, int Stacks=1)
 Apply a gameplay effect to the owner of this ability.
bool CanActivateAbility (FGameplayAbilityActorInfo ActorInfo, const FGameplayAbilitySpecHandle Handle, FGameplayTagContainer &RelevantTags) const
 Returns true if this ability can be activated right now. Has no side effects.
void CancelAbility ()
 Call from Blueprint to cancel the ability naturally.
bool CheckAbilityCooldown ()
 Checks the ability's cooldown, but does not apply it.
bool CheckAbilityCost ()
 Checks the ability's cost, but does not apply it.
bool CommitAbility ()
 Attempts to commit the ability (spend resources, etc). This our last chance to fail. Child classes that override ActivateAbility must call this themselves!
bool CommitAbilityCooldown (bool BroadcastCommitEvent=false, bool ForceCooldown=false)
 Attempts to commit the ability's cooldown only. If BroadcastCommitEvent is true, it will broadcast the commit event that tasks like WaitAbilityCommit are listening for.
bool CommitAbilityCost (bool BroadcastCommitEvent=false)
 Attempts to commit the ability's cost only. If BroadcastCommitEvent is true, it will broadcast the commit event that tasks like WaitAbilityCommit are listening for.
FGameplayAbilityTargetingLocationInfo MakeTargetLocationInfoFromOwnerActor ()
 Creates a target location from where the owner avatar is.
void EndAbility ()
 Call from blueprints to forcibly end the ability without canceling it. This will replicate the end ability to the client or server which can interrupt tasks.
void EndAbilityLocally ()
 Call from blueprints to end the ability naturally. This will only end predicted abilities locally, allowing it end naturally on the client or server.
void ExecuteGameplayCue (FGameplayTag GameplayCueTag, FGameplayEffectContextHandle Context)
 Invoke a gameplay cue on the ability owner.
void ExecuteGameplayCueWithParams (FGameplayTag GameplayCueTag, FGameplayCueParameters GameplayCueParameters)
 Invoke a gameplay cue on the ability owner, with extra parameters.
bool HasAuthority () const
void OnEndAbility (bool bWasCancelled)
 Blueprint event, will be called if an ability ends normally or abnormally.
void RemoveGameplayCue (FGameplayTag GameplayCueTag)
 Removes a persistent gameplay cue from the ability owner.
bool ShouldAbilityRespondToEvent (FGameplayAbilityActorInfo ActorInfo, FGameplayEventData Payload) const
 Returns true if this ability can be activated right now. Has no side effects.
FGameplayEffectSpecHandle MakeOutgoingGameplayEffectSpec (TSubclassOf< UGameplayEffect > GameplayEffectClass, float32 Level=1.000000) const
 Convenience method for abilities to get outgoing gameplay effect specs (for example, to pass on to projectiles to apply to whoever they hit).
void RemoveGrantedByEffect ()
 Removes the GameplayEffect that granted this ability. Can only be called on instanced abilities.
FGameplayAbilityTargetingLocationInfo MakeTargetLocationInfoFromOwnerSkeletalMeshComponent (FName SocketName)
 Creates a target location from a socket on the owner avatar's skeletal mesh.
void SendGameplayEvent (FGameplayTag EventTag, FGameplayEventData Payload)
 Sends a gameplay event, also creates a prediction window.
void SetCanBeCanceled (bool bCanBeCanceled)
 Sets whether the ability should ignore cancel requests. Only valid on instanced abilities.
void SetShouldBlockOtherAbilities (bool bShouldBlockAbilities)
 Sets rather ability block flags are enabled or disabled. Only valid on instanced abilities.
Public Member Functions inherited from UObject
bool MarkPackageDirty () const
void RemoveFromRoot ()
bool GetIsRooted () const
bool IsTransient () const
bool Modify (bool bAlwaysMarkDirty=true)
void SetTransactional (bool bTransactional)
bool IsSupportedForNetworking () const
UClass GetClass () const
UObject GetOuter () const
UObject GetTypedOuter (TSubclassOf< UObject > Target) const
 Traverses the outer chain searching for the next object of a certain type.
UPackage GetOutermost () const
UPackage GetPackage () const
void AddToRoot ()
UWorld GetWorld () const
FName GetName () const
FString GetFullName (const UObject StopOuter=nullptr) const
FString GetPathName (const UObject StopOuter=nullptr) const
bool IsA (const UClass Class) const
 Returns true if this object is of the specified type, or a child of that type.
void SaveConfig ()
void LoadConfig ()
void ReloadConfig ()
void CopyScriptPropertiesFrom (const UObject OtherObject)
void opCast (?&Address) const
FString ToString () const

Static Public Member Functions

Static Functions
static UClass StaticClass ()
Static Public Member Functions inherited from UGameplayAbility_AI
static UClass StaticClass ()
Static Public Member Functions inherited from UScriptGameplayAbility
static UClass StaticClass ()
Static Public Member Functions inherited from UGameplayAbilityBase
static UClass StaticClass ()
Static Public Member Functions inherited from UGameplayAbility
static UClass StaticClass ()
Static Public Member Functions inherited from UObject
static UClass StaticClass ()

Public Attributes

GameplayAbility_CharacterAI
TSubclassOf< UAIAssessmentResponseModule > AssessmentModuleClass
 How to react to certain perception events. Bottom-Level priority.
TSubclassOf< UCharacterAIState > ConversationAIStateClass
 AIState to be in during conversations.
TSubclassOf< UAIState_SelfConversation > SelfConversationAIStateClass
 AIState to be in during conversations without any partner.
TSubclassOf< UCharacterAIState > AfterDefeatedAIStateClass
 AIState to do after standing up from being defeated.
TSubclassOf< UCharacterAIState > DefeatedAIStateClass
 AIState to enter when being defeated.
TSubclassOf< UCharacterAIState > ControlledAIStateClass
 AIState to do when being controlled via spell.
TSubclassOf< UCharacterAIState > FoundSomeoneInMyBedAIStateClass
 AIState to be done after finding someone in this NPCs bed during the night.
TSubclassOf< UCharacterAIState > InterruptedSomeoneWaitingAIStateClass
 AIState to be done after finding someone sitting on a chair in a forbidden area why using skip-time.
TArray< UCharacterAIState > CurrentStateStack
 Current state the AI is in. Each Character can be only in one main state at a time!
TSet< UAbilityTask_AI > ActiveAITasks
 All AITasks that are currently running on this AI-Ability.
UCharacterAIState ScheduledNextState
 State that should be activated after the CurrentState has exited.
TSubclassOf< UAIAssessmentResponseModule > HighPriorityAssessmentModuleClass
 How to react to certain perception events. Top-Level priority. (Overrides all AIStates, Dailyroutine, base layer).
TSubclassOf< UAIState_DailyRoutine > InitialDailyRoutineClass
 Daily routine to start with if none was specified in the character state.
TMap< TSubclassOf< UGothicAIGroup >, UGothicAIGroup > JoinedGroups
TMap< TSubclassOf< UAIValueSet >, TSubclassOf< UAIValueSet > > AIValueSetRemap
 Class remapping for AIValueSets.
Variables
const UAIState_DailyRoutine DailyRoutineTemplate
 Returns the currently configured daily routine template, no matter whether the routine is active or now.
const UCharacterAIState CurrentState
 Returns the currently active state (top of the stack).
const UTerritoryConfig CurrentTerritory
 Returns Config of Territory at the location this Character would be supposed to be at based on Daily Routine.
const TSubclassOf< UTerritoryConfig > CurrentTerritoryClass
 Returns Config of Territory at the location this Character would be supposed to be at based on Daily Routine.
const UAIState_DailyRoutine DailyRoutineIfActive
 Returns the daily routine state, if it's currently active. nullptr otherwise.
const UCharacterAIState CurrentRootState
 Returns the currently active state (bottom of the stack).
const AActor PersistentSelf
 Actor that is always available, even when the character is despawned (FIXME: Remove after the proxy-refactor).
const UCharacterAIState ScheduledDailyRoutineAIStateTemplate
 Returns the template of AIState that would be active if the DailyRoutine was running. Null if no daily routine exists.
const AGothicCharacter Self
 Character this state belongs to.
const AGothicCharacter TargetEnemy
 Returns the currently targeted enemy character.
Public Attributes inherited from UGameplayAbility_AI
const AGothicCharacter Character
 Character this ability belongs to (If the owner is a character).
const AGothicCharacterState CharacterState
 Character State this ability belongs to.
const AGothicNPCState NPCState
 Character State this ability belongs to (If owner is an NPC).
const AGothicAIController AIController
 AIController if the owning character has one.
Public Attributes inherited from UGameplayAbilityBase
FGameplayTagContainer m_AssetPreloadContext
 Tags to include in AssetPreload context.
int m_MaxActiveCount
 How often can this ability be activated on an actor (in parallel).
int m_LoadAssetsPriority
Public Attributes inherited from UGameplayAbility
bool bServerRespectsRemoteAbilityCancellation
 If this is set, the server-side version of the ability can be canceled by the client-side version. The client-side version can always be canceled by the server.
EGameplayAbilityNetExecutionPolicy NetExecutionPolicy
 How does an ability execute on the network. Does a client "ask and predict", "ask and wait", "don't ask (just do it)".
EGameplayAbilityReplicationPolicy ReplicationPolicy
 How an ability replicates state/events to everyone on the network. Replication is not required for NetExecutionPolicy.
bool bRetriggerInstancedAbility
 if true, and trying to activate an already active instanced ability, end it and re-trigger it.
EGameplayAbilityNetSecurityPolicy NetSecurityPolicy
 What protections does this ability have? Should the client be allowed to request changes to the execution of the ability?
EGameplayAbilityInstancingPolicy InstancingPolicy
 How the ability is instanced when executed. This limits what an ability can do in its implementation.
TSubclassOf< UGameplayEffect > CooldownGameplayEffectClass
 This GameplayEffect represents the cooldown. It will be applied when the ability is committed and the ability cannot be used again until it is expired.
TSubclassOf< UGameplayEffect > CostGameplayEffectClass
 This GameplayEffect represents the cost (mana, stamina, etc) of the ability. It will be applied when the ability is committed.
bool bReplicateInputDirectly
 If true, this ability will always replicate input press/release events to the server.
FGameplayTagContainer SourceRequiredTags
 This ability can only be activated if the source actor/component has all of these tags.
FGameplayTagContainer SourceBlockedTags
 This ability is blocked if the source actor/component has any of these tags.
FGameplayTagContainer TargetRequiredTags
 This ability can only be activated if the target actor/component has all of these tags.
FGameplayTagContainer TargetBlockedTags
 This ability is blocked if the target actor/component has any of these tags.
FGameplayTagContainer CancelAbilitiesWithTag
 Abilities with these tags are cancelled when this ability is executed.
FGameplayTagContainer AbilityTags
 This ability has these tags.
FGameplayTagContainer ActivationBlockedTags
 This ability is blocked if the activating actor/component has any of these tags.
FGameplayTagContainer BlockAbilitiesWithTag
 Abilities with these tags are blocked while this ability is active.
FGameplayTagContainer ActivationOwnedTags
 Tags to apply to activating owner while this ability is active. These are replicated if ReplicateActivationOwnedTags is enabled in AbilitySystemGlobals.
FGameplayTagContainer ActivationRequiredTags
 This ability can only be activated if the activating actor/component has all of these tags.
TArray< FAbilityTriggerData > AbilityTriggers
 Triggers to determine if this ability should execute in response to an event.
const UAnimMontage CurrentMontage
 Active montage being played by this ability.
const UObject CurrentSourceObject
 Retrieves the SourceObject associated with this ability. Can only be called on instanced abilities.
const AActor OwningActorFromActorInfo
 Returns the actor that owns this ability, which may not have a physical location.
const FGameplayEffectContextHandle GrantedByEffectContext
 Retrieves the EffectContext of the GameplayEffect that granted this ability. Can only be called on instanced abilities.
FGameplayEventData CurrentEventData
 Information specific to this instance of the ability, if it was activated by an event.
const FGameplayAbilityActorInfo ActorInfo
 Returns the actor info associated with this ability, has cached pointers to useful objects.
bool bMarkPendingKillOnAbilityEnd
const UAbilitySystemComponent AbilitySystemComponentFromActorInfo
 Returns the AbilitySystemComponent that is activating this ability.
const float32 CooldownTimeRemaining
 Returns the time in seconds remaining on the currently active cooldown.
const USkeletalMeshComponent OwningComponentFromActorInfo
 Convenience method for abilities to get skeletal mesh component - useful for aiming abilities.
const int AbilityLevel
 Returns current level of the Ability.
const AActor AvatarActorFromActorInfo
 Returns the physical actor that is executing this ability. May be null.
FGameplayAbilityActivationInfo CurrentActivationInfo
 This is information specific to this instance of the ability. E.g, whether it is predicting, authoring, confirmed, etc.
Public Attributes inherited from UObject
const UClass Class
const UObject Outer
const UPackage Outermost
const UPackage Package
const UWorld World
const FName Name
const bool IsRooted

Detailed Description

Characters that have this ability will have the ability to think for themselves!

This is done as an ability so we have a seamless way to execute AbilityTasks for both Player and AI.

Member Function Documentation

◆ AssessEvent()

bool AssessEvent ( FGameplayTag AIEventTag,
FRememberedPerception FromPerception )

Call this from a PerceptionHandler (or somewhere else) when a certain event happened and you want the AI to react to that. Returns true, if a response was found and executed. False if no response was configured/wanted by the current AI state.

◆ AssessEventFromPerception()

void AssessEventFromPerception ( FRememberedPerception Perception,
FPerceptionShortTermMemory Memory,
FGameplayTag Assess )

Performs an AssessEvent from the given perception.

◆ AssessEventWithExtraTags()

bool AssessEventWithExtraTags ( FGameplayTag AIEventTag,
FRememberedPerception FromPerception,
FGameplayTagContainer ExtraEventTags )

Same as AssessEvent, but allows passing ExtraEventTags along with the Assessment.

◆ BindAssessmentToPerception()

void BindAssessmentToPerception ( FPerceptionHandler & PerceptionHandler,
FGameplayTag WhenGained = FGameplayTag :: Empty,
FGameplayTag WhenLost = FGameplayTag :: Empty )

◆ CancelAITasksOfClass()

int CancelAITasksOfClass ( TSubclassOf< UAbilityTask_AI > Class)

Cancels all currently running AI tasks (not states!) of the given class. Returns the number of cancelled tasks.

◆ CancelAllExceptRootState()

void CancelAllExceptRootState ( )

Cancels all currently running tasks/substates, except our current root state.

◆ CancelAllStatesAndTasks()

void CancelAllStatesAndTasks ( )

Cancel everything that us currently running. Leaves the AI without anything to do, also leaves all states.

◆ CancelConversationStateAndDoDailyRoutine()

void CancelConversationStateAndDoDailyRoutine ( )

Cancels the the ConversationState if active and does DailyRoutine if nothing else has been scheduled.

◆ CancelStatesOfClass()

int CancelStatesOfClass ( TSubclassOf< UCharacterAIState > Class)

Cancels all currently running tasks/substates of the given class. Returns the number of cancelled states.

◆ CreateAndJoinGroup()

UGothicAIGroup CreateAndJoinGroup ( TSubclassOf< UGothicAIGroup > GroupClass)

If this npc is not already part of the given group, creates one, joins it and returns the newly created group. Otherwise the group we're already part of is returned.

◆ EndAllStatesAndTasks()

void EndAllStatesAndTasks ( )

Force-end everything that us currently running. Leaves the AI without anything to do, also leaves all states.

◆ EvaluateAssessmentConditions()

int64 EvaluateAssessmentConditions ( int64 RequiredConditionBits,
FGameplayTag ForEvent,
FRememberedPerception ForPerception )

Override this to evaluate the condition bits as requested in RequiredConditionBits for an incmming event assessment.

◆ FindActiveStateByClass()

UCharacterAIState FindActiveStateByClass ( TSubclassOf< UCharacterAIState > StateClass) const

◆ FindBestMeleeWeapon()

UWeaponMeleeDefinition FindBestMeleeWeapon ( )

◆ FindBestRangedWeapon()

UWeaponArcheryDefinition FindBestRangedWeapon ( )

◆ FindGroupInCharactersAtLocation()

TSet< UGothicAIGroup > FindGroupInCharactersAtLocation ( TSubclassOf< UGothicAIGroup > GroupClass,
FVector Location,
float32 Radius )

Returns all active kinds of the given group that are at the given location within the given radius.

◆ FindGroupInPerceivedCharacters()

TSet< UGothicAIGroup > FindGroupInPerceivedCharacters ( TSubclassOf< UGothicAIGroup > GroupClass)

Returns all active kinds of the given group that are available among the perceived characters.

◆ GetActiveTasksOfClass()

TArray< UAbilityTaskGeneric > GetActiveTasksOfClass ( TSubclassOf< UAbilityTaskGeneric > TaskClass)

Returns all tasks of the given class that are currently active on the AI.

◆ GetCurrentRootState()

UCharacterAIState GetCurrentRootState ( ) const

Returns the currently active state (bottom of the stack).

◆ GetCurrentState()

UCharacterAIState GetCurrentState ( ) const

Returns the currently active state (top of the stack).

◆ GetCurrentTerritory()

const UTerritoryConfig GetCurrentTerritory ( ) const

Returns Config of Territory at the location this Character would be supposed to be at based on Daily Routine.

◆ GetCurrentTerritoryClass()

TSubclassOf< UTerritoryConfig > GetCurrentTerritoryClass ( ) const

Returns Config of Territory at the location this Character would be supposed to be at based on Daily Routine.

◆ GetDailyRoutineIfActive()

UAIState_DailyRoutine GetDailyRoutineIfActive ( ) const

Returns the daily routine state, if it's currently active. nullptr otherwise.

◆ GetDailyRoutineTemplate()

UAIState_DailyRoutine GetDailyRoutineTemplate ( ) const

Returns the currently configured daily routine template, no matter whether the routine is active or now.

◆ GetGroupOfClass()

UGothicAIGroup GetGroupOfClass ( TSubclassOf< UGothicAIGroup > GroupClass) const

◆ GetPersistentSelf()

AActor GetPersistentSelf ( ) const

Actor that is always available, even when the character is despawned (FIXME: Remove after the proxy-refactor).

◆ GetScheduledDailyRoutineAIStateTemplate()

const UCharacterAIState GetScheduledDailyRoutineAIStateTemplate ( ) const

Returns the template of AIState that would be active if the DailyRoutine was running. Null if no daily routine exists.

◆ GetSelf()

AGothicCharacter GetSelf ( ) const

Character this state belongs to.

◆ GetTargetEnemy()

AGothicCharacter GetTargetEnemy ( ) const

Returns the currently targeted enemy character.

◆ HandleKilledCharacter()

void HandleKilledCharacter ( AGothicCharacterState KilledCharacter,
TSubclassOf< UWeaponDefinition > UsedWeapon,
FGameplayTagContainer & OutAdditionalMemoryTags )

Called when this character killed another character. Can be used to modify the death-memory event tags.

◆ HandleRevivedInSimulation()

void HandleRevivedInSimulation ( )

Called when this NPC was revived during DailyRoutineSimulation.

◆ HasCurrentTerritoryOfClass()

bool HasCurrentTerritoryOfClass ( TSubclassOf< UTerritoryConfig > TerritoryClass)

Returns true if this Character currently belongs to the given territory.

◆ HasInPermanentStorage()

bool HasInPermanentStorage ( TSubclassOf< UAIValueSet > ValueSetClass) const

Returns true if the given ValueSet already exists in PermanentStorage.

◆ HasInSpawnedStorage()

bool HasInSpawnedStorage ( TSubclassOf< UAIValueSet > ValueSetClass) const

Returns true if the given ValueSet already exists in SpawnedStorage.

◆ HasPendingScheduledState()

bool HasPendingScheduledState ( ) const

Returns true, if there is any pending AIState to be activated when the current state ends.

◆ IsDoingAITaskOfClass()

bool IsDoingAITaskOfClass ( TSubclassOf< UAbilityTask_AI > AITaskClass) const

Returns true if the character is doing an AITask of the given class.

◆ IsDoingConversationState()

bool IsDoingConversationState ( ) const

Whether this character is doing its conversation state right now (.

◆ IsDoingDailyRoutine()

bool IsDoingDailyRoutine ( ) const

Whether this character is doing its daily routine right now (.

◆ IsFocusedBy()

bool IsFocusedBy ( AGothicCharacter Other)

Returns true of the given other Character is focusing this NPC.

◆ IsInState()

bool IsInState ( TSubclassOf< UCharacterAIState > StateClass) const

Returns true if this character is currently doing the given state.

◆ IsUnconscious()

bool IsUnconscious ( ) const

True while being defeated, frozen, etc.

◆ JoinGroup()

void JoinGroup ( UGothicAIGroup Group)

Joins the given group. The NPC must not be part of a group with the same class already!

◆ LeaveAllGroups()

void LeaveAllGroups ( )

Removes the NPC from all groups.

◆ LeaveGroupsWithClass()

void LeaveGroupsWithClass ( TSubclassOf< UGothicAIGroup > GroupClass)

Removes the NPC from all groups that are based on the given class.

◆ PermanentStorage()

UAIValueSet PermanentStorage ( TSubclassOf< UAIValueSet > ValueSetClass) const

◆ ProcessAllPendingAssessments()

void ProcessAllPendingAssessments ( )

Executes all pending assessment calls, ignoring any budgeting.

◆ RateMeleeWeaponStrength()

float32 RateMeleeWeaponStrength ( UWeaponMeleeDefinition Weapon)

◆ RateRangedWeaponStrength()

float32 RateRangedWeaponStrength ( UWeaponArcheryDefinition Weapon)

◆ RemoveFromPermanentStorage()

void RemoveFromPermanentStorage ( TSubclassOf< UAIValueSet > ValueSetClass)

Forcefully removes the given value set from PermanentStorage.

◆ RemoveFromSpawnedStorage()

void RemoveFromSpawnedStorage ( TSubclassOf< UAIValueSet > ValueSetClass)

Forcefully removes the given value set from SpawnedStorage.

◆ ResolveLocationByName()

bool ResolveLocationByName ( FName KnownLocationName,
FVector & OutVector ) const

Looks up the location vector to the given name. The name could be any waypoint, freepoint, preferred location. If the Character doesn't "know" this location, it's assumed to be some freepoint or waypoint in the world.

If nothing could be found under that name, the method returns false.

◆ SetTargetEnemy()

void SetTargetEnemy ( AGothicCharacter EnemyActor,
EGothicFocusPriority FocusPriority,
UAbilityTaskGeneric TaskLifeAnchor = nullptr )

Keeps the character oriented towards this character, if possible.

◆ SetTargetEnemyComponent()

void SetTargetEnemyComponent ( USceneComponent EnemyActorComponent,
EGothicFocusPriority FocusPriority,
UAbilityTaskGeneric TaskLifeAnchor = nullptr,
FName SocketName = NAME_None )

Keeps the character oriented towards this Component, if possible. (Must be attached to an AGothicCharacter) @oaram FocusPriority Priority that the focus should have.

Parameters
TaskLifeAnchorIf not null, FocusPoint is automatically reset when the state ends.
SocketNameSocket to target when EnemyActorComponent is the SkeletalMesh

◆ SetupPerceptions()

void SetupPerceptions ( UCharacterPerceptionComponent Perception)

Override this to setup the perception handlers for this Ability.

◆ SpawnedStorage()

UAIValueSet SpawnedStorage ( TSubclassOf< UAIValueSet > ValueSetClass) const

◆ StaticClass()

UClass StaticClass ( )
static

◆ StopTargetingEnemy()

void StopTargetingEnemy ( EGothicFocusPriority FocusPriority)

Stops targeting whatever we're currently targeting.

◆ SwitchAIState()

void SwitchAIState ( UCharacterAIState State,
AGothicCharacter Other = nullptr )

Switches to the given AI state. The current state will be given a chance to gracefully exit.

Allows passing other characters for the AI to interact with during the state.

◆ SwitchAIStateImmediately()

void SwitchAIStateImmediately ( UCharacterAIState State,
AGothicCharacter Other = nullptr )

Hard-cancels the current AI state and immediately switches to the given state. The currently active task will NOT be given a chance to perform any graceful exit.

◆ SwitchAIStateImmediatelyToClass()

void SwitchAIStateImmediatelyToClass ( TSubclassOf< UCharacterAIState > StateClass,
AGothicCharacter Other = nullptr )

Hard-cancels the current AI state and immediately creates and switches to the given state. The currently active task will NOT be given a chance to perform any graceful exit.

◆ SwitchAIStateWithOthers()

void SwitchAIStateWithOthers ( UCharacterAIState State,
TArray< AGothicCharacter > Others )

Switches to the given AI state. The current state will be given a chance to gracefully exit.

◆ SwitchAIStateWithOthersImmediately()

void SwitchAIStateWithOthersImmediately ( UCharacterAIState State,
TArray< AGothicCharacter > Others )

Hard-cancels the current AI state and immediately switches to the given state. The currently active task will NOT be given a chance to perform any graceful exit.

Allows passing other characters for the AI to interact with during the state.

◆ SwitchToConversationState()

void SwitchToConversationState ( )

Switches to the ConversationState if no other states are currently active.

◆ SwitchToDailyRoutine()

void SwitchToDailyRoutine ( )

Switches to the DailyRoutine if no other states are currently active.

◆ SwitchToDailyRoutineIfNothingElseToDo()

void SwitchToDailyRoutineIfNothingElseToDo ( )

Switches to the DailyRoutine if no other states are currently active.

Member Data Documentation

◆ ActiveAITasks

TSet<UAbilityTask_AI> ActiveAITasks

All AITasks that are currently running on this AI-Ability.

◆ AfterDefeatedAIStateClass

TSubclassOf<UCharacterAIState> AfterDefeatedAIStateClass

AIState to do after standing up from being defeated.

◆ AIValueSetRemap

Class remapping for AIValueSets.

◆ AssessmentModuleClass

TSubclassOf<UAIAssessmentResponseModule> AssessmentModuleClass

How to react to certain perception events. Bottom-Level priority.

◆ ControlledAIStateClass

TSubclassOf<UCharacterAIState> ControlledAIStateClass

AIState to do when being controlled via spell.

◆ ConversationAIStateClass

TSubclassOf<UCharacterAIState> ConversationAIStateClass

AIState to be in during conversations.

◆ CurrentRootState

const UCharacterAIState CurrentRootState

Returns the currently active state (bottom of the stack).

◆ CurrentState

const UCharacterAIState CurrentState

Returns the currently active state (top of the stack).

◆ CurrentStateStack

TArray<UCharacterAIState> CurrentStateStack

Current state the AI is in. Each Character can be only in one main state at a time!

◆ CurrentTerritory

const UTerritoryConfig CurrentTerritory

Returns Config of Territory at the location this Character would be supposed to be at based on Daily Routine.

◆ CurrentTerritoryClass

const TSubclassOf<UTerritoryConfig> CurrentTerritoryClass

Returns Config of Territory at the location this Character would be supposed to be at based on Daily Routine.

◆ DailyRoutineIfActive

const UAIState_DailyRoutine DailyRoutineIfActive

Returns the daily routine state, if it's currently active. nullptr otherwise.

◆ DailyRoutineTemplate

const UAIState_DailyRoutine DailyRoutineTemplate

Returns the currently configured daily routine template, no matter whether the routine is active or now.

◆ DefeatedAIStateClass

TSubclassOf<UCharacterAIState> DefeatedAIStateClass

AIState to enter when being defeated.

◆ FoundSomeoneInMyBedAIStateClass

TSubclassOf<UCharacterAIState> FoundSomeoneInMyBedAIStateClass

AIState to be done after finding someone in this NPCs bed during the night.

◆ HighPriorityAssessmentModuleClass

TSubclassOf<UAIAssessmentResponseModule> HighPriorityAssessmentModuleClass

How to react to certain perception events. Top-Level priority. (Overrides all AIStates, Dailyroutine, base layer).

◆ InitialDailyRoutineClass

TSubclassOf<UAIState_DailyRoutine> InitialDailyRoutineClass

Daily routine to start with if none was specified in the character state.

◆ InterruptedSomeoneWaitingAIStateClass

TSubclassOf<UCharacterAIState> InterruptedSomeoneWaitingAIStateClass

AIState to be done after finding someone sitting on a chair in a forbidden area why using skip-time.

◆ JoinedGroups

◆ PersistentSelf

const AActor PersistentSelf

Actor that is always available, even when the character is despawned (FIXME: Remove after the proxy-refactor).

◆ ScheduledDailyRoutineAIStateTemplate

const UCharacterAIState ScheduledDailyRoutineAIStateTemplate

Returns the template of AIState that would be active if the DailyRoutine was running. Null if no daily routine exists.

◆ ScheduledNextState

UCharacterAIState ScheduledNextState

State that should be activated after the CurrentState has exited.

◆ Self

const AGothicCharacter Self

Character this state belongs to.

◆ SelfConversationAIStateClass

TSubclassOf<UAIState_SelfConversation> SelfConversationAIStateClass

AIState to be in during conversations without any partner.

◆ TargetEnemy

const AGothicCharacter TargetEnemy

Returns the currently targeted enemy character.