Download

Direct Communication with Player Instance

Hi,

I have a blueprint for a FPS Stealth Character. This character has a variable called ‘PlayerVisibilty’. I want this variable to hold how lit the player is and to do so I have a blueprint for my lights which calculates the distance between the light and the player and based on the attenuation of the light generates an arbitrary light value.

This works fine but my problems arise trying to communicate with the player character. I want alI the relevant lights to update ‘PlayerVisibility’ adding their light value each time. I have set up my reference variable in my light blueprint as follows:

My light requires that I select the instance of my player (see below) but as I’m using a player start my player doesn’t exist until runtime. Therefore there are no options in the drop down.

Capture2.PNG

Any help figuring this out would be greatly appreciated.

You have to pickup the reference to your player at runtime using GetActorOfClass ( in the light BP ).