Changing a variable from another blueprint

Everything, I succeeded, thanks, but the information where to see the class of the object would not be superfluous

Everything works like this

such a question, but how to make a cast on a level blueprint? I need to get the value of a level variable.

you cant.
level bp is a global actor like game instance and game mode.
you can set up an event dispatcher in game instance or you can get the actor in level bp and send it from there.

Well, probably there are some “global” variables. Where can they be created? Such variables that you can access them from any object.

Now I have a different problem. When opening doors and turning on / off light switches, I need to turn the main character in their direction, just not immediately, but gradually, with a certain rotation speed, with the ability to set an offset from the center of the models.

What does it mean to Cast On a level blueprint?

You can place script in the LB (including what was suggested above) and send data to any actor you want. Actors that are manually placed in the level can be referenced directly by dragging their references from the World Outliner to the LB Graph.

Actors spawned dynamically are a bit more tricky as you either must reference them manually (can get messy) unless they belong to the framework, or rely on LB events to communicate with them - pretty standard straightforward.

It’s very difficult to advise you anything as we don’t know what you’re doing. I hope I’m wrong but to me it seems you’re approaching things right - or perhaps I should say not the UE4 OOP way.

as i said, game instance and game mode are global classes that can store variables for easy access

as for the second problem just google lerp movement and in combination with a timeline and some math…

Timeline + Lerp can rotate along any axis, you could rotate a vector with a timeline. Or attach something to a scene component dummy, apply local offset and rotate the dummy.

I’ll just add that it’s generally a bad idea to store data in the LB, in most scenarios, at least.

Now the sound is played only after 2 seconds after the start of the run and then it does not interrupt when the hero stops. Tried finding sound stop but to no avail

the sound is played only after 2 seconds after the start of the run

Either like this:


Or like this:

it does not interrupt when the hero stops

Invalidate the timer when stopping happens, you could go at it all blueprint spaghetti like so:

Or, alternatively, spend some time investigating how sound works in the engine, for example:

More info:

Thank you so much -2 works great
I converted the sound and made it 1 second, and after stopping, its continuation is almost invisible

1 Like