Download

AI MoveTo question, and how to figure things about when documentation is brief

Hello, I was watching some tutorials on using a Timer to make a custom event move. I am attaching an image. My question in the image is about the AI MoveTo. The tutorial user did a cast(why not a direct reference to player?) to access the player and to change one of its properties every X seconds.

I wanted to do something with an AI character. I started with a cast, even though I thought to myself, why can’t I just get a reference to the AI Character, as can be seen on the left side, under the Custom event. So then I just started getting confused.
AIQuestion.PNG

I looked at the documentation for AI MoveTo to see what each input is, and it is very vague. The link is here:

0d1df1a6ada59506c6b7df0b6f80ae55a29ec403.png

I don’t know if I’m stuck yet, but I don’t understand the documentation because it does not tell you what each of the inputs are. For example, is Target Actor the AI Character, or is it a character you want the AI to move towards? I was wondering, in situations like these, how can one go about knowing exactly what each input is used for? Does one have to ask everytime or is there a way to be able to see some information as to what should go in each input. I hope the questions is clear, I think knowing this would help alot for future function testing. Thanks!

When you use the cast to function I’m pretty sure you need to send it an object that it needs to verify, otherwise it will not know what info to get and it will fail. If you already have a reference to the AICharacter and you’re plugging it into the input on the Move To function, then you don’t need to cast. If you remove the Cast To, every time you call on to the MoveAIGuy event, the AICharacter will move to wherever the Player’s location is. It seems the setup you have should work, minus the Cast to node, as long as the rest of the level is set up correctly. I’m thinking the World Context object that you’re plugged into on the AI Move To function is something new and possibly optional, being it’s not even in the documentation there. Pawn will be the character pawn that you want to do the moving, Destination if obviously where you want them to go.

Don’t forget that you can hit play on your game and still watch those blueprints to see where the lines are activating at. I use it all the time by opening the gameplay into a separate window. It makes it easy to watch the blueprints at work. Add Print String commands too so that you know when things are happening properly.

I could be off, so I’m hoping other experienced devs will chime in. I’m still learning as well. I have learned a lot from these forums though so good luck!

If you just click on the open graph and create an AI MoveTo, then you should get the version without the World Context pin, and all should be good. I think the World Context pin is only showing up because you may have dragged off of the cast when you created the call.

Hey there, i have a few questions myself:

What exactly is the acceptance radius?

Also, what conditions must be met for the “on fail” execution pin to fire?

Acceptance radius is how many units the pawn has to be within the target location for success. If you set it higher, the pawn wouldn’t have to be as accurate as if you had it lower. I would imagine the On Fail would fire separately if the pawn could not make it to the target. For regular use though, just execute out of the pin above the On Success.

Thanks for the reply relic!

Im making custom ai and the fail clause needs to be very specific so i can design the AI properly unfortunately. I may need to poke around th C++ code to figure that out but i could take hours depending on how deep that particular rabbit hole goes :frowning:

The regular pin above it fires as soon as the AIMoveTo node is triggered and doesnt wait for it to finish executing correct?

Edit: follow-up queston; is it better to have this logic exist on the AI pawn, or on the AI controller itself?