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"

Set Character Position From Level Blueprint

I'm facing a lot of difficulty trying to have my blueprints communicate with each other. I use an event ticker (for testing) in the level blueprint that calls a custom event I made in the first person character. I added a variable to the level blueprint that contains the first person character (and it's been made public). I dragged a reference of the first person character and tried to call the custom event through using the ticker, no luck.

first person character:

alt text

level blueprint: level blueprint:

This works if the event tick is in the first person character, but something in the communication to the level blueprint is messing things up. Next I tried event dispatchers, despite my little experience with them. Here's what I made, it keeps getting the error : "Error Accessed None 'FIRST PERSON CHARACTER' from node Event Tick in blueprint FirstPersonExampleMap"

first person character: alt text

level blueprint: alt text

This blueprint communication is really confusing me, help is very appreciated.

Product Version: Not Selected
Tags:
more ▼

asked Mar 06 '15 at 05:39 AM in Blueprint Scripting

avatar image

NoahZr
1 1 2 2

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

2 answers: sort voted first

I think your issue is instantiation order, your level BP instance is generated before your character instance so when your level BP goes looking for the character on that first tick, it is not there yet. Have your character get the location from the level instead and do your moving in the character BP.

Or, create a function interface, set up the function to do your magic in the level BP but have the character request the execution.

Hope that helps.

more ▼

answered Mar 06 '15 at 05:54 AM

avatar image

Purecyn
466 9 7 14

avatar image NoahZr Mar 06 '15 at 10:12 PM

I tried your first suggestion. What I did was set up a trigger box to signal the player controller when anything overlaps it. I made it fire an event called "move please" which is defined in player controller. This does not work, the overlap part fires but the 'move please' event doesn't fire in the player controller.

alt text

alt text

I'm not sure what the difference is between those two nodes

avatar image NoahZr Mar 06 '15 at 11:00 PM

I just tried the other person's (Jurif) reply, that seemed to work. For others having this problem, and for myself when I forget this next week, here are the screen shots:

alt text

alt text

alt text

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

Hey, well in general when you use several Blueprints to communicate between each other , it's a good idea to use GameMode (c++ or a blueprint) that should handle the core gameplay stuff. It's the way engine is designed, but of course you can find your own way of doing it. The point is only one GameMode exists at a time, so there's no confusion.

Next try just using "SetActorLocation" node to set your character location.

And here is a screenshot of example of casting a GameMode reference to any other blueprints, first create a newVariable and name it GameModeVariable, for type select "object" type - parent GameMode (c++ or a blueprint). Then create nodes like in screenshot, first you get the game mode and cast it to your blueprint , then save(set) the reference to the variable in your new GameModeVariable. alt text Now you can put your new variable onto the event graph, and when you click and drag of the pin , when you release the button, a window pops up, and you have access to all the content of the GameMode class(c++ or blueprint). You can use this method with any blueprints. alt text

For example now you could go into the GameMode class and create a new variable myCharacterVar. Then you could access this variable from all other blueprints that have reference to GameMode like this: GameModeVariable->myCharacterVar. If for example you would have many characters in the game and would like to keep track of which one was clicked last you could just set up the click event on your character, and do:

 onClick->GameModeVariable->myCharacterVar = this ; (= Self)
screenshot362.jpg (155.9 kB)
screenshot363.jpg (96.8 kB)
more ▼

answered Mar 06 '15 at 11:48 AM

avatar image

Jurif
632 27 15 45

avatar image Jurif Mar 07 '15 at 02:08 PM

You're welcome, I also want to point out you don't really need to Cast the GameMode like that, since there's only one GameMode , you can access it from all classes simply by BeginPlay->GetGameMode->Store reference to variable. However you do need the cast thing with other classes.

avatar image NoahZr Mar 08 '15 at 05:02 PM

Thanks a lot! One more question, for some reason, communicating between the player controller and the game mode is giving blueprint (or me) a hard time. Everything seems to be cased correctly. I made sure that the world settings had the correct game mode. What's going on?

alt text

alt text

avatar image Jurif Mar 08 '15 at 07:08 PM

Ok, I think the problem is with the sphere variables, I see you have Sphere variable in GameMode blueprint and in PlayerControler, but you only need one reference to your sphere. You can make this work as it is but rather simplify it by doing this:

  1. You create a "SphereReference" variable (object type) in your GameMode blueprint.

  2. You don't need anything else in GameMode blueprint.

  3. In your Sphere blueprint and your Player Controller blueprint you only need to get a reference to GameMode blueprint : https://answers.unrealengine.com/storage/attachments/32664-screenshot362.jpg

  4. Now open your SphereBlueprint and add "eventBeginPlay->GameModeReference->SphereReference=Self" (there is a node "get reference to self). Now GameMode blueprint has reference to the sphere.

5.Now in your player Controller you finally do the set location like this: "GameModeReference->SphereReference->SetActorLocation()"

avatar image NoahZr Mar 08 '15 at 09:29 PM

Ok, I think i followed your directions. For some reason it's not working. Here's a imgur album I tried using the "self" reference for the sphere, but it didn't work. So I tried making another variable (that was a "sphere blueprint" and used the eye dropper tool to select the object in the scene in the defaults panel. This didn't work either. I really appreciate your help, communication between blueprints is pretty annoying

avatar image Jurif Mar 08 '15 at 10:44 PM

Yes you're almost there :), yes the SphereReference needs to be a variable object type of your SphereBlueprint, and the GameModeReference variables need to be a object type of your GameModeBlueprint. So recheck that. Then actually this should work as it is, the EventGraph is correct. I'll check back tomorrow after work, Good Luck :)

avatar image NoahZr Mar 09 '15 at 02:04 PM

Awesome, it's working perfectly. Thanks a lot.

avatar image Jurif Mar 09 '15 at 05:50 PM

You're welcome :).

avatar image NoahZr Mar 08 '15 at 05:36 PM

I don't quite get what you're trying to say in context to my blueprints. I'm simply trying to move a sphere using a vector position created in the player controller.

avatar image Jurif Mar 08 '15 at 06:42 PM

I was just trying to explain how things work in the engine, I wasn't referring to your blueprints.

avatar image Mortusnyte Mar 08 '15 at 07:19 PM

He was replying to a comment I left. I hadn't noticed that the original question had been resolved and that a second question had been posed. My bad.

(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