Read Variable of other Player Character when hit/overlap

Hi, im having a problem which i cant solve. I found several ideas but could not figure out how to solve it.
i followed this tutorial for setting up a multiplayer game which works: Blueprint Multiplayer: Project Overview | 01 | v4.11 Tutorial Series | Unreal Engine - YouTube

now i added a variable “gold” to the base character (int). Now i want, that when two players get very close to each other, both values of “Gold” will be added and devided by 2. Then set the “Gold” for eacht with this calculated value
Lets say
Player 1 has Gold: 100
Player 2 has Gold: 200

when they are very close to each other
p1 has (100+200)/2 = 150
p2 has (100+200)/2 = 150

my problem is, that i am not able to read the value from the other character to figure out, how much the other player has.

thanks very much in advance for helping
K

Those variables then need to be set to replicate, see more here Networking Overview for Unreal Engine | Unreal Engine 5.3 Documentation

Example

OnOverlapEvent cast from the actor output node of the event node, to the character blueprint (i guess both use the same?), then branch and make an equal bool check if the overlapped actor is indeed the player character blueprint. If true add the calculations for the replicated variables.

Hi, thanks very much for your fast reply

This is what i have so far. But it somehow does not work

  1. It executes the “on overlap” to many times
  2. i think, i did not correctly referenced to the “other” actor correctly. The “Gold” variable has both times the same value

do you have an idea what i did wrong?
i tried to set a bool to check, if overlap has benn executet within the last 5 seconds, but for some reason, this does not work. i guess, it is executet twice anyway for both players at the same time.
thanks very much in advance for helping
K

If it executes too often, try adding a DoOnce node after successful overlapped actor. If you want to use this overlap event again, you need to add a custom event and plug it into the DoOnce node reset input, after some time past, or try a reset input from OnComponentEndOverlap.

Thanks for your reply, i will try this. Do i correctly reference to the Variables and add them? im am not sure, if i do that correctly
thanks very much

p.s. it works only when i play as the server. when a player overlaps, it does not read the variable from other client or the server