Skip to content

Commit

Permalink
fix links, RandomChance remove "value from BB" temporary
Browse files Browse the repository at this point in the history
  • Loading branch information
Ciberusps committed Jul 1, 2024
1 parent 870d89d commit 981e326
Show file tree
Hide file tree
Showing 15 changed files with 22 additions and 16 deletions.
Binary file modified Content/AI/BT_UHL_GameplayFocus.uasset
Binary file not shown.
Binary file modified Content/AI/BT_UHL_InAngle.uasset
Binary file not shown.
Binary file modified Content/AI/BT_UHL_InRange.uasset
Binary file not shown.
Binary file modified Content/AI/BT_UHL_InvokeGameplayAbility.uasset
Binary file not shown.
Binary file modified Content/AI/BT_UHL_PlayAnimMontage.uasset
Binary file not shown.
Binary file modified Content/AI/BT_UHL_RandomChance.uasset
Binary file not shown.
Binary file modified Content/AI/BT_UHL_RandomLoop.uasset
Binary file not shown.
Binary file modified Content/AI/BT_UHL_RandomSelector.uasset
Binary file not shown.
Binary file modified Content/AI/BT_UHL_RandomTimelimit.uasset
Binary file not shown.
Binary file modified Content/AI/BT_UHL_SetBBValue.uasset
Binary file not shown.
Binary file modified Content/Gyms/Gym_AI.umap
Binary file not shown.
4 changes: 3 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ From source:
> - Components
> - [AbilitySystemComponent](#abilitysystemcomponent)
> - Tasks
> - [InterpolateToPosition](interpolatetoposition)
> - [InterpolateToPosition](#interpolatetoposition)
> - [AI](#ai)
> - Components
> - [AIPerceptionComponent](#uhlaiperceptioncomponent)
Expand Down Expand Up @@ -181,10 +181,12 @@ Requirements:

- turn on `UseControllerDesiredRotation`
- turn off
- `bOrientRotationToMovement`
- `UseControllerRotationYaw`
- `UseControllerRotationPitch`
- `UseControllerRotationRoll`


Troubleshooting:

- check that nothing "ClearFocus"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ float UBTD_InRange::GetCurrentDistance(const UBehaviorTreeComponent& OwnerComp,
DrawDebugLine(OwnerComp.GetWorld(), LineStart, LineEnd, bInRange ? FColor::Green : FColor::Red, false, DebugLifetime, -1, 2.0f);
DrawDebugSphere(OwnerComp.GetWorld(), LineStart, 5.0f, 16, FColor::Blue, false, DebugLifetime, DebugLifetime, 2.0f);
DrawDebugSphere(OwnerComp.GetWorld(), LineEnd, 5.0f, 16, FColor::Blue, false, DebugLifetime, DebugLifetime, 2.0f);
DrawDebugString(OwnerComp.GetWorld(), TextLocation, FString::Printf(TEXT("Distance: %.2f"), CurrentDistance), nullptr, FColor::White, DebugLifetime < 0 ? 0 : DebugLifetime, true);
DrawDebugString(OwnerComp.GetWorld(), TextLocation, FString::Printf(TEXT("Distance: %.2f"), CurrentDistance), nullptr, bInRange ? FColor::Green : FColor::Red, DebugLifetime < 0 ? 0 : DebugLifetime, true);
DrawDebugString(OwnerComp.GetWorld(), OwnerCharacter->GetActorLocation(), FString::Printf(TEXT("ParentNode:\n%s \n\nNodeName:\n%s"), *GetParentNode()->NodeName, *GetMyNode()->NodeName), nullptr, FColor::White, DebugLifetime < 0 ? 0 : DebugLifetime, true);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,32 +14,34 @@ UBTD_RandomChance::UBTD_RandomChance(const FObjectInitializer& ObjectInitializer
bAllowAbortLowerPri = false;
bAllowAbortChildNodes = false;

ChanceInBB.AddFloatFilter(this, GET_MEMBER_NAME_CHECKED(UBTD_RandomChance, ChanceInBB));
// TODO value from blackboard
// ChanceInBB.AddFloatFilter(this, GET_MEMBER_NAME_CHECKED(UBTD_RandomChance, ChanceInBB));
}

bool UBTD_RandomChance::CalculateRawConditionValue(UBehaviorTreeComponent& OwnerComp, uint8* NodeMemory) const
{
float CurrentChance = 0.0f;
if (bUseBlackboardValue)
{
CurrentChance = FMath::Clamp(OwnerComp.GetBlackboardComponent()->GetValueAsFloat(ChanceInBB.SelectedKeyName), 0.0f, 1.0f);
}
// TODO value from blackboard
// if (bUseBlackboardValue)
// {
// CurrentChance = FMath::Clamp(OwnerComp.GetBlackboardComponent()->GetValueAsFloat(ChanceInBB.SelectedKeyName), 0.0f, 1.0f);
// }
// else if (bUseUnclamped)
// {
// CurrentChance = ChanceUnclamped
// }
else
{
// else
// {
CurrentChance = Chance;
}
// }

return UKismetMathLibrary::RandomBoolWithWeight(CurrentChance);
}

FString UBTD_RandomChance::GetStaticDescription() const
{
// TODO BB value preview?
// float CurrentChance = bUseBlackboardValue ? GetBlackboardAsset()->GetKey(ChanceInBB.GetSelectedKeyID()) : Chance;
// TODO BB value preview?
// float CurrentChance = bUseBlackboardValue ? GetBlackboardAsset()->GetKey(ChanceInBB.GetSelectedKeyID()) : Chance;
return FString::Printf(TEXT("Chance - %.2f%% (%.2f)"), Chance * 100.0f, Chance);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,13 +21,15 @@ class UNREALHELPERLIBRARY_API UBTD_RandomChance : public UBTDecorator
float Chance;
// UPROPERTY(Category=Decorator, EditAnywhere, meta=(EditCondition="bUseUnclamped && !bUseBlackboardValue", EditConditionHides))
// float ChanceUnclamped;
UPROPERTY(Category=Decorator, EditAnywhere, meta=(EditCondition="bUseBlackboardValue", EditConditionHides))
FBlackboardKeySelector ChanceInBB;
// TODO value from blackboard
// UPROPERTY(Category=Decorator, EditAnywhere, meta=(EditCondition="bUseBlackboardValue", EditConditionHides))
// FBlackboardKeySelector ChanceInBB;

// UPROPERTY(Category=Decorator, EditAnywhere)
// bool bUseUnclamped = false;
UPROPERTY(Category=Decorator, EditAnywhere)
bool bUseBlackboardValue = false;
// TODO value from blackboard
// UPROPERTY(Category=Decorator, EditAnywhere)
// bool bUseBlackboardValue = false;

virtual bool CalculateRawConditionValue(UBehaviorTreeComponent& OwnerComp, uint8* NodeMemory) const override;

Expand Down

0 comments on commit 981e326

Please sign in to comment.