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

CreatureEvent Mount level TFS 1.X

Salvus

Well-Known Member
Joined
Feb 7, 2019
Messages
102
Solutions
1
Reaction score
69
When you advance on specifik level you will get a mount.

Code:
    <event type="advance" name="MountLevel" script="mount_level.lua"/>

Code:
function onAdvance(player, skill, oldLevel, newLevel)
    local config = {
        -- [level] {mountId and mountName}
        [100] = {mountId = 1, mountName = "Widow Queen"},
        [2000] = {mountId = 2, mountName = "Racing Bird"},
    }
    
    if skill ~= SKILL_LEVEL or newLevel <= oldLevel then
        return true
    end

    local storage = 2100
    for level, i in pairs(config) do
        if newLevel >= level and player:getStorageValue(storage) < level then
            player:addMount(i.mountId)
            player:sendTextMessage(MESSAGE_EVENT_ADVANCE, "Congratulations, you reached level "..newLevel.." and won the "..i.mountName.." mount.")
            player:setStorageValue(storage, level)
        end
    end
    return true
end
 
Back
Top