Player Death Event Improvements

Things that already exist in the current mod API
Post Reply
zackman0010
Inserter
Inserter
Posts: 36
Joined: Wed May 18, 2016 8:34 pm
Contact:

Player Death Event Improvements

Post by zackman0010 »

Allow access to the entity that killed a player in the API. The game sends out announcements "PLAYER was killed by ENTITY", where ENTITY can be another player, a turret, or a biter. I was hoping to improve my PvP code by keeping a K/D ratio for each player, along with other details. However, although the information is printed in-game, there's no way to get it from the API.
Also slightly related, but can the player death messages be printed to all forces, or limit the respawn messages to only that player's force? The respawn messages show up to all forces, but the death messages only show up to the force of the player who died. It just doesn't make much sense to have those two with different behavior.
Lastly, can the player death message also have the force attribute added, like the entity death event has? This isn't as high a priority as we've been using the entity death event and checking if the entity was a player, but it'd just be nice to have a simpler way.

EDIT: This may be better in the Mod Interface Requests forum that I only just now realized existed. Could it be moved there please?

daniel34
Global Moderator
Global Moderator
Posts: 2761
Joined: Thu Dec 25, 2014 7:30 am
Contact:

Re: Player Death Event Improvements

Post by daniel34 »

Moved to Modding interface requests.

Part of your request might already be implemented for 0.15:
on_entity_died - killer [Implemented mod requests]
Rseding91 wrote:Added for 0.15. It's an optional field as it's not always available.
I'm not sure if this also applies to on_player_died.
quick links: log file | graphical issues | wiki

Nexela
Smart Inserter
Smart Inserter
Posts: 1828
Joined: Wed May 25, 2016 11:09 am
Contact:

Re: Player Death Event Improvements

Post by Nexela »

Also a kill counter production screen was teased out for .15

daniel34
Global Moderator
Global Moderator
Posts: 2761
Joined: Thu Dec 25, 2014 7:30 am
Contact:

Re: Player Death Event Improvements

Post by daniel34 »

Nexela wrote:Also a kill counter production screen was teased out for .15
I think that only counts per prototype, and part of the information is already available here:
http://lua-api.factorio.com/latest/LuaF ... statistics
quick links: log file | graphical issues | wiki

zackman0010
Inserter
Inserter
Posts: 36
Joined: Wed May 18, 2016 8:34 pm
Contact:

Re: Player Death Event Improvements

Post by zackman0010 »

That's what I believed too. What I'm going to be coding is a player by player K/D ratio, which will also include interfacing with some outside programs to store the data through different save games. I couldn't even begin without the killer field, though.
Also, AFAIK, the on_entity_death objects are not the same as the on_player_death objects. They're listed separately in the API, and the player doesn't have the force (like entity currently does). I guess if they add it to entity, I can use the same workaround as we're currently using by just checking is the entity is a player.

Rseding91
Factorio Staff
Factorio Staff
Posts: 13209
Joined: Wed Jun 11, 2014 5:23 am
Contact:

Re: Player Death Event Improvements

Post by Rseding91 »

zackman0010 wrote:That's what I believed too. What I'm going to be coding is a player by player K/D ratio, which will also include interfacing with some outside programs to store the data through different save games. I couldn't even begin without the killer field, though.
Also, AFAIK, the on_entity_death objects are not the same as the on_player_death objects. They're listed separately in the API, and the player doesn't have the force (like entity currently does). I guess if they add it to entity, I can use the same workaround as we're currently using by just checking is the entity is a player.
The "cause" field is on both the player died and the entity died event for 0.15.
If you want to get ahold of me I'm almost always on Discord.

zackman0010
Inserter
Inserter
Posts: 36
Joined: Wed May 18, 2016 8:34 pm
Contact:

Re: Player Death Event Improvements

Post by zackman0010 »

Rseding91 wrote:
zackman0010 wrote:That's what I believed too. What I'm going to be coding is a player by player K/D ratio, which will also include interfacing with some outside programs to store the data through different save games. I couldn't even begin without the killer field, though.
Also, AFAIK, the on_entity_death objects are not the same as the on_player_death objects. They're listed separately in the API, and the player doesn't have the force (like entity currently does). I guess if they add it to entity, I can use the same workaround as we're currently using by just checking is the entity is a player.
The "cause" field is on both the player died and the entity died event for 0.15.
Yay! Thank you. Do you have any comment on the second thing I asked? About player death messages not appearing to all forces/respawn messages appearing to all forces?

Rseding91
Factorio Staff
Factorio Staff
Posts: 13209
Joined: Wed Jun 11, 2014 5:23 am
Contact:

Re: Player Death Event Improvements

Post by Rseding91 »

Death messages are sent to the player force that died and the force that killed him and respawn messages are only sent to the player force that respawned (for 0.15).
If you want to get ahold of me I'm almost always on Discord.

zackman0010
Inserter
Inserter
Posts: 36
Joined: Wed May 18, 2016 8:34 pm
Contact:

Re: Player Death Event Improvements

Post by zackman0010 »

Thank you! I'm looking forward to 0.15 more and more

Post Reply

Return to “Already exists”