Reaper_Man, on 14 December 2021 - 06:14 PM, said:
EVENT_DAMAGESPRITE maybe?
I'll bet you are right. That event should be triggered every time there is damage, even if it happens to the same sprite multiple times in one tic.
gamevar htowner2 -1 1
gamevar damagetime 0 1
gamevar playerID 0 1
onevent EVENT_DAMAGESPRITE
ife sprite[RETURN].picnum APLAYER
{
geta[RETURN].yvel playerID
ife playervar[playerID].damagetime player[playerID].player_par setplayervar[playerID].htowner2 sprite[THISACTOR].owner
else setplayervar[playerID].htowner2 -1
setplayervar[playerID].damagetime player[playerID].player_par
}
endevent
I don't normally work with different player IDs since I have only been scripting singleplayer stuff for a long time, but if that code above is correct what it will do is put a second sprite ID into the htowner2 var for the specific player who got damaged by two sprites in the same tic. I think the likelihood of there being a third sprite doing damage in the same tic is pretty low, so having two IDs should be sufficient. Even assuming that works, it won't save how much damage was done by each, so more work would be needed for that feature. However, if one sprite was the same player who got hit and the other sprite is a different player, it would then be easy to always set the htowner to one or the other in that situation, giving credit where it is desired.
EDIT: Also, htowner2 should be cleared back to -1 by the damage handling code that gives credit; otherwise, it stays set until the player is damaged again.