Disable death messages and respawn messages
Disable death messages and respawn messages
Just as the title says. Any way to disable death and respawn messages completely?
I have mods! I guess!
Link
Link
-
- Inserter
- Posts: 48
- Joined: Sun Jan 03, 2016 10:28 am
- Contact:
Re: Disable death messages and respawn messages
Came up because I needed to create a player corpse for a living player with all their items.
The solution I came up with was the following:
but that obviously creates the messages in chat. I also tried dissasociating the character from the player and then killing it etc, but no.
I also tried the following to create a corpse manually, but I couldn't figure out a way to do it.
The solution I came up with was the following:
Code: Select all
local surface = player.surface.name
local position = player.position
local character = player.character
player.disassociate_character(character)
character.die()
player.ticks_to_respawn = nil
player.teleport(position, surface)
I also tried the following to create a corpse manually, but I couldn't figure out a way to do it.
Code: Select all
-- Manually create corpse
local corpse = surface.create_entity {
name = "character-corpse",
position = position,
force = player.force,
create_build_effect_smoke = false,
inventory_size = 999,
player_index = player.index,
}
for _, inv in pairs(inventories) do
local inventory = player.get_inventory(inv)
for i = 1, #inventory do
local slot = inventory[i]
if slot.valid_for_read then
corpse.insert(slot)
end
end
end