I want to know how I can make a charakter overlap event, which is casted to an other online player.
For example…the player who has more health destroyed the player who has lower health.
Thank you all for help:)
I want to know how I can make a charakter overlap event, which is casted to an other online player.
For example…the player who has more health destroyed the player who has lower health.
Thank you all for help:)
OK. Overlap event happens to both players that overlap each other, AND these both happen on BOTH computers in a networked game, so you want to test for IsAuthority or IsServer first thing in your Overlap event handler.
Now we can’t say which player character is which very easily, but we don’t have to.
The event is firing on both, so when we measure the health of one against the other, if the one the event fired on is LESS, then we just quit the function without doing anything (leave False pin on Branch unconnected, for example).
If it is MORE than the other player’s health, then you continue and destroy that other player. See now it works and you don’t have to know who is whom, and it’s okay that the event fires on both machines for both players (that’s 4 events!) because only 2 events will go past the Server/Authority check, and only 1 of THOSE will pass the Health check.
You might be able to store the health on something other than a replicated variable on a PlayerState, but in network games you will have a lot better progress in developing if you put those kinds of things like Health on PlayerState than on Pawn or Controller, and replicate them. This still might work if it’s on Pawn or Controller, but I’m not sure.
Can you make a screenshot please?So it’s easier to understand.
I can’t really do a screenshot because I’m at work, away from my unreal computer at home.
Maybe I can explain more simply though by going step by step:
Done.