x

Search in
Sort by:

Question Status:

Search help

  • Simple searches use one or more words. Separate the words with spaces (cat dog) to search cat,dog or both. Separate the words with plus signs (cat +dog) to search for items that may contain cat but must contain dog.
  • You can further refine your search on the search results page, where you can search by keywords, author, topic. These can be combined with each other. Examples
    • cat dog --matches anything with cat,dog or both
    • cat +dog --searches for cat +dog where dog is a mandatory term
    • cat -dog -- searches for cat excluding any result containing dog
    • [cats] —will restrict your search to results with topic named "cats"
    • [cats] [dogs] —will restrict your search to results with both topics, "cats", and "dogs"

How would I open a level and set a character location in the same BP?

I am still pretty new to using blueprints in unreal. The scenario is I have a level select widget and some of the locations I would like to go to are in the same level. So far the only way I can think of in the blueprint I have is to reopen the level and and change the players location. However the blueprint seems to stop after the open level function. Is there a way I can have the action continue after the level is loaded with out having the blueprint inside the level blueprint?

alt text

Product Version: UE 4.15
Tags:
ue4.jpg (120.3 kB)
more ▼

asked Mar 30 '17 at 12:42 PM in Blueprint Scripting

avatar image

josh_bodd
3 1 2 3

(comments are locked)
10|2000 characters needed characters left

2 answers: sort voted first

It's not a good idea to add some gameplay code to a widget.

You can simply add a PlayerStart actor to your map and your character will automatically spawn here. GameMode has some functions that you can override to choose the correct PlayerStart if you have more than one.

Also there is a blueprint for the map :

alt text

You can add a Event BeginPlay and set the location of your character

more ▼

answered Mar 30 '17 at 01:00 PM

avatar image

Jackblue
244 2 13 14

avatar image josh_bodd Mar 30 '17 at 01:19 PM

Oh ok I see. Inside the Level Blueprint what can I do to let the player control which spawn point they can go to?

(comments are locked)
10|2000 characters needed characters left

You can add SetActorLocation node to a custom event in your player character or player controller blueprint and just cast from the widget to character or player controller and call event which will fire SetActorLocation. You can also transfer variables such as vector with location to custom event.

alt text

alt text

blueprint_1.png (103.0 kB)
blueprint_2.png (68.3 kB)
more ▼

answered Mar 30 '17 at 01:37 PM

avatar image

PlainBane
206 5 13 16

avatar image josh_bodd Mar 30 '17 at 02:19 PM

Thank you. This might be out of my basic knowledge of blue prints. Let me see if I can get this to work for me.

avatar image PlainBane Mar 30 '17 at 02:35 PM

If you just need to set character location on game start then solution offered by the other guy will be more fitting, this is more if you need to update character location at runtime on button press. It also shows how you can communicate from widgets to blueprints or blueprints to blueprints.

avatar image josh_bodd Apr 05 '17 at 02:13 PM

Thank you for showing me how to communicate through widgets to blueprints.

I removed the gameplay code from the widget I had and just made it communicate to the player and then to the level blueprint to do an event on level open.

Everything goes through except for the integer being set. I'm not sure if I am going about this in the right way.

I have two floors in one level. I overwrote the gameplay to allow player spawn on other actors other than player start. I basically want the level blueprint to read which floor button I hit and then spawn me in either location depending on the button pressed.

I included a screenshot of my setup. Would you have any pointers for me?alt text

ue4_01.jpg (1.9 MB)
avatar image PlainBane Apr 05 '17 at 03:51 PM

It's probably because you have Event BeginPlay inside LeveBlueprint. When the game start's it get's fired and that's it. When you press a button it cast's to palyer character and sets Level2Int value. Level blueprint doesn't get called on button press and so it does't execute. I made a little sample project to show how to do this. Google Drive link. Take a look at Widgets/LevelSelect, FirstPersonCharacter blueprint and Level Blueprint.

avatar image josh_bodd Apr 05 '17 at 04:59 PM

Should I have the level select widget communicate with the player about opening a new level and then changing the position to spawn? Rather than having the widget to communicate with the player which then has to communicate with the level blue print?

avatar image PlainBane Apr 05 '17 at 05:46 PM

If I get what you mean. You can have open level node in player blueprint and then call level blueprint. Play around with the tutorial project and see what works and what doesn't. It's just an example, not saying it's one and only correct way to do this. You can have it built any way you want as long as it functions.

avatar image josh_bodd Apr 05 '17 at 06:52 PM

Will do thanks for your help!

avatar image josh_bodd Apr 05 '17 at 10:13 PM

OK found out my problem. My level wasn't saving the variable. i needed to place the variable inside a game instance. Took me awhile to figure that out. Thank you for all your help guys!

(comments are locked)
10|2000 characters needed characters left
Your answer
toggle preview:

Up to 5 attachments (including images) can be used with a maximum of 5.2 MB each and 5.2 MB total.

Follow this question

Once you sign in you will be able to subscribe for any updates here

Answers to this question