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:

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:

level blueprint:

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

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.

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.

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.


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:
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)

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.

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

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:

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.

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?

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.

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

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.

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 :
  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:

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

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 :slight_smile:

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

You’re welcome :).