ryanjon2040
(ryanjon2040)
November 24, 2014, 12:53pm
15
Sure.
I wrapped it in a function to keep my Event Graph clean and I just call that function from Begin Play.
http://i.imgur.com/RbiEOCC.png
In this function check if I’m the server and if I am, I spawn the weapon actor (this actor replicates) and store it in the character’s Weapon variable (variable replicates).
I then set the owner of the weapon to the character (as I call the weapon’s firing/reload functions from my character). Lastly I attach it to the weapon attachment point.
http://i.imgur.com/ZXvkxMU.png
Ofcourse the weapon fire and reload functions are ‘Run on Server’.
In my case, I would be unable to fire if I did not include my custom SetOwnerTo node.
FYI, from the Run on Server weapon fire function you could call a Multicast function as well for firing effects that you may want to play on all clients.
That is what I do but the actual firing logic is not really relevant for this problem I guess
Thank you very much for the help Omar007! Finally with your help, client now deals damage to server. Although i do now have weapon position issue in First Person i’ll make another thread on Answerhub for that.