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 to add Multiple Levels and Widget?

Ignore this problem for now.

Ok I know how to add levels and widgets. What I'm trying to do is, when I click on Play it should show a widgets showing "New Game" and "Quit".

Aim: When I click on "New Game" it should start my character running and load everything that I implemented in the level. And when character die it should show the Widget "Restart" or "Quit"?

What I did: Create a new Empty Level called "StartMenu" and widget with "New Game" and "Quit" options. When user or me Click on New Game it loads a new Level called "Runner". So good far now.

Problem: It is auto run endless runner game. When I open "StartMenu" Level. It display my character is falling and background. And then everything is dark because it is empty level. How to solve it?

I'm not good in explanation. But in short I want to create a Menu>Load New Level> Restart Level (On Death).

Is implementing multiple widgets in new empty level is good idea? Or is there better solution what I want to implement?

Edit: Ok. Problem was Game Mode. I was generating tiles/floor inside Game Mode Blueprint. I copied paste everything from game mode to level print. :)

Product Version: UE 4.7
Tags:
more ▼

asked May 18 '15 at 10:59 AM in Blueprint Scripting

avatar image

yogesh_gamer
75 22 19 24

(comments are locked)
10|2000 characters needed characters left
Viewable by all users

2 answers: sort voted first

Ok, a little tired so not great answer.

I can not find it right now, but remember that the tiles are deleted from behind the player so there are not a million of them. Put a BOOL up and when dies, stop that function happening. As I can not find the code I am sure a bool will work, but that is your issue.

I will see if I can find where it is done again.

Narg

capture.jpg (56.6 kB)
more ▼

answered May 18 '15 at 11:55 AM

avatar image

Narghile
1.7k 74 38 110

avatar image Narghile May 18 '15 at 11:59 AM

Found it

alt text

capture.jpg (27.1 kB)
avatar image yogesh_gamer May 18 '15 at 01:15 PM

I was spawning floors through "Game Mode" but now I'm spawning via level blueprint. So that they don't clash.

I have a function in Level Blueprint called "AddFloorTile". I want to call this function in Blueprint Class called "BP_FloorTile". Because in BP_FloorTile there is an End Trigger when player overlaps it and should call "AddFloorTile" Function from level print and delete current floor after 2 seconds.

Can u please tell me how to call level function in blueprint class?

And this screenshot was uploaded by me (99% sure) because Im using same functions.

avatar image Narghile May 18 '15 at 01:18 PM

Hi mate,

Can u please tell me how to call level function in blueprint class?

The only way I know, is call the BP in the Level, and send the data that way

Narg

avatar image yogesh_gamer May 18 '15 at 01:21 PM

I'm searching on Internet from last few hours but no success. Can you show me how to do it?

I found one solution here:

https://answers.unrealengine.com/questions/42175/how-to-call-a-function-from-level-blueprint-to-be.html

