BTService: get variable from character

Hi

I am trying to make a system for moving physics pawns around using dummy characters as guides.

Basically I have a character master which has no rendered mesh but can have an ai controller assigned. Each character master has a slave physics pawn assigned as a variable. This slave physics pawn is constantly pushed towards the master character. A sphereraycast is casted from the master to the slave and if blocked the master stops and waits until he can see the slave again.

This works rather well. I have little bouncing physics pawns navigating the level and all is well.

However now I am in the situation where I want to introduce visioncheck from the location of my physics pawn rather than the master character.

This is where things go haywire.

I have the slave pawn as a pawn variable in my master character. In the BTService I try to get that variable from the character but I cannot set the target of the “Get” node. My plan is then to assign the value of that variable to a local variable for the BTService and read the required data from that but I am stuck with the “Get” node.

Am I approaching this is a very silly way or am I overlooking something?

Thanks a lot in advance :slight_smile:

Hi,

As UE4 tells you this happens because self is not a NPC_Basic_A_Character_C. Self is the current service that you are modyifing. You should get your character somewhere and cast it to a NPC_Basic_A_Character_C and then get the slave variable from it. Summarizing, your target should be a character of type NPC_Basic_A_Character_C.

Hope this helps,

Aaaahhhh fantastic thanks! As you wrote I had to cast it to NPC_Basic_A instead of just Character… thanks a lot! Works a charm!