How can I implement random character movement in the character blueprint?
I want to implement a system when at begin play the character chooses a random point (within the confines of the level) and moves to it. Once they reach this point they will choose another point and move to it and so on.
asked Sep 12 '14 at 08:57 AM in Blueprint Scripting
So first of all. Depending on what you want to do I would suggest using an AI controlled character.
It is a lot easier if you use the "Move To" command and a Behavior Tree as it automatically has this function. You create a task which finds the point where your unit should walk to and then simply call the "Move To" node.
But if you want to do this in this actor you could add a branch behind your current function, checking if your character is at the location and only changing the target (where he moves to) when he is.
To get a location within a certain space you could do a few things. There is a node called "Get float in range". You can use this 2 or 3 times (depending if you just want a walking character (without the Z axis) or if you want a flying one) and make a vector. You can define the boundary for this variable so for starters you could just hardcode it.
You could also use two target points (Which you can set later in your level when you place the actor) and use those to define the boundary or use a second actor which is a volume with a function to get a random point within it and call this from your actor every time you need a new one.
answered Sep 12 '14 at 11:08 AM
The easiest way is to make an Aiconteroller BP with a "get random point in radius" set the base location (can be the characters current location) and radius "move to location" ( not the simple move to) set acceptance radius and place a nav mesh volume in the level. If you need I could make and post a BP later.
answered Sep 14 '14 at 01:52 AM
If you wish to do it the way you are, you could also get the random point and get your location and check vector length and feed that into a Boolean as to whether or not you can move.
answered Sep 15 '14 at 07:52 AM
Follow this question
Once you sign in you will be able to subscribe for any updates here