But its not working for me. :(

(comments are locked)
10|2000 characters needed characters left
Viewable by all users
more ▼

answered May 18 '15 at 02:01 PM

avatar image

Narghile
1.7k 74 38 110

avatar image yogesh_gamer May 18 '15 at 02:33 PM

What is most difficult thing for me while working on UE4? Casting. I have spent 3 weeks but can't understand this "Object" thing. :(

I tried similar way but Casting failed. :( Please tell me what should I do here and also refer me some Casting Tutorials.

alt text

unreal.png (129.8 kB)
avatar image Narghile May 18 '15 at 02:44 PM

With your pic, why are you running a loop?

Why do you need to cast the same object 3 times?

Just curious

Narg

avatar image DG Gage May 18 '15 at 04:30 PM

Here's a very simple rundown on what casting is so you can understand the concept and start developing complex concepts with it:

When you create a blueprint, it's like an unborn framework for any objects you create with it. You've created their look and behavior, but they're still unborn.

When you place a blueprint in a level, or spawn it with another blueprint, you're giving birth to a particular copy of that blueprint. This is called an instance. It's alive and ready to go.

If you put BallBP into the level twice, you'll have BallBP1 and BallBP2. They use the same structure, but are separate and individual entities. For simple actors like these, you can simply cast to them with a reference of their particular instance, with something like a levelBP reference, Get All Actors of class, Overlap results, etc.

Cast inputs are necessary because blueprints usually rely on something else to function.

Sometimes you even have a situation where you need to cast to component of a larger system. An AnimBP, for example, is only created when a character is in the world that uses that AnimBP for its animations. When that character enters the world, it creates its own instance of that AnimBP to use; otherwise, all characters using it would always be doing the exact same thing.

So for casting to something like that:

Get Player Pawn > Cast to [playerBP] > Get Skeletal Mesh > Get Anim Instance > Cast to [animBP].

And then you have situations where you need to change the physics on an actor. Since physics exist per component of an actor, you have to cast to a particular component (usually the root). You would have to give it info on what component it is, and what actor instance it's coming from. So that'd be something like:

[get actor instance] > Cast to Actor > Get Root Component > Cast to Primitive Component.

So, in summary, you have to be thinking about the instance of the actor in question and what info the casting needs to properly communicate with it.

avatar image yogesh_gamer May 18 '15 at 02:54 PM

In the beginning I'm spawning 4 tiles. And after that

Overlap End Trigger at the end of tile > Delete Last Tile > Spawn One More tile.

avatar image Narghile May 18 '15 at 03:09 PM

OK

Store them in a Array when you spawn.

Then in Get you can grab the one you want.

Here is a quick example, sorry for the Purple lines I am just use First Person Actor, that is all for example.

![alt text][1]

Narg

capture.jpg (72.9 kB)
avatar image yogesh_gamer May 18 '15 at 03:19 PM

I already did this. "FloorTiles_Manual_Test" contains all different floor tiles.

But problem is casting here. In my last screenshot I dont know how to cast "BP_FloorTile". I don't know how to set Object thing.

avatar image Narghile May 18 '15 at 03:24 PM

Might of been a bad example.

Ok, If you know what tile is next to be deleted, then you do not need a loop.

Run one function to spawn, and then get the array number of the next to be deleted and delete them.

You are only running 4, for doing it without loop would not be that bad.

Narg

alt text

1.jpg (10.9 kB)
avatar image DG Gage May 18 '15 at 04:32 PM

UE4 Antichrist has arrived

avatar image yogesh_gamer May 18 '15 at 03:32 PM

I'm not doing loop again and again. Just first time. So it not big deal.

By the way, here my problem is related to casting. Will you please temme how to cast my "BP_FloorTile"? It's 9PM here and before I go to bed I want to make sure that I did something new today.

avatar image Narghile May 18 '15 at 03:44 PM

So you are looping to spawn?

Narg

avatar image Narghile May 18 '15 at 03:44 PM

P.s. 1:44 am here

avatar image yogesh_gamer May 18 '15 at 03:54 PM

hehehe.. then u should help me before you go to your bed.

I'm looping to spawn 4 tiles in starting. Nothing else. After generating 4 tiles I'm not calling loop again.

Just reach end point of tile, there is invisible "Box Collision" which trigger and add one more tile and delete last one. In this way there are always 4 tiles present in level.

And Narghile, you always give good solutions and if I designed my little buggy game and it just because of you. U always helped me. We can discuss this loop later in some new thread. But right now Im here asking about casting.

And from last one hour you are just discussing about loop.

avatar image Narghile May 18 '15 at 04:32 PM

The rest is above

DG Gage 1 min ago Newest Here's a very simple rundown on what casting is so you can understand the concept and start developing complex concepts with it:

When you create a blueprint, it's like an unborn framework for any objects you create with it. You've created their look and behavior, but they're still unborn.

When you place a blueprint in a level, or spawn it with another blueprint, you're giving birth to a particular copy of that blueprint. This is called an instance. It's alive and ready to go.

If you put BallBP into the level twice, you'll have BallBP1 and BallBP2. They use the same structure, but are separate and individual entities. For simple actors like these, you can simply cast to them with a reference of their particular instance, with something like a levelBP reference, Get All Actors of class, Overlap results, etc.

Cast inputs are necessary because blueprints usually rely on something else to function.

Sometimes you even have a situation where you need to cast to component of a larger object. An AnimBP, for example, is only created when a character is in the world that uses that AnimBP for its animations. When that character enters the world, it creates its own instance of that AnimBP to use; otherwise, all characters using it would always be doing the exact same thing.

So for casting to something like that:

Get Player Pawn > Cast to [playerBP] > Get Skeletal Mesh > Get Anim Instance > Cast to [animBP].

And then you have situations where you need to change the physics on an actor. Since physics exist per component of an actor, you have to cast to a particular component (usually the root). You would have to give it info on what component it is, and what actor instance it's coming from. So that'd be something like:

[get actor instance] > Cast to Actor > Get Root Component > Cast to Primitive Component.

Summary.....

avatar image yogesh_gamer May 18 '15 at 04:11 PM

I think now you can help me.

alt text

unreal.png (269.0 kB)
avatar image Narghile May 18 '15 at 04:17 PM

To start with, why is your cast already named?

Would you not start with a blank one and add a result from an array

Narg

avatar image yogesh_gamer May 18 '15 at 04:32 PM

Exactly. This is what I did when I was using "GameMode". I could create a variable "Next Spawn Point" and could access it anywhere.

But right now I'm doing these things in "Level Blueprint". And I don't know how to access Level Functions or Variables. I know how to cast "GameMode" but I don't know how to cast "Level Blueprint".

Then I thought lets put everything inside my "BP_FloorTile". And then again I'm stuck at casting inside "Level Blueprint" as show in pic above..

I know the logic how to implement what I want. Just because of casting I'm having all these issues.

Even if i put everything inside "Level Blueprint". Then When character overlap "End Trigger" to generate one more tile. Then I have to cast again to "Level Blueprint".

avatar image yogesh_gamer May 18 '15 at 04:54 PM

@DG Gage You are write but this is the problem here. I don't know how to create or use an instance. There are basic examples on Unreal website but those are very basic. Like Cats to Character, Game Mode etc. If I want to access "Level Blueprint Variable" how would I access it?

@Narghile My profiles shows that you did comment 18 mins ago but here is no reply. o.O

avatar image Narghile May 18 '15 at 05:06 PM

If you can cast to games mode, just reverse the transfer of data. Have variables in LVL bp, cast to mode bp and grab that data.

Narg

alt text

1.jpg (10.9 kB)
avatar image yogesh_gamer May 20 '15 at 04:56 AM

@Narghile There must be a way to access "Level Blueprint Functions". If I can access Level Function then everything would be easy. Just one click away.

avatar image yogesh_gamer May 20 '15 at 05:11 AM

Why this solution is not working for me? UE 4.7.6

avatar image yogesh_gamer May 20 '15 at 06:22 AM

Okay. This solution was not working for me because I can't select An Actor or something else to generate event inside Level Blueprint because i'm spawning everything dynamically.

But still there must be a solution to call "Level Functions" inside "BP Class"?

avatar image Narghile May 20 '15 at 06:41 AM

Hi Mate

I do not know a way to cast to Level BP, only from Level to BP

Narg

avatar image yogesh_gamer May 20 '15 at 07:04 AM

Okay Nargile. I will try some different approach.

Can you tell me what is the ideal step to create "Main Menu"? Right Now, I'm trying a new "Empty Level" everything is black. But I know somewhere my character is falling in blank space.

Is it the only choice or can I do it in different ways?

avatar image Narghile May 20 '15 at 07:06 AM

You talking like a Widget Main Menu Level?

Narg

avatar image yogesh_gamer May 20 '15 at 07:22 AM

Yep.

Right now I created an Empty level named "Start Menu" when user Click on "New Game", it opens a level called "Runner".

avatar image Narghile May 20 '15 at 07:31 AM

Ok, you character will not be there to fall, unless you added Player Spawn point or Similar

Do you need help with the Widget or what exactly?

Narg

avatar image yogesh_gamer May 20 '15 at 07:42 AM

I created an endless runner with everything spawning inside "Game Mode".

Then I created "Main Menu" level. When I click on Play, it shows me Menu button player also start running.

Then I'm trying to put everything from game mode to Level Blueprint or Floor_Tile Blueprint. But I'm stuck here.

All I want to is when I click on Play button it show my Main Menu and when I click on New Game, character start running.

By the way can you do remote login? Like TeamViewer software (5 MB in size).

I know it will take you just 2 mins to solve my problem. Everything is ready, you have to connect just few nodes.

avatar image Narghile May 20 '15 at 07:52 AM

Not sure, never used team viewer.

Friend signed me up to his project, but wanting my skills to get better before I do that.

You set team viewer up and I can have a look.

Narg

avatar image yogesh_gamer May 20 '15 at 07:55 AM

@Narghile

From here you can download s/w: https://www.teamviewer.com/en/index.aspx

Size: 7.63 MB

After installing it will ask partner's ID and Password:

My Id is: 193 685 484 Pass: 5723

If you face any problem in connecting just msg me. When net disconnects password reset automatically.

avatar image Narghile May 20 '15 at 08:00 AM

OK, what am I doing. I can see your computer so behave

Narg

avatar image yogesh_gamer May 20 '15 at 11:50 AM

OK @Narghile I did as you said. I manually added one FloorTile. And then casting was working. But it was showing only one tile instead of 4. When I open simulation I found that all four tiles were overlapping, at same location. Because of "Attach Transform" Function. Pic Attached.

I think I have to connect something to "Target" node. When I was using Game Mode I cast it to BP_FloorTIle. But right here, "Add Floor Tile" and "Attach Transform" is part of BP_FloorTile. So I left it blank (self).

I did right thing or I have to connect this node with something else?

P.S. Attach Point is an Arrow Component located at the end of Floor Tiles. alt text

unreal.png (182.1 kB)
avatar image yogesh_gamer May 22 '15 at 04:33 AM

Here are all Blueprints. There is an attach point at the end of every tile, which is used to add new floor tile.

I want to spawn 4 tiles in the beginning of level. But all 4 tiles overlap each other, same location. Where I'm doing mistake?

alt text alt text alt text

unreal.png (148.5 kB)
unreal1.png (118.9 kB)
unreal2.png (46.4 kB)
avatar image yogesh_gamer May 22 '15 at 05:52 AM

OK, After few changes, I got it working. Just needed to cast to "BP_FloorTile".

But now one weird problem raised. Whenever I call "Destroy Actor" to destroy last floor tile. I get this (pic) error. Without "Destroy Actor" it is working fine. Endless Floor Tiles.

Can somebody help me to understand this error?

alt text

Update: When I set Delay to 2 Sec, only few (4 or 6) tiles generates. When I set Delay below 2 Sec then I get above error. :(

unreal.png (217.7 kB)
(comments are locked)
10|2000 characters needed characters left
Viewable by all users
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