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 Call A Function From Level Blueprint To Be Used In Class Blueprint?

I am curious as to how to call a function from level blueprint, in a class blueprint? Usually I simply use Blueprint Comms... but I cannot make the level blueprint a variable to reference. I saw the event dispatcher, but not sure if this would work. I was hoping to somehow just call the functions in my level blueprint I already created.

Any advice would be appreciated, thanks

Product Version: Not Selected
Tags:
more ▼

asked May 10 '14 at 08:51 PM in Blueprint Scripting

avatar image

DreamBotStudios
146 32 48 54

avatar image Shadowriver May 10 '14 at 09:04 PM

Level bluprint should be some class, try search node that will get level class instance from which you can call funtion

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

1 answer: sort voted first

An event dispatcher would be the best way to go. You create the dispatcher in your class blueprint that resides within the level.

alt text

Name it whatever you like.. I named mine Say Hi!

First, create an event that will "fire" when you want to call your level function. For me, I just used a component over lap, so when the player walks in to it, it executes on the level. After that, drag the dispatcher out on to the graph and use the "Call" option. alt text alt text

Now, drop your blueprint in to the level and keep it selected. Open the level blueprint, right click, and start typing the name of your event dispatcher. It should pop up. alt text

Finally, just drag a wire to your function in the level graph. alt text

more ▼

answered May 10 '14 at 11:16 PM

avatar image

Demeese
165 11 18 24

avatar image DreamBotStudios May 11 '14 at 02:30 AM

Thank you for the detailed answer. What if you were spawning a pickup in the level... and this pickup would not spawn to the level started. Would you simply drop the pickup in order to create an action with that plugin.

My pickups modify the players ammo and health, so I had these pickups "overlap" events happen in MyCharacter.

Would I simply want to make these pickups happen in Level Blueprint (even though they are not in the level until the game starts)?

avatar image Demeese May 11 '14 at 03:15 AM

In this case you will want to be using Blueprint Interfaces. They are a little tricky to understand completely how they work from the start, but basically you can make your "Pickup" blueprint do all the work for you through the interfaces.

Say you have an ammo pickup that gives your character more bullets-- You can have that pickup blueprint transfer the information directly do your character through an interface. In this case, the only thing the level blueprint will be doing is spawning that particular pickup.

Assuming you haven't used these before --

https://docs.unrealengine.com/latest/INT/Engine/Blueprints/UserGuide/Types/Interface/index.html https://docs.unrealengine.com/latest/INT/Engine/Blueprints/UserGuide/Types/Interface/UsingInterfaces/index.html

Those two are a good start.

If you'd like to see a video, this is a good example of them in use.

https://www.youtube.com/watch?v=ditPJWnY5Cs

(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