• 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] Task Party.

Zodia

Member
Joined
Feb 21, 2020
Messages
220
Reaction score
20
My task system seems to be set so that only the last player who attacked the monster, counts. I'm trying to get you to tell Party members to attack the monster.

Creaturescript:
Lua:
function onKill(player, target)
    local monster = config[target:getName():lower()]
    if not monster or target:getMaster() then
        return true
    local party = player:getParty()

    if party...
    for ...  party:getMembers()
    end

    local storageValue = player:getStorageValue(monster.storage)
    if storageValue >= monster.start then
        if storageValue >= monster.count then
            player:sendTextMessage(MESSAGE_STATUS_CONSOLE_BLUE, "You have already killed " .. monster.count .. " " .. monster.plural .. ". Report back to Tusker in Thais.")
        else
            player:sendTextMessage(MESSAGE_STATUS_CONSOLE_BLUE, "You have killed [" .. storageValue .. "/" .. monster.count .. "] " .. monster.plural .. ".")
        end
            player:setStorageValue(monster.storage, storageValue + 1)
    end
    return true
end


I tried a few things using these tips:


Code:
local party = player:getParty()

if party...
    for ...  party:getMembers()



Could anyone help me with this? How would my Creaturescript code look, so that the desired result was achieved?
Of course. That count only if the Party is active, and that count only for the Party players that attack the monster.

Thanks! <3
 
There is a problem sometimes it counts or not when everyone is attacking the same creature, even if they hit. if at least take the top one and make it with a ranger 10 sqm, at least no one will be left in the dp, and will tell whoever has it on the hunt!
 
In the code above you can give party to people in temple and they will get task kills.

I never messed up with party functions but I'll try. I didnt test it tho:
Lua:
local function addKill(playerCid, monster)
    local player = Player(playerCid)
    if player then
        local storageValue = player:getStorageValue(monster.storage)
        if storageValue >= monster.start then
                if storageValue >= monster.count then
                        player:sendTextMessage(MESSAGE_STATUS_CONSOLE_BLUE, "You have already killed " .. monster.count .. " " .. monster.plural .. ". Report back to Tusker in Thais.")
                else
                        player:sendTextMessage(MESSAGE_STATUS_CONSOLE_BLUE, "You have killed [" .. storageValue .. "/" .. monster.count .. "] " .. monster.plural .. ".")
                end
                player:setStorageValue(monster.storage, storageValue + 1)
        end    
    end
    return true
end


function onKill(player, target)
    local monster = config[target:getName():lower()]
    if not monster or target:getMaster() then
        return true
    local party = player:getParty()
        if not party then
            addKill(player:getId(), monster)
        else
            local membersList = party:getMembers()
            membersList[#membersList + 1] = party:getLeader()
            if membersList == nil or type(membersList) ~= 'table' or #membersList <= 1 then
                addKill(player:getId(), monster)
                return false
            end    

            local affectedList = {}
            for _, targetPlayer in ipairs(membersList) do
                if targetPlayer:getPosition():getDistance(position) <= 36 then
                    affectedList[#affectedList + 1] = targetPlayer
                end
            end    
         
            local tmp = #affectedList
            if tmp <= 1 then
                addKill(player:getId(), monster)
                return false
            end        
         
            for _, targetPlayer in ipairs(affectedList) do
                addKill(targetPlayer:getId(), monster)                
            end        
        end
    return true
end

Doesn't work, no errors in console though?
 
Back
Top