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:
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:
This blueprint communication is really confusing me, help is very appreciated.
asked Mar 06 '15 at 05:39 AM in Blueprint Scripting
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.
answered Mar 06 '15 at 05:54 AM
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: 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:
Follow this question
Once you sign in you will be able to subscribe for any updates here