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

RevScripts Kill boss reward outfit

jel

Member
Joined
Mar 22, 2014
Messages
302
Reaction score
12
good evening, can anyone use this script to get an outfit when killing a boss

distro canary

Lua:
local config = {
    [{"centipede", "bug"}]                    = {mountReward = 1111, killGoal = 200,  storage = 45001, monsterType = "bugs"}, -- check mounts.xml for the mountIds
    [{"ancient scarab", "giant spider"}]    = {mountReward = 1111, killGoal = 500,  storage = 45002, monsterType = "crawly things"},
    [{"kollos", "spidris"}]                    = {mountReward = 1111, killGoal = 1500, storage = 45003, monsterType = "bosses"}
}

local killEvent = CreatureEvent("newOnKillEvent")
killEvent:type("kill")

function killEvent.onKill(creature, target)
    if not creature:isPlayer() then
        return true
    end
    if not target:isMonster() then
        return true
    end
    local monsterName = target:getName():lower()
    for v, k in pairs(config) do
        if table.contains(v, monsterName) then
            local currentStorage = creature:getStorageValue(k.storage)
            if currentStorage >= k.killGoal then
                return true
            end
            currentStorage = currentStorage < 1 and 1 or currentStorage + 1
            creature:setStorageValue(k.storage, currentStorage)
            if currentStorage == k.killGoal then
                player:addMount(k.mountReward)
            end
            creature:sendTextMessage(MESSAGE_STATUS_CONSOLE_BLUE, "You have killed " .. currentStorage .. "/" .. k.killGoal .. " " .. k.monsterType .. ".")
            return true
        end
    end
    return true
end

killEvent:register()


local loginEvent = CreatureEvent("registerOnKill")
loginEvent:type("login")

function loginEvent.onLogin(player)
    player:registerEvent("newOnKillEvent")
    return true
end

loginEvent:register()
 
Let's do it like:
Lua:
local config = {
    [{"centipede", "bug"}] = {
        outfitReward = {
            [PLAYERSEX_FEMALE] = {
                { lookType = 336, addons = 1 },
            },
            [PLAYERSEX_MALE] = {
                { lookType = 335, addons = 1 },
            }
        },
        mountReward = 1111,
        killGoal = 200,
        storage = 45001,
        monsterType = "bugs"
    }
}

Reward:
Lua:
if currentStorage == k.killGoal then
    if k.mountReward then
        player:addMount(k.mountReward)
    end
    if k.outfitReward then
        local sex = player:getSex()
        local outfits = k.outfitReward[sex] or {}
        for _, outfit in pairs(outfits) do
            player:addOutfitAddon(outfit.lookType, outfit.addons or 0)
        end
    end
end
 
Let's do it like:
Lua:
local config = {
    [{"centipede", "bug"}] = {
        outfitReward = {
            [PLAYERSEX_FEMALE] = {
                { lookType = 336, addons = 1 },
            },
            [PLAYERSEX_MALE] = {
                { lookType = 335, addons = 1 },
            }
        },
        mountReward = 1111,
        killGoal = 200,
        storage = 45001,
        monsterType = "bugs"
    }
}

Reward:
Lua:
if currentStorage == k.killGoal then
    if k.mountReward then
        player:addMount(k.mountReward)
    end
    if k.outfitReward then
        local sex = player:getSex()
        local outfits = k.outfitReward[sex] or {}
        for _, outfit in pairs(outfits) do
            player:addOutfitAddon(outfit.lookType, outfit.addons or 0)
        end
    end
end
Lua:
local cEvent = CreatureEvent("killPaleWormOutfit")

function cEvent.onDeath(creature, corpse, killer, mostDamageKiller, lastHitUnjustified, mostDamageUnjustified)
    for cid, _ in pairs(creature:getDamageMap()) do
        local creature = Player(cid)
        if creature and creature:isPlayer() then
            if not creature:hasOutfit(1270, 3) or self:hasOutfit(1271, 3) == true then
                if creature:getSex() == 0 then
                creature:addOutfitAddon(1270, 3)
            else
                creature:addOutfitAddon(1271, 3)
            end
        end
                creature:sendTextMessage(MESSAGE_EVENT_ADVANCE, "You have received Poltergeist outfit.")
            end
    end
    return true
end

cEvent:register()
no work, no erros
 
Last edited:
Lua:
local cEvent = CreatureEvent("killPaleWormOutfit")

local outfits = {
    [PLAYERSEX_FEMALE] = { lookType = 1270, addons = 3 },
    [PLAYERSEX_MALE] = { lookType = 1271, addons = 3 }
}

function cEvent.onDeath(creature, corpse, killer, mostDamageKiller, lastHitUnjustified, mostDamageUnjustified)
    for cid, _ in pairs(creature:getDamageMap()) do
        local player = Player(cid)
        local sex = player and player:getSex() or nil
        local outfit = outfits[sex]
        if player and not player:hasOutfit(outfit.lookType, outfit.addons) then
            player:addOutfitAddon(outfit.lookType, outfit.addons)
            player:sendTextMessage(MESSAGE_EVENT_ADVANCE, "You have received Poltergeist outfit.")
        end
    end

    return true
end

cEvent:register()
 
Last edited:
How is it for tfs 1.5? I would like to kill a Boss and receive a mount between id 1 and 5, can someone help me? How is it for tfs 1.5? I would like to kill a Boss and receive a mount between id 1 and 5, can someone help me? 😁😁
 
Back
Top