I have an actor BP where i set the location. I try to set actor/world location and then call this/get the world location from another BP so the actor has his fixed location and i can then just call this information where it is located. So on the other BP i have reference to the same actor and i try to get the actor’s location but it aways gives me wrong location which is at 0.0.0. I have print string on both BP’s. Where i set the actor location and it shows me on the print string the correct coordinates but when i try to get this location from the other BP it shows me 0.0.0. Any help would be great!
Here is the actor where i set the location and then the other actor where i try to get the location…
You mean the nav mesh bound volume ? Yes i use that.
I want that the enemy’s move to the location of this actor. I can manually type the coordinates and they will go there but i need to save the location of the actor and then get its location on different levels. So all i need is just to set the location which works and shows correctly on print string but i cant get the same actor location again from the enemy BP of this actor thats all. There must be some simple step to get the actors location from another BP… I have reference there to the actor. I tried get actor location as well as world location and changed accordingly in the actor BP set actor location/ set world location but both methods failed so far
Maybe i explain it wrong is acctually really simpel i have a portal and my enemy ai move to this portal. All i need is to get the location of this portal so the “ai move to” node knows where the location of this portal is.
So i get in this enemy ai blueprint a reference to the portal then i use “get actor location” node and hook it to the portal then this location to the “ai move to” node but then it reads any time wrong location of this portal and sets it to 0.0.0
So how can i make that the ai move to recognize the true location of the actor (which is this portal) ? It shouldnt be hard is so basic and it dont work for some reason
I tried the same with SET world location and GET world location and have the same results. In the portal/actor blueprint where i set the location the print string shows correct coordinates and in the enemy bp i cant get the coordinates and is the same 0.0.0
Looks like i cant access the information of this portal. The portal is spawned in the world and the reference to it in the enemy bp is set to editable /expose on spawn options on if that is needed…
It simply means your actor variable is currently empty (not valid). You can use the “get all actors of class” node to find the portal you want and set it to your portal variable reference.
A better approach is to spawn the portal from the ai class and from there, you can get the reference straight away without using an expensive node like this.
And btw why is that the variable is emtpy/not valid? should i not try to fix that somehow then this must be the most basic logic to just get a reference to an actor then call the location from it whitout using nodes that put more heavy calculations to save performance? What can cause that the variabale is not valid?
Edit
I just fixed it with get actor of class just like you say and then from it i could drag directly to get world location and to ai move to node. Thx for the help
To do this, you just have to use the “spawn actor from class” node and from the return value of this node will give you the reference of the spawned actor that you have specified. As simple as that, you will have the specific actor reference as well as the control of the spawned actor. Same end goal but a different method.
In programming, you will have to assign the object variable to be something because if you not it will by default be empty. The same applies to the blueprint since it’s from C++ base programming language.
For example in JAVA:
//Creating empty object:
//This is what you had earlier
//Which is equal to nothing although you have specified the class type it
//is still empty.
Animals a;
// To assign it you will have to use the "=" sign with respective to the object
// This is your missing part.
Animals a = new Animals();
Hope it explains it. In the end, Epic Games told us we don’t need programming skills to make games, but in reality, we still need them.