Help with programming QuickStart 5

Hello,

Please note that you can use FMath::RandRange function to get a random number in custom range:

static int32 RandRange
(
    int32 Min,
    int32 Max
)

However, it is also possible to move the actor instantly to the specified location with AActor::SetActorLocation function:

bool SetActorLocation
(
    const FVector & NewLocation,
    bool bSweep,
    FHitResult * OutSweepHitResult
)

For more complex movement logic you can use AI Controlled Pawn.

In Unreal Engine 4, AI functionality is implemented with the help of Behavior Tree object. In particular, it has Move To function:

54443-moveto.png

With the help of Get Random Reachable Point in Radius node, you can get the TartgetPoint for Move To function:

54444-getrandomreachablepoint.png

If you like to learn more about Behavior Trees in Unreal Engine 4, please go here:

Hope this helped!

Good luck!