Set actor location issue

Hello,

After opening a level, I want to teleport the player pawn to a new location that is set previously. I have checked that this location is correct and not equal to 0 and also made sure that the target is the player pawn. However, it does not teleport the player at all !
I even checked if the return of “setactorlocation” is true and it is (see the screenshot).
I’ve tried adding some delay after the level is opened but it doesnt seem to keep the “node flood” (sorry can’t think of an english word) going at all, I checked it.
I tried with the function “teleport” but it remains the same, I tried to connect player character or a reference to the bp_player pawn and nothing of this works.
I also tried to check “teleport” or “sweep” but nope.
I mean, opening the level automatically teleports the player to the 0,0,0 location of the world (it works for me) but I just want to spawn at another location so if there’s any other way to do it i’ll take it.

Thanks you for your help and if you can tell me what i’m doing wrong, i’m still new to UE4 ! :slight_smile:

PS : on the screenshot, on the left I just call the “open level” with a bunch of variables being set.

269389-setactorlocation.png

what has me interested is your post script where you say to the left is the open level do you mean a open level node or just the begin play and some things that get set at the beginning of the level?

I mean the open level node. As I said, it does work because it opens the level and teleports my player, but to the 0,0,0 location, not the location I want to (which is different than 0,0,0)

You can’t use an “Open Level” node and then script after it. It is like calling “Destroy” and then having something after, it won’t ever get called. You need to set the actor location in the level BP or some BP that actually exists in the “opened” level, not from the BP that opened the level, that thing will be long gone.

Additionally, the (0,0,0) location is likely a “player start” or simply the default location if nothing is specified to spawn the player in. That is why the player always ends up there.

Oh ok I didn’t know that !
I’ve got a few more questions, I don’t unterstand how’s the return value “true” (in the screenshot) if that works like that ?
I’m calling this open level in the Player BP, does that mean the BP itself can’t be used or just the nodes after the “open level” ?
Anyway, i’ll try to put it in the level BP then, seems more appropriated !

i completely agree with Nebula on this one. i would also add that if you are basing the players start location in every level in a similar manner you could have the teleport script in the game mode as well since the game mode is recreated for each level.

That’s not really what I want to achieve but i’ll keep that in mind :wink:

Possibly, and this is just a guess as I have never actually scripted anything after an “open level” node, it may still be able to pass execution through for the few milliseconds while it actually loads a new level in and removes the old one allowing you to see the print string. However, one thing I am certain, once you open a new level, anything you had prior to that, so a character in the old level for example will be completely destroyed and wiped clean and the new level will re-initialize a character pawn into the newly created level. So in effect even if you were to run script after you opened a new level, you would be moving an old instance of your player character. The second a new level opens up, your old level and everything it contained including your old character (moved to the desired location) would be gone.

Alright ! That’s perfectly clear, thanks a lot for your help !