adrenyslopez
Member
- Joined
- Dec 22, 2015
- Messages
- 201
- Reaction score
- 15
I already understand thank you very much for helping meIt was a feature in TFS 0.3 where it saved all killers.
In TFS 1.3 it saves only two, mostdamage player and lasthit player.
So it can't be changed so easily without changing the engine.
Correct me anyone if I'm wrong.
player:getDamageMap()
How can I add that function?Actually, using the functionyou can get all the players involved in the fight, with a table with total damage, ticks since last damage and (obviously) the damage dealer.LUA:player:getDamageMap()
So with tfs 1.3 it is possible to show all the monsters/players involved.
db.query('INSERT INTO `player_deaths` (`player_id`, `time`, `level`, `killed_by`, `is_player`, `mostdamage_by`, `mostdamage_is_player`, `unjustified`, `mostdamage_unjustified`) VALUES (' .. playerGuid .. ', ' .. os.time() .. ', ' .. player:getLevel() .. ', ' .. db.escapeString(killerName) .. ', ' .. byPlayer .. ', ' .. db.escapeString(mostDamageName) .. ', ' .. byPlayerMostDamage .. ', ' .. (unjustified and 1 or 0) .. ', ' .. (mostDamageUnjustified and 1 or 0) .. ')')
What do I have to modify in this line so that it appears like this?In scripts\creaturescripts\others\player_death.lua
This code handles the death string player as you can see (db.escapeString(mostDamageName)), and the player:getDamageMap() is a function integrated alreadyLUA:db.query('INSERT INTO `player_deaths` (`player_id`, `time`, `level`, `killed_by`, `is_player`, `mostdamage_by`, `mostdamage_is_player`, `unjustified`, `mostdamage_unjustified`) VALUES (' .. playerGuid .. ', ' .. os.time() .. ', ' .. player:getLevel() .. ', ' .. db.escapeString(killerName) .. ', ' .. byPlayer .. ', ' .. db.escapeString(mostDamageName) .. ', ' .. byPlayerMostDamage .. ', ' .. (unjustified and 1 or 0) .. ', ' .. (mostDamageUnjustified and 1 or 0) .. ')')
local dmap = player:getDamageMap()
local tArray = {}
for pid, _ in pairs(dmap) do
local aPlayer = Creature(pid)
if (aPlayer) then
if aPlayer:isPlayer() then
table.insert(tArray, {aPlayer:getGuid()})
end
end
end