Page 1 of 1
Player Death Event Improvements
Posted: Thu Jan 05, 2017 8:42 pm
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?
Re: Player Death Event Improvements
Posted: Thu Jan 05, 2017 9:27 pm
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.
Re: Player Death Event Improvements
Posted: Thu Jan 05, 2017 10:48 pm
by Nexela
Also a kill counter production screen was teased out for .15
Re: Player Death Event Improvements
Posted: Thu Jan 05, 2017 10:54 pm
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
Re: Player Death Event Improvements
Posted: Thu Jan 05, 2017 11:41 pm
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.
Re: Player Death Event Improvements
Posted: Fri Jan 06, 2017 1:01 am
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.
Re: Player Death Event Improvements
Posted: Fri Jan 06, 2017 4:24 am
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?
Re: Player Death Event Improvements
Posted: Fri Jan 06, 2017 4:52 am
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).
Re: Player Death Event Improvements
Posted: Fri Jan 06, 2017 5:45 am
by zackman0010
Thank you! I'm looking forward to 0.15 more and more