5#include "CoreMinimal.h"
6#include "Engine/DataTable.h"
8#include "AIDataTypes.generated.h"
58UENUM(BlueprintType, meta = (ScriptName =
"EAISensePython"))
218USTRUCT(BlueprintType)
223 UPROPERTY(EditAnywhere, BlueprintReadOnly, Category=
"Stealth")
224 TArray<UAnimMontage*> NonLethalTakedownAnims;
225 UPROPERTY(EditAnywhere, BlueprintReadOnly, Category= "
Stealth")
226 TArray<UAnimMontage*> UnarmedTakedownAnims;
227 UPROPERTY(EditAnywhere, BlueprintReadOnly, Category= "
Stealth")
228 TArray<UAnimMontage*> KnifeTakedownAnims;
231 UPROPERTY(EditAnywhere, BlueprintReadOnly, Category= "
Stealth")
232 float StealthTakedownDamage = 20000.0f;
233 UPROPERTY(EditAnywhere, BlueprintReadOnly, Category= "
Stealth")
234 float StealthActorDistance = -175.0f;
235 UPROPERTY(EditAnywhere, BlueprintReadOnly, Category= "
Stealth")
236 FName StealthTakedownName = "Stealth_Attack_NonLethal_01";
238 UPROPERTY(VisibleAnywhere, BlueprintReadOnly, Category="
Stealth")
239 AActor* StealthActor =
nullptr;
241 bool bStealthTakedownAvailable = false;
242 bool bPerformingStealthTakedown = false;
247 FTimerHandle StealthTakedownTimerHandle;
258 StealthActor = Actor;
260 if(StealthActorInterfaceRef !=
nullptr)
262 StealthActorInterface = StealthActorInterfaceRef;
277USTRUCT(BlueprintType)
283 UPROPERTY(EditAnywhere, BlueprintReadWrite, Category=
"AI Factions")
287 UPROPERTY(EditAnywhere, BlueprintReadWrite, Category="AI Factions")
290 UPROPERTY(EditAnywhere, BlueprintReadWrite, Category="AI Factions")
291 float TrustLevel = 0.0f;
293 UPROPERTY(EditAnywhere, BlueprintReadWrite, Category="AI Factions")
294 float HostilityLevel = 0.0f;
296 void AddHostility(const
float Value)
298 HostilityLevel += Value;
299 UpdateRelationshipStatus();
304 UpdateRelationshipStatus();
309 if (TrustLevel >= 100 && HostilityLevel == 0)
313 else if (TrustLevel >= 40 && HostilityLevel == 0)
317 else if (TrustLevel >= 20 && HostilityLevel <= 20)
321 else if (TrustLevel == 0 && HostilityLevel >= 40)
325 else if (TrustLevel <= -40 && HostilityLevel >= 100)
329 else if (TrustLevel <= -100 && HostilityLevel >= 200)
343 if(HostilityLevel >= 100.0f)
357USTRUCT(BlueprintType)
362 UPROPERTY(EditAnywhere, BlueprintReadWrite, Category=
"Traits")
363 float FearLevel = 0.0f;
365 UPROPERTY(EditAnywhere, BlueprintReadWrite, Category="Traits")
366 float ReactionTime = 1.0f;
367 UPROPERTY(EditAnywhere, BlueprintReadWrite, Category="Traits")
368 float Accuracy = 1.0f;
369 UPROPERTY(EditAnywhere, BlueprintReadWrite, Category="Traits")
370 float AggressiveLevel = 0.0f;
372 UPROPERTY(EditAnywhere, BlueprintReadWrite, Category="Traits")
373 float RecklessnessLevel = 0.0f;
375 UPROPERTY(EditAnywhere, BlueprintReadWrite, Category="Traits")
376 float AlertnessLevel = 0.0f;
378 UPROPERTY(EditAnywhere, BlueprintReadWrite, Category="Traits")
379 float KnowledgeOfPlayerLocation = 0.0f;
383USTRUCT(BlueprintType)
388 UPROPERTY(VisibleAnywhere, BlueprintReadOnly, Category=
"AI")
389 AActor* HostileActor =
nullptr;
390 UPROPERTY(VisibleAnywhere, BlueprintReadOnly, Category="AI")
391 FVector LastSeenLocation = FVector::ZeroVector;
393 UPROPERTY(VisibleAnywhere, BlueprintReadOnly, Category="AI")
394 float DetectionLevel = 0.0f;
395 UPROPERTY(VisibleAnywhere, BlueprintReadOnly, Category="AI")
396 bool bDetected = false;
397 UPROPERTY(VisibleAnywhere, BlueprintReadOnly, Category="AI")
398 bool bInvestigate = false;
400 UPROPERTY(VisibleAnywhere, BlueprintReadOnly, Category="AI")
404 UPROPERTY(VisibleAnywhere, BlueprintReadOnly, Category="AI")
405 float DamageReceivedByOwner = 0.0f;
408 UPROPERTY(VisibleAnywhere, BlueprintReadOnly, Category="AI")
409 float DamageDealtToOwner = 0.0f;
410 UPROPERTY(VisibleAnywhere, BlueprintReadOnly, Category="AI")
411 float VisibilityScore = 0.0f;
412 UPROPERTY(VisibleAnywhere, BlueprintReadOnly, Category="AI")
413 float TotalScore = 0.0f;
415 UPROPERTY(VisibleAnywhere, BlueprintReadOnly, Category="AI")
416 float TrustScore = 0.0f;
417 UPROPERTY(VisibleAnywhere, BlueprintReadOnly, Category="AI")
418 float HostilityScore = 100.0f;
420 UPROPERTY(VisibleAnywhere, BlueprintReadOnly, Category="AI")
421 float TrustDecreaseFactor = 10.0f;
422 UPROPERTY(VisibleAnywhere, BlueprintReadOnly, Category="AI")
423 float HostilityIncreaseFactor = 0.2f;
431 HostileActor = Actor;
435 HostileActor = Actor;
443 DamageReceivedByOwner += Value;
451 DamageDealtToOwner += Value;
459 TrustScore -= ((DamageDealtToOwner / TrustDecreaseFactor));
460 HostilityScore += (DamageDealtToOwner / HostilityIncreaseFactor);
479 HostilityScore += Value;
484 VisibilityScore += Value;
486 void AddDetection(
const float Value,
const float MaxDetection,
const float InvestigateDetection)
488 DetectionLevel += Value;
489 if(DetectionLevel >= InvestigateDetection)
493 if(DetectionLevel >= MaxDetection)
497 if(DetectionLevel < 0.0f)
499 DetectionLevel = 0.0f;
502 if(Value >= 0 && HostileActor !=
nullptr)
504 LastSeenLocation = HostileActor->GetActorLocation();
509 if(HostileActor ==
nullptr){
return;}
510 LastSeenLocation = HostileActor->GetActorLocation();
515 DetectionLevel = InvestigateDetection;
521 DetectionLevel = 0.0f;
522 bInvestigate =
false;
534 return HostileActor ==
Other.HostileActor;
540 return HostileActor !=
nullptr;
561 if(TrustScore >= 40.0f && HostilityScore <= 20.0f)
569 if(TrustScore <= 0.0f && HostilityScore >= 40.0f)
583 if(HostileActor ==
nullptr && !LastSeenLocation.IsNearlyZero()){
return LastSeenLocation;}
584 if(HostileActor ==
nullptr){
return FVector::ZeroVector;}
585 return HostileActor->GetActorLocation();
602USTRUCT(BlueprintType)
607 UPROPERTY(EditAnywhere, BlueprintReadWrite, Category=
"AI Factions")
609 UPROPERTY(EditAnywhere, BlueprintReadWrite, Category="AI Factions")
621USTRUCT(BlueprintType)
626 UPROPERTY(EditAnywhere, BlueprintReadWrite, Category=
"AI Factions")
628 UPROPERTY(EditAnywhere, BlueprintReadWrite, Category="AI Factions")
629 float Strength = 50.0f;
630 UPROPERTY(EditAnywhere, BlueprintReadWrite, Category="AI Factions")
638USTRUCT(BlueprintType)
643 UPROPERTY(EditAnywhere, BlueprintReadWrite, Category=
"AI Factions")
646 UPROPERTY(EditAnywhere, BlueprintReadWrite, Category="AI Factions")
647 float TrustLevel = 0.0f;
648 UPROPERTY(EditAnywhere, BlueprintReadWrite, Category="AI Factions")
649 float HostilityLevel = 0.0f;
651 UPROPERTY(EditAnywhere, BlueprintReadWrite, Category="AI Factions")
652 float ReputationPoints = 0.0f;
654 UPROPERTY(EditAnywhere, BlueprintReadWrite, Category="AI Factions")
655 float QuestInfluenceMultiplier = 0.0f;
657 UPROPERTY(EditAnywhere, BlueprintReadWrite, Category="AI Factions")
658 float DialogueInfluence = 0.0f;
709USTRUCT(BlueprintType)
714 UPROPERTY(EditAnywhere, BlueprintReadWrite, Category=
"AI Tool Kit")
715 TSubclassOf<APawn> ActorToSpawn;
716 UPROPERTY(EditAnywhere, BlueprintReadWrite, Category="AI Tool Kit")
717 int32 AmountToSpawn = 1;
718 UPROPERTY(EditAnywhere, BlueprintReadWrite, Category="AI Tool Kit")
719 float InitialDelay = 0.2f;
720 UPROPERTY(EditAnywhere, BlueprintReadWrite, Category="AI Tool Kit")
721 float TimeBetweenSpawnsMin = 1.0f;
722 UPROPERTY(EditAnywhere, BlueprintReadWrite, Category="AI Tool Kit")
723 float TimeBetweenSpawnsMax = 10.0f;
725 UPROPERTY(EditAnywhere, BlueprintReadWrite, Category="AI Tool Kit")
729 UPROPERTY(EditAnywhere, BlueprintReadWrite, Category="AI Tool Kit")
732 UPROPERTY(EditAnywhere, BlueprintReadWrite, Category="AI Tool Kit|
Location")
733 AActor* StationaryLocation =
nullptr;
735 UPROPERTY(EditAnywhere, BlueprintReadWrite, Category="AI Tool Kit|
Location")
736 TArray<AActor*> PathLocations;
737 UPROPERTY(EditAnywhere, BlueprintReadWrite, Category="AI Tool Kit|
Location")
738 bool bUseSpawnLocations = false;
739 UPROPERTY(EditAnywhere, BlueprintReadWrite, Category="AI Tool Kit|
Location")
740 bool bUseSpawnLocationsGlobal = false;
741 UPROPERTY(EditAnywhere, BlueprintReadWrite, Category="AI Tool Kit|
Location", meta=(EditCondition=bUseSpawnLocations))
742 TArray<FVector> SpawnLocations;
743 UPROPERTY(EditAnywhere, BlueprintReadWrite, Category="AI Tool Kit|Random")
744 bool bUseRandomSpawnNumber = false;
745 UPROPERTY(EditAnywhere, BlueprintReadWrite, Category="AI Tool Kit|Random")
747 UPROPERTY(EditAnywhere, BlueprintReadWrite, Category="AI Tool Kit|Random")
EAIResponse
Definition AIDataTypes.h:47
EAlignment
Definition AIDataTypes.h:152
EAIMovementSpeed
Definition AIDataTypes.h:84
static ERelationshipStatus GetRelationship(const float TrustLevel, const float HostilityLevel)
Definition AIDataTypes.h:169
EAIStateType
Definition AIDataTypes.h:121
EAIMovementType
Definition AIDataTypes.h:93
ERelationshipStatus
Definition AIDataTypes.h:140
DECLARE_LOG_CATEGORY_EXTERN(LogAIToolKit, Display, All)
EAISense
Definition AIDataTypes.h:60
ECharacterType
Definition AIDataTypes.h:73
EFactionType
Definition AIDataTypes.h:103
Definition StealthInterface.h:17
Definition AIDataTypes.h:14
float HostilityLevelFriendly
Definition AIDataTypes.h:20
float HostilityLevelAllied
Definition AIDataTypes.h:25
float TrustLevelFriendly
Definition AIDataTypes.h:18
float HostilityLevelHostile
Definition AIDataTypes.h:35
float HostilityLevelNeutral
Definition AIDataTypes.h:30
float TrustLevelHostile
Definition AIDataTypes.h:33
float TrustLevelEnemy
Definition AIDataTypes.h:38
float HostilityLevelEnemy
Definition AIDataTypes.h:40
float TrustLevelAllied
Definition AIDataTypes.h:23
float TrustLevelNeutral
Definition AIDataTypes.h:28
Definition AIDataTypes.h:711
Definition AIDataTypes.h:359
Definition AIDataTypes.h:623
Definition AIDataTypes.h:279
float HostilityLevel
Definition AIDataTypes.h:294
void UpdateRelationshipStatus()
Definition AIDataTypes.h:307
bool IsHostile() const
Definition AIDataTypes.h:341
void AddTrust(const float Value)
Definition AIDataTypes.h:301
float TrustLevel
Definition AIDataTypes.h:291
static FFactionRelationship Empty()
Definition AIDataTypes.h:350
Definition AIDataTypes.h:604
Definition AIDataTypes.h:640
Definition AIDataTypes.h:385
ERelationshipStatus GetRelationshipStatus() const
Definition AIDataTypes.h:576
void AddVisibility(const float Value)
Definition AIDataTypes.h:482
bool operator==(const FHostileActorInfo &Other) const
Definition AIDataTypes.h:532
void AddDamageDealtToOwner(const float Value)
Definition AIDataTypes.h:449
bool IsAllied() const
Definition AIDataTypes.h:559
FHostileActorInfo(AActor *Actor, const FFactionRelationship &Relationship)
Definition AIDataTypes.h:433
bool IsHostile() const
Definition AIDataTypes.h:543
void LostTarget(const float InvestigateDetection)
Definition AIDataTypes.h:513
void AddDetection(const float Value, const float MaxDetection, const float InvestigateDetection)
Definition AIDataTypes.h:486
FVector GetLocation() const
Definition AIDataTypes.h:581
void ClearDetection()
Definition AIDataTypes.h:519
bool IsValid() const
Definition AIDataTypes.h:538
void AddDamageReceivedByOwner(const float Value)
Definition AIDataTypes.h:441
static FHostileActorInfo Empty()
Definition AIDataTypes.h:527
bool IsNeutral() const
Definition AIDataTypes.h:567
FHostileActorInfo(AActor *Actor)
Definition AIDataTypes.h:429
void LostSightOnTarget()
Definition AIDataTypes.h:507
void AddHostility(const float Value)
Definition AIDataTypes.h:477
bool IsFriendly() const
Definition AIDataTypes.h:551
Definition AIDataTypes.h:220
bool SetStealthActor(AActor *Actor)
Definition AIDataTypes.h:254