Can't figure how to get a reference to a blueprint

I have this blueprint. It works correctly and spawns the baseball

I have My Baseball Speed set as a public variable

NewMySped.jpg

I have a widget. When I click the button I want it to change my baseball speed to what I have here in New Var 3. The issue is that the motion controller is none. I simply right clicked on the target and select promote to variable. I don’t know how to get this to reference my BP_motionController.

newWidget.jpg

Thanks

There’s a pin coming out of the Spawn Actor node that’s a reference to the Baseball actor. Save that to a variable.

Then when you want to change the speed, get the baseball reference and change the “Baseball Speed” variable on it specifically.

So I did this but it doesn’t work either. I am clearly missing a fundamental concept on accessing other scripts that I can’t figure out.

So this is now my spawn I assume the return value is the pin you are referring to.

Here I am trying to access it:

Yes, that looks good, but you have set the speed to zero?..

The above set up is correct. So what “Exactly” are you trying accomplish with the baseball? Details matter in this regard.

All I want is the baseball speed to change. It is currently -2500 on the x. Changing it to 0 would at least let me see a change. It does not work. It is still -2500 and I get an error message about baseball object being none.

I’ll create a BP tomorrow and upload it.

@Kobaltic

Here’s a step by step video showing how to accomplish velocity changes after spawning. Video covers the entire process from projectile actor creation, spawning, referencing and modifying velocity after spawn (increase/decrease).

@Rev0verDrive Thanks for making the video. It still doesn’t cover the actual issue that I have. I have a widget with a button (see first post) (this is in a different blueprint then the one with the spawner). This is where my issue lies. In your video you use the ‘N’ key but the script is in the same blueprint. My issue is accessing that second blueprint. I can’t figure out how to reference another blueprint.

I’m assuming the first pick is of the character class or controller class.

In your widget you need to create a reference to the character/controller class that’s actually spawning the baseball.

Then its Get owning player -> get controlled pawn -> cast to character -> as character -> get baseball -> get projectile movement -> set velocity

I’d recommend creating a reference to your character or whatever on initialize. Then use that variable reference versus casting everytime (resources).

Final …

Anytime you want to modify an actor/class/object you should have the actor/class/object make the change to itself. Basically all the logic (set velocity, material etc) should be in the things class. You just call an event to execute said logic. Semantics, yeah yeah whatever. Just good practice over all.

So with that and keeping with the video …

Thank you so much for your help. I finally got this to work.