# Help with programming QuickStart 5

**URL:** <https://forums.unrealengine.com/t/help-with-programming-quickstart-5/328349>\
**Category:** Programming & Scripting\
**Tags:** unreal-engine\
**Created:** [August 11, 2015, 6:36pm UTC](https://forums.unrealengine.com/t/help-with-programming-quickstart-5/328349 "2015-08-11T18:36:01Z")\
**Posts on this page:** 1\
**Showing post:** 2

<div class="post-metadata">

**Author:** ![anonymous\_user\_8e2766aa](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@anonymous\_user\_8e2766aa](https://forums.unrealengine.com/u/anonymous_user_8e2766aa)\
**Post date:** [August 17, 2015, 1:36pm UTC](https://forums.unrealengine.com/t/help-with-programming-quickstart-5/328349/2 "2015-08-17T13:36:21Z")

</div>

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](https://d3kjluh73b9h9o.cloudfront.net/original/4X/e/1/7/e17fae714c4d6f58535248814a06ee31ac7c2263.png)

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

![54444-getrandomreachablepoint.png](https://d3kjluh73b9h9o.cloudfront.net/original/4X/d/0/3/d03f6b08cfd55654697f5e8081e59cf943f7bb43.png)

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

> **[A new, community-hosted Unreal Engine Wiki](https://forums.unrealengine.com/t/a-new-community-hosted-unreal-engine-wiki/141494)**
>
> After over a year in maintenance mode, the official Unreal Engine Wiki is now permanently offline. These resources now live on a new community-run Unreal Engine Community Wiki — https://unrealcommunity.wiki/! You will be able to find content from...

Hope this helped!

Good luck!

---

_[View the full topic](https://forums.unrealengine.com/t/help-with-programming-quickstart-5/328349)._
