Find out if player is dead?

Place to get help with not working mods / modding interface.
321freddy
Fast Inserter
Fast Inserter
Posts: 125
Joined: Fri Sep 23, 2016 10:16 pm
Contact:

Find out if player is dead?

Post by 321freddy »

How can I find out if a player is dead? I tried player.character == nil but this fails when the player is not connected or in god controller mode.
daniel34
Global Moderator
Global Moderator
Posts: 2761
Joined: Thu Dec 25, 2014 7:30 am
Contact:

Re: Find out if player is dead?

Post by daniel34 »

I have not tested this but looking at the API you should be able to check player.controller_type and if it's defines.controllers.ghost then the player is dead ("Can't interact with the world, can only observe. Used in the multiplayer waiting-to-respawn screen").
quick links: log file | graphical issues | wiki
321freddy
Fast Inserter
Fast Inserter
Posts: 125
Joined: Fri Sep 23, 2016 10:16 pm
Contact:

Re: Find out if player is dead?

Post by 321freddy »

It worked! Thanks for the quick reply! :)
Post Reply

Return to “Modding help”