unreal-engine4 - 虚幻气体 : Influence of the GameplayEffect aggregator on gameplay attribute values

标签 unreal-engine4 unreal-gameplay-ability-system

在分析 GameplayEffect 的生命周期时修改器和执行,我偶然发现了属性聚合器GameplayEffect聚合器(这两个术语都在源代码中使用)。这些用于评估修改后的属性值(它们由 GameplayEffects 修改)。

但是,我不明白这些聚合器如何影响附加到 Actor (作为属性集的一部分)的实际 GameplayAbilitySystem 属性:

  1. 是否有属性/GameplayEffect聚合器 FAggregator影响游戏属性的基础值当前值 FGameplayAttributeData
  2. 是属性/GameplayEffect 聚合器的基值 float FAggregator::BaseValue游戏属性基值相关float FGameplayAttributeData::BaseValue

属性/GameplayEffect聚合器的重要组成部分是

  • 所谓的游戏修改器评估 channel EGameplayModEvaluationChannel ,在值评估期间顺序使用( channel 0 的结果作为基值传递给 channel 1 等)
  • 在某些 channel 中存储修饰符(及其大小、操作、标签以及指向应用GameplayEffect的链接),定义实际的数值评估

这些用于进行评估

  • 最终值
  • 通过反向评估最终值来确定基值,尝试从修饰符确定基值(已弃用的 b/c GAS 现在具有基于结构的属性 -根据文档)
  • 奖励值(最终值 - 基础值)

(都只是函数的返回值,不是聚合器的成员变量)

要通知其他类进行评估(或聚合器的更改),使用两种方法

  1. a delegate FOnAggregatorDirty被广播,其中包含对聚合器的引用
  2. AbilitySystemComponent 中注册的每个 GameplayEffect 都会通过更新聚合器 FActiveGameplayEffectsContainer::UpdateAggregatorModMagnitudes() 来更新对其受影响的属性的更改(通过 FAggregator )。对于 FindOrCreateAttributeAggregator() 中的属性(通过 FAggregator::UpdateAggregatorMod() 确定或设置) )

我不明白这些通知方法中的一个或两个如何更新实际的属性值。

(不幸的是,官方文档/源代码以及优秀的 GAS: Comprehensive AnalysisGAS and you 没有阐明 GameplayEffect 聚合器。)

最佳答案

  1. 属性/GameplayEffect 聚合器会影响游戏属性的当前值
  2. 部分是的。它们在一个方向上相关:gameplay 属性 的基值用于设置attribute/GameplayEffect 聚合器 的基值,但反之则不然。 聚合器不会更改属性基值

(1)的解释

通过查看通知方法,我走上了正确的道路。事实上,两者一起更新游戏属性:

  1. FActiveGameplayEffectsContainer::FindOrCreateAttributeAggregator()UAbilitySystemComponent::OnAttributeAggregatorDirty() 应用到 OnDirty 委托(delegate)(该委托(delegate)在聚合器更改时执行)正如问题中所写)。
  2. OnAttributeAggregatorDirty() 调用 FActiveGameplayEffectsContainer::InternalUpdateNumericalAttribute(),后者又调用
  3. UAbilitySystemComponent::SetNumericAttribute_Internal(),调用
  4. FGameplayAttribute::SetNumericValueChecked()。这会设置游戏属性的当前值

对(2)的解释

属性/GameplayEffect 聚合器的基值仅使用以下位置的gameplay 属性基值FGameplayAttributeData::BaseValue 设置:

  • FActiveGameplayEffectsContainer::OnAttributeAggregatorDirty()
  • FActiveGameplayEffectsContainer::SetAttributeBaseValue()

游戏属性的基值设置如下:

  • UAttributeSet::InitFromMetaDataTable()
  • FActiveGameplayEffectsContainer::SetAttributeBaseValue()

在这两个函数中,属性基值与聚​​合器的基值无关。

关于unreal-engine4 - 虚幻气体 : Influence of the GameplayEffect aggregator on gameplay attribute values,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/52916274/

相关文章:

c++ - 虚幻 : "Unknown type name UTextRenderComponent" compile error while following tutorial

c++ - 使用 addch 获得意想不到的字符

c++ - 虚幻气体 : Print out the current value of an attribute to UI when it changes

c++ - 如何在 Unreal Editor 内容浏览器中找到 Unreal GameMode?

unreal-engine4 - 阻止静态网格物体随相机移动

c++ - 如何修复 : "FActorSpawnParameters is not defined" error in C++ in UE4?