For each time event x executed, set variable z = y/2

Hi, I am trying to implement a way in which player experience will be set from some kind of activity
Like, for each kill, get killed character level variable/2 → add to that to playerExp variable —> set playerExp variable be the result
Can you please help how to implement that? Thanks!