Line Trace, Mouse Cursor, and Replication

I am trying to make it so that when the player casts a hit-scan/mouse over spell, the spell spawns an emitter that attaches to the casting player and to the location hit by the hit scan.

In the character native class:


In the case of hit-scan/mouse-over spell, it performs the following in C++:


HitScanTest is a BlueprintNativeEvent




Now, I’m running into a few bugs.

1.) The CurrentMousePick HitResult’s Location is always 0,0,0 for anybody with a Role less than AUTHORITY.



2.) Sometimes the CurrentMousePick doesn’t update. I’ll cast the previously pictured lightning bolt spell on one spot, move the mouse, cast it again, and it sometimes targets the previous location.

3.) Now, I wish to replicate this event for client events. Currently, when the authority casts the lightning bolt, it properly replicates. When the client casts the spell, it replicates the 0,0,0 targeted emitter mentioned in #1.

Any help is appreciated. Thanks.

Hey,

just a test:

Try putting a second custom event between these two:

http://i.imgur.com/0ZUO2vE.png?1

Make it “Run on Server”. Use an Athority Switch, if possible, and plugin the “Event hit Scan Test” into it. Take the Remote exec and plug it into the new event. Now plug in the “Authority” exec into your existing node and also the Red Node from your new Event into it. So that the server (authority) directly calls your SpawnAttack function and the client first tells the server to call it.

Did you get this to work ? im currently facing this issue where the mouse data doesnt get updated to other clients .

I solved my problem

or as I did in my project

in Player controller

in Player Character