-

How To Spawn A Character At Target Points Plus Menu Unreal Engine 4

Learn How To Spawn A Character At Target Points Plus Menu Unreal Engine 4. For this tutorials to work you need to select the Third Person Project with Starter Content.

First, let's create a variable that will hide the character HUD, open the character Blueprint, create a Boolean variable, call it showhideHUD, go to the end of the HUD script and add a Branch node, connect the Condition pin with the showhideHUD, from the Branch node drag the True pin and add a Set showhideHUD (set it to True, check the box), then drag from the HUD reference an Add to Viewport node, connect it with Set showhideHUD variable, from the Branch node drag the False pin and add a Set showhideHUD (set it to False, let it unchecked), then drag from the HUD reference a Remove from Parent node, connect it with Set showhideHUD variable (set to False). That's all, now, we have a Boolean variable that we can call to show or hide the character HUD.

Next, create a new Widget Blueprint, go to Content Browser > click RMB > under User Interface select Widget Blueprint > for example purposes, let's call it LevelsMenu.

Open the LevelsMenu Widget Blueprint, drag from Palette a Border into Hierarchy > Canvas Panel, go to Details panel, in the Slot section next to Anchors select the full page Anchor, next to Position X type 0 - next to Position Y type 0 - next to Size X 0 - next to Size Y 0, under Appearance > Brush > double click the Tint bar > in the Hex sRGB type 000000FF

Next, drag from Palette two buttons into Hierarchy > Canvas Panel, for each button drag from Palette a Text, select the first Text, go to the Details panel into the Content section next to Text, erase Text Block and write Level 1, select the second Text, go to the Details panel into the Content section next to Text, erase Text Block and write Level 2.

Select the first button, go to Details panel, next to Position X type 800 - next to Position Y type 300 - next to Size X 300 - next to Size Y 100 - next to ZOrder 1, select the second button, go to Details panel, next to Position X type 800 - next to Position Y type 500 - next to Size X 300 - next to Size Y 100 - next to ZOrder 1.

Select both buttons, go to Details panel, under Appearance > Style > Normal > double click the Tint bar > in the Hex sRGB type 6B6B6BFF - do the same for Style > Hovered and Style > Pressed.

Now, we have the visual part, let's start scripting. Select the first button, go to the Details panel, under Events section > click LMB on the green button next to On Clicked, you will be transferred in the Graph editor, were you will see your newly created event, from here go in the right corner up and select Designer, this way you will be switch back to the Blueprint Designer Mode, were you will need to select the second button and perform the same steps as for the first one.

Now, in the Graph editing mode, go to My Blueprint > Variables, add two new variables of the Transform type, name them Transform 1 and Transform 2, select the event for the first button and add a SpawnActor node, set it to your character Blueprint, add a Get Transform 1 in the Editor Graph > click RMB on the pin > Split Struct Pin > connect the Location and Rotation pins with the Location and Rotation pins of the SpawnActor node, add a Get Player Controller node, from the Return Value drag a Possess node, connect the In Pawn with the Return Value of the SpawnActor, next, drag from the Get Player Controller node, Set Show Mouse Cursor (unchecked), connect Possess node and Set Show Mouse Cursor, add to the string Set Game Paused (unchecked), off the Get Player Controller, use Set Input Mode Game Only, then, add a Remove from Parent node at the end, connect the Set Game Paused with the Set Input Mode Game Only node, select the event for the second button and repeat the steps for the first button, but instead of the Transform 1 variable use the Transform 2 variable.

If you do not see and Event Construct node in the Editor Graph, add one, click RMB > select Event Construct, add a Get Player Controller, drag from the Get Player Controller node, Set Show Mouse Cursor (checked), add Cast To your character Blueprint name, connect the Object pin of the Cast To (character Blueprint name) with a Get Owning Player Pawn node, then from the As pin of the Cast To (character Blueprint name) drag and add Set showhideHUD node (unchecked), Compile and Save, then close the Widget Blueprint.

Add two Target Point actors in your game level, then, open the Level Blueprint and add a reference for each of them in the Event Graph, connect each of them to Get Actor Transform node. Next, add an EventBeginPlay node, drag of it, add a Create Widget node set it to LevelsMenu, drag of the Return Value of Create LevelsMenu Widget node Set Transform 1, connect the Transform 1 pin with the Get Actor Transform node of the first Target Point reference, drag of the Return Value of Create LevelsMenu Widget node Set Transform 2, connect the Transform 2 pin with the Get Actor Transform node of the second Target Point reference, add to the string an Add to Viewport node, then a Set Game Paused (checked), Compile and Save, then close the Blueprint.

Congratulations! You have a menu for a game were the character spawns in multiple target points on the same level, if you have questions or you need additional help, contact me by posting a comment in the comment section below or through the contact page.

Interesting articles to read on Edvog.com
Unreal Engine 4 Beginner's Guide
Unreal Engine 4 Tutorials & How To's (With Pictures & Video)
Blender 3D Beginner's Guide
GIMP Beginner's Guide

- - - - - - - - - - - -

About Edvog.com - Music, Games & Educational Resources (Information, Health, Medicine & Research) by Edvog.com

My name is Andrei Ionita, I am the creator and owner of Edvog.com website, I am also the creator and owner of all of the products associated with it, such as: music, games, videos and more...

I like to write articles about everything I find interesting in this world. The entire content found on this website is fact checked and original, when I post something, I try to double check all the information provided against all the reliable and trustworthy sources that I can find. On this website you may find content about medicine, the purpose of this type of content is simply informational and is not intended to be a substitute for professional medical advice, for questions you may have regarding your health, always seek the guidance of your doctor or other qualified health professional.

About entertainment and media - Beside, being a website owner and content writer, I'm also a game developer, music producer and video creator. I create, video games, music, animations, photos and more, this is why, from time to time, I will also post content about entertainment and media industry (a broad terminology, just to cover everything in the category)

You can check out the games made by me on Steam and on Google Play, if want to listen my music you can check out my Youtube channel, Spotify profile, iTunes profile, Google Play Music profile, etc. Who knows? Maybe your next favorite game or song will be created by me :)

If you want to support my work, you can play the games created by me, listen to my music and/or Make A PayPal Donation, whatever form of support you will choose, I thank you and wish you a nice day!

Edvog.com / AI Edvog / Andrei Ionita on the internet

YoutubeSpotifyApple MusicAmazon MusicGoogle Play MusicGoogle PlaySteamSupport My Work Make A PayPal Donation

Comments