I’m working on simple AI script: “When player press the button, object is spawning. After that, player press another button to call a robot. Robot must go to spawned object by player.” That’s it : )
Here is my blueprints:
This is my blueprint for spawing object by pressing button.
This is blueprint for calling a robot.
As you see, this is place where i’m stucked. I need something to put on “goal” variable on “Simple Move Location”. How to told robot where the spawned object is ? Any solution for this ? Thanks in advice.
You can either give that variable a specific point or something alterable. Additionally, you can feed a random point to it through nodes such as random point in radius to cause your bot to move object. Have a look at this tutorial for more information on AI movement: A new, community-hosted Unreal Engine Wiki - Announcements - Epic Developer Community Forums
Thank you for your response : ) Glad to see, that someone is intrested in. I’m doing like you said but still no success… Meanwhile i saw all tutorials from that link, which you send but there is so much “intermediate” things, too much for me. All behaviour tree’s etc. etc. I need only one simple thing : )
Ok, if you want the robot just to move to one location and you want that location to be a spawned actor, what you will have to do is do what is called casting. You will want to “get all actors of class” in your robot, and set the class to the spawned object you want the robot to go to. Then do a “foreach” loop. Plug the array output into the foreachloop. Drag off of the “array element” pin and create a “cast to” to the spawned object. Then tell the robot to move to the spawned object when pressed. Basically what this does is tell the robot to look for any object that is your spawned object, then make sure that it is that object. If it is, move to it.
Thank you for your answer : ) I did like you said (i guess) but it still doesnt work (i’m pretty sure i miss something) take a look what i made :
This is my Robo blueprint for move to spawned object. Something missed ?
Cheers : )
Plug the pressed from your event into the Get AI Actors of Class.
I plugged as you said, but still no success. I have noticed something. When i start to play with debug on blueprint, when i press “b” (button exec.) nothing is happening. No signal from it.
Ok, I’m going to have you try a few things to see if we can figure out what is occurring. First, try using a different input (for example, instead of b use 1 or something similar). We can see if your b input is being consumed by something else. If that does not work let me know as the second test is slightly more complicated.
I replaced “button pressed” by “event tick” and it works : ) but there is no what i want As you said, i changed buttons for diffrent one, also i put numbers for that and guess what ? no success : (
If this is in a blueprint that is not directly related to the player, you will have to enable input by the player. I just thought of this. Go into your blueprint and Get an event begin play node, then place an enable input on this. Once you do this you should be able to get a number value to work.
Note: Make sure to set up your enable input to take input from player 0