T
Tibia Demon
Guest
can someone help me convert this to check dps for monsters instead of players
i want to test monsters by (/summon) and attack dummy to get the dps
i want to test monsters by (/summon) and attack dummy to get the dps
Lua - Xikini's Free Scripting Service TFS 1.3
Please request actions / creatureevents / globalevents / npcs / movements / talkactions Do not request spells / weapons / monsters / source editing / database queries My goal of this thread is to learn TFS 1.3 scripting. ------------------------------------ Support If you have an issue with...
otland.net
Lua:
local creatureevent = CreatureEvent("onHealthChange_Training_Dummy")
local dps_check_time = 5 -- how long in seconds until DPS is shown to player
local DPS_info = {}
local function send_dps_info(playerID, monsterID)
local player = Player(playerID)
if player then
player:say("Your DPS is " .. (math.floor((DPS_info[monsterID][playerID] / dps_check_time) + 0.5)) .. ".", TALKTYPE_MONSTER_SAY, false, player)
end
DPS_info[monsterID][playerID] = nil
end
function creatureevent.onHealthChange(monster, creature, primaryDamage, primaryType, secondaryDamage, secondaryType, origin)
if not Player(creature) then
return false
end
local monsterID = monster:getId()
local playerID = creature:getId()
if not DPS_info[monsterID] then
DPS_info[monsterID] = {}
end
if not DPS_info[monsterID][playerID] then
addEvent(send_dps_info, dps_check_time * 1000, playerID, monsterID)
end
DPS_info[monsterID][playerID] = (DPS_info[monsterID][playerID] or 0) + primaryDamage + secondaryDamage
monster:getPosition():sendMagicEffect(CONST_ME_GIFT_WRAPS, creature)
return false
end
creatureevent:register()