Hello,
I’m trying to spawn AI characters that chose one of a few different level exits and move toward that.
My plan currently is to have the level exits represented by a blueprint class, so the designer can move them as they please in each level in the editor…the position and number of exits is undetermined currently and probably varies level to level.
I’ not sure how to get a random array element and have a reference to it’s pawn, so I can “get actor location” on it.
Any help Appreciated!
Here is where I’m at currently…
// get array of PossibleDestination actors, choose one at random, set ChosenDestination
TArray<AActor*> PossibleDestinations;
UGameplayStatics::GetAllActorsOfClass(GetWorld(), ASSPossibleDestinations::StaticClass(), *&PossibleDestinations);
***HELP:: ChosenDestination = [FMath::FRand()*PossibleDestinations.Num()]
// need to get index from PossibleDesintation array , and set ChosenDestination
// Set Destination value as ChosenDestination->GetActorLocation
GetBlackboardComponent()->SetValueAsVector(TEXT("Destination"), );