• There is NO official Otland's Discord server and NO official Otland's server list. The Otland's Staff does not manage any Discord server or server list. Moderators or administrator of any Discord server or server lists have NO connection to the Otland's Staff. Do not get scammed!

Lua tfs 1.2 and Znote AAC death by summons

Manigold

Active Member
Joined
Nov 2, 2017
Messages
198
Solutions
8
Reaction score
48
Hi, I'm using Znote AAC and this tfs celohere/forgottenserver (https://github.com/celohere/forgottenserver) and when someone is killed by another player summon, it appears in the deathlist like this: Killed at Level 20 by PlayerX.
I would like it to look like this: killed at level 20 by fire elemental summoned by PlayerX ..
I don't know if it's something to change only on the website or in the sources, hope someone can help me with that.
 
Solution
You need to update your playerdeath.lua script to include both the monster and the player as separate rows into the player_deaths SQL table. (see the db.query statement).

This logic overrides the monster and retrieves the player (master of summon) instead of the monster:
Lua:
local byPlayerMostDamage = 0
local mostDamageKillerName
if mostDamageKiller ~= nil then
	if mostDamageKiller:isPlayer() then
		byPlayerMostDamage = 1
	else -- mostDamageKiller is a monster
		local master = mostDamageKiller:getMaster() -- get master of monster (player)
		if master and master ~= mostDamageKiller and master:isPlayer() then
			mostDamageKiller = master -- changes mostdamagekiller to master (player)
			byPlayerMostDamage = 1
		end
	end...
You need to update your playerdeath.lua script to include both the monster and the player as separate rows into the player_deaths SQL table. (see the db.query statement).

This logic overrides the monster and retrieves the player (master of summon) instead of the monster:
Lua:
local byPlayerMostDamage = 0
local mostDamageKillerName
if mostDamageKiller ~= nil then
	if mostDamageKiller:isPlayer() then
		byPlayerMostDamage = 1
	else -- mostDamageKiller is a monster
		local master = mostDamageKiller:getMaster() -- get master of monster (player)
		if master and master ~= mostDamageKiller and master:isPlayer() then
			mostDamageKiller = master -- changes mostdamagekiller to master (player)
			byPlayerMostDamage = 1
		end
	end
	mostDamageName = mostDamageKiller:getName()
else
	mostDamageName = "field item"
end
This needs to be modified to include both the player and the monster.

You can probably extend the name of the monster to also include the master name if it is a summon, something along the likes of this:
Lua:
mostDamageName = mostDamageKiller:getName() .." (summoned by "..mostDamageKiller:getMaster():getName()..")"
 
Last edited:
Solution
Back
Top