Hi all,
I have been playing around with trying and implementing a items/weapon system with multiplayer. Now i have come to realise that my idea maybe is not possible, i have been banging my head against the wall for a day now, i think i have tried everything i can come up with. Please i hope someone can shed some light for me on this one.
I have a “player character” that for now, on begin play just tells the server to spawn and attach a weapon to my “player character”:
In the same player character i have a event on mouse klick that fires a interface message, which is implemented on the weapon that is spawned and attached to my character, well the event actually finds any actor attached to my pawn that has that interface:
The weapon then recevies this interface message, and fires a event, that does 2 traces, from player camera, and then from weapon to where player camera hits, nothing special. If it hits a actor that implements another interface “On Hit”, it just calls that interface message:
On Hit event in turn, on the enemy actor this time, just tells the authority to change the health value, wich is onrep notify, and that onrep function just changes some text above the actor.
Here is the catch, this works, if and only if I call the On Hit interface message from my pawn directly, and if i go the way above, it only works for server, and not the client. For me it seems like some kind of ownership problem, but to be honest, i dont know anymore. Is this even a possible design?
for you wondering why this design, i wanted to separate everything. player pawn does not have any idea what its holding, it can be a gun, healkit, building tool, whatever. It just “uses it”. The actor itself that is a weapon in this case, could be anything, and the logic inside it decides what it does. And in the end, the enemy, it self decides what happens, when it gets hit. Good? bad?
Thank you.