• 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.X] - CreatureEvent - Deathlist?

Extrodus

|| Blazera.net ||
Joined
Dec 22, 2008
Messages
2,691
Solutions
7
Reaction score
549
Location
Canada
So currently when I kill the boss only one person will get the storage. I am trying to make it so everyone that has participated in the fight will get the storage but I am having trouble figuring out which function to use. I assume we would change it from an onKill to onDeath and add a creatureevent to the monster file. But I am just assuming.

Idea from: https://otland.net/threads/add-storage-after-monsters-dead.168892/#post-1633305

Script:
Code:
local storage = 3100 -- storageID to use.
local maxPoints = 1 -- maximum amount of saved points a player can have
local givePoints = 1 -- amount of points to give player
local creatureName = '[b] willow' -- creaturename (must be lowercase letters)

function onKill(player, target, damage, flags)

    if target:isPlayer() then
        return true
    end

    local name = target:getName():lower()
    if name ~= creatureName then
        return true
    end

    if player:getStorageValue(storage) < 0 then
        player:setStorageValue(storage, 0)
    end

    if player:getStorageValue(storage) < maxPoints then
        player:setStorageValue(storage, player:getStorageValue(storage) + givePoints)
    end

    player:sendTextMessage(MESSAGE_INFO_DESCR, 'You have defeated ' .. name .. '.')

    return true
end

Any help is greatly appreciated!
 
Back
Top