Adjust client Player variables outside Player class

Hi,

I’m trying to turn my player invisible with the use of an external blueprint actor, which can be seen as an usable powerup. However it seems that I’m not allowed to adjust the player externally.

If I put everything in the PlayerPawn itself it is working:

However if I try to spawn an actor which handles the invisibility, it isn’t working as expected. The players still sees itself and only the server can make itself invisible for itself.

Does anyone know what I’m doing wrong? Or maybe it is not possible to adjust the player anywhere else than in the Player class itself?

get player character then from there cast to mycharacter

Ah how could I miss that. However when I cast the player for the first time, it gives an Cast Failed error. After that it works flawlessly. How can I fix that?

Hi stefanorie,

The Accessed None in the construction script (if you have no nodes in the construction script that may be causing it) is a known issue and shouldn’t impact performance. Does the blueprint seem to work despite the failure? If so it is most likely this known bug.

Hi,
Well it only doesn’t work the first time a call it. After that it seems to work fine. However it also needs to work the first time, because it’s gameplay important. Is there any workaround for this?

If you could, put a break on your cast and then attempt to PIE for the first time, see what information is getting passed to the node. Additional put a print string on the fail condition and see if that is going through or if the cast is just not responding at all.

I just added a delay of 0.1 seconds before the player turns invisible, it works great now. I think it has something to do with the replication of the player in the same Game Tick as changing a value of that player.