[0.15] Dead character inventory
Posted: Mon May 01, 2017 12:52 pm
hello, anyone has ideas or knowledge about inventory access for dead characters?
seems following construct no longer works
valid and valid_for_read always return false
mind this code was working in 0.14
seems following construct no longer works
Code: Select all
function on_player_died(event)
local player = game.players[event.player_index]
if player ~= nil then
for i = 1, #storeinventories, 1 do
local inventoryid = storeinventories[i]
local playerinventory = player.get_inventory(inventoryid)
for j = 1, #playerinventory, 1 do
if playerinventory[j].valid and playerinventory[j].valid_for_read then
local item = playerinventory[j]
--[[ do something here ]]--
end
end
end
end
end
mind this code was working in 0.14