What object to cast in the cast function?

Hello,

I am trying to make the pawn angle vision of a character change when the player presses F. This is my player blueprint : http://puu.sh/njS9I/dc4520f4d3.png
And this is my other character (called Demon for no reason) blueprint : http://puu.sh/njScV/2ce22acfe3.png

I think everything should be ok, but nothing happens when I press F. I think this is because of the object I put in my cast node in the player BP.

Can anyone help me please ? I’m stuck since this morning :confused:

Get Player Character gives you the possessed character. Since your other character isn’t possessed the moment you hit F it doesnt send input there. You need to find another way to get a reference for the other character and then use that to cast.

I’m quite new to UE4 and I don’t know much about blueprint communication…Do you know how I can get a reference to the other character ? :confused:

Well then you are in luck! Epic streamed a video on BP communications just yesterday. You can watch it here:

:slight_smile:

Yeah, watch it all. It will gain you more time in the long run.

Well as i said you need to get a reference to that pawn but i need to know more about how you set things up. If you are looking at that other pawn when you hit F, for instance, you can use a trace and then use it’s hit actor result to cast to its BP. Or if that pawn is walking past a trigger you can use the overlap event to get a reference and then send that to player character BP. So yeah, the video will probably help you quicker than i will here.

Wow, that’s a nice 2 hours video :slight_smile: did you watch it ? Do you know where I could jump to get what I need ?
I’m about to use Blueprint Interface, which could be better (in a matter of time) than watching the video.

Ah, nevermind, it is really well explained. I think i’ll watch it !

Ok, thanks dude ! :slight_smile: If you have the solution for my problem tho, I’d be glad to use it.

As a french man, let me tell you he speaks very quickly. It’s hard to keep focused on what he’s saying.

It’s even simplier than what you said. I simply want to lower the pawn angle vision of a character when I press F.

How many of it is there in the level?

I get what you are trying to do, i’m just trying to find the best way for you. So, if you have only 1(or just a couple of) those demons you can do something like this in your player character BP:

You’ll call your ChangePawnAngle custom event(from your first post) instead of my CustomEvent_0 and set the angle.

Drag from the Array Element pin and search for your custom event name, it will be connected automatically. Also dont forget to set your other demon pawn in Get All Actors of Class node.

I’m not sure I get your question. Tho, I can say there is only 1 demon (for the moment) and 1 pawn angle vision per demon.
I don’t know if that is simplier for you to understand, but here is anothing I would like to do :
I want to get the value of the PawnAngleVar which is in my Demon blueprint ( http://puu.sh/njX7v/16a64b63ad.png ). I would like to print it on my screen when I press F : http://puu.sh/njXeb/98b6759eb7.png

I see the logic you’re want me to use. I could workd yeah (for now, UE4 crashed), but I have a little problem : I can’t link the Array Element to the Target element. I’m still watching the video at the same time.

It must be the loop giving you that error. Delete that Loop > drag from that array pin and then recreate Loop.

“Demon reference is not compatible with Actor reference”. I’m still checking…

Nope. Actor isn’t an element. Looks like this way of doing is wrong :confused:

Ah yeah you’re right ! It’s working now ! Thanks a lot dude, you really rock ! I will still try to use a cast function so I can understand how it works.
Tho, thank you a lot !