Is it possible to return the entity and force that "caused" the death when a player dies (or pre-dies)? I would love to be able to perform something based on the identify of the killer (and some other crazy things) when someone dies. I have a couple of ideas revolving around player death, and they would work best if I could actually tell WHY someone died.
Something like returning "poison-capsule" belonging to "(lua table for player force)" if you poison yourself to death, or "big-worm" belonging to "(lua table for biter force)" if you dont run away quick enough from the big worms. or "droid-smg" belonging to "(lua table for player force)" if you accidentally piss off your Robot Army assistants.....
on_pre_player_died/on_player_died cause
Re: on_pre_player_died/on_player_died cause
The killing entity isn't always known when something dies. There also isn't always a killing entity around anymore when something dies.
So.. maybe but not likely.
So.. maybe but not likely.
If you want to get ahold of me I'm almost always on Discord.
Re: on_pre_player_died/on_player_died cause
You can hack around it by tracking the last hit in the on_entity_damaged event. (Which is itself a hack... fun times!)
Re: on_pre_player_died/on_player_died cause
There is no on entity damaged event.DaveMcW wrote:You can hack around it by tracking the last hit in the on_entity_damaged event. (Which is itself a hack... fun times!)
If you want to get ahold of me I'm almost always on Discord.
Re: on_pre_player_died/on_player_died cause
Methinks he means on_entity_died... if there was an "on_entity_damaged" it could lead to the BEST lag generation...
You have a point. Ive been killed by now-dead Worms before. And technically, killing yourself with fire WOULD be a now-dead entity killing you...
Maybe if instead of passing the actual Entity table, it passed a table that was {attack_source = "medium-spitter", attack_force = "biters" } of the entity that used the attack? Maybe the entity table could be an optional additional value IF the entity is still alive, or nil if dead.
You have a point. Ive been killed by now-dead Worms before. And technically, killing yourself with fire WOULD be a now-dead entity killing you...
Maybe if instead of passing the actual Entity table, it passed a table that was {attack_source = "medium-spitter", attack_force = "biters" } of the entity that used the attack? Maybe the entity table could be an optional additional value IF the entity is still alive, or nil if dead.