• 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!

TFS 1.X+ if 2 players kill a monster task, only 1 get a count task

roriscrave

Advanced OT User
Joined
Dec 7, 2011
Messages
1,210
Solutions
35
Reaction score
206
Hi, this scripts task, if 2 player kill a rat.
The count will add only in one player. How can i add a task count for all players that attacked a monter?
tfs 1.3 8.6

LUA:
function onKill(player, target)
    if target:isPlayer() or target:getMaster() then
        return true
    end

    local mon_name = target:getName():lower()

    local ret_t = getTaskInfos(player)
    if ret_t then
        if mon_name == ret_t.name:lower() then
        local sto_value = player:getStorageValue(ret_t.storage)
            if sto_value < ret_t.amount then
                sto_value = sto_value + 1
                player:setStorageValue(ret_t.storage, sto_value)
                if sto_value < ret_t.amount then
                    player:sendTextMessage(MESSAGE_STATUS_CONSOLE_ORANGE, '[Task System] Killed ['..(sto_value)..'/'..ret_t.amount..'] '..mon_name..'.')
                else
                    player:sendTextMessage(MESSAGE_STATUS_CONSOLE_ORANGE, '[Task System] Killed You finished your task.')
                end
            end
        end
    end
 
There's a lua function called creature:getDamageMap, you might want to look into that. I haven't fiddled with it at all so cannot confirm if it's gonna be an optimal solution for you but you maybe would like to test it out at least and maybe modify damagemap to your preferences.
 
There's a lua function called creature:getDamageMap, you might want to look into that. I haven't fiddled with it at all so cannot confirm if it's gonna be an optimal solution for you but you maybe would like to test it out at least and maybe modify damagemap to your preferences.
I already tried to use it, but this function seems buggy, it doesn't always select everyone who attacked
 
Have you looked into how it works? It stores attacker for the duration that you have set as your battle duration, try changing the duration to whatever time you want.
If you already have then I'm sorry, I can't help you any further :(
 
Have you looked into how it works? It stores attacker for the duration that you have set as your battle duration, try changing the duration to whatever time you want.
If you already have then I'm sorry, I can't help you any further :(
how can i put a time of battle duration?
 
im using TFS 1.2 and it's pzLocked = X in config, but you might want to just change how damageMap specifically stores time in source code instead of it basing it off of this value, or you could write your own function and store all attackers in a separate map variable.
 
Back
Top