• TibiaFace

    Tibiaface | Una comunidad Open Tibia donde encontras : mapas, scripts, Otserver, npc y amigos etc ...

    .
    demo menumenu

    Afiliados



    Votar:

    [CreatureEvents] (UP-LEVEL) Recompensa al subir de level

    Compartir:

    Ver el tema anterior Ver el tema siguiente Ir abajo  Mensaje (Página 1 de 1.)

    [Admin] God Maya

    [Admin] God Maya
    Administrador
    Administrador
    Hola Usuarios de TibiaFace

    Hoy le traigo un script que al subir un level el player recibe un premio bueno muy sencillo de instalar.

    Nos vamos a :


    data/creaturescripts/scripts


    copiamos cualquier archivo y renombramos por uplevelabsolute.lua y pegamos esto dentro

    Código:
    function onAdvance(cid, skill, oldLevel, newLevel)

    local config = {
    [50] = {item = 2160, count = 5},
    [100] = {item = 2160, count = 15},
    [150] = {item = 2160, count = 20},
    [200] = {item = 2160, count = 25},
    [250] = {item = 2160, count = 30},
    [300] = {item = 2160, count = 50},
    [350] = {item = 4891, count = 1},
    [400] = {item = 4892, count = 1},
    }

    if skill == 8 then
    for level, info in pairs(config) do
    if newLevel >= level and (getPlayerStorageValue(cid, 30700) == -1 or not (string.find(getPlayerStorageValue(cid, 30700), "'" .. level .. "'"))) then
    doPlayerAddItem(cid, info.item, info.count)
    doPlayerSendTextMessage(cid, MESSAGE_STATUS_WARNING, "Parabéns, você atingiu o level "..newLevel.." e ganhou "..info.count.." "..getItemNameById(info.item)..".")
    local sat = getPlayerStorageValue(cid, 30700) == -1 and "Values: '" .. level .. "'" or getPlayerStorageValue(cid, 30700) .. ",'" .. level .. "'"
    setPlayerStorageValue(cid, 30700, sat)
    end
    end
    end

    return TRUE
    end


    En la misma carpeta

    data/creaturescripts/scripts

    buscamos el srchivo llamado login.lua lo abrimos y añadimos esta linea:

    Código:
    registerCreatureEvent(cid, "UpAbsolute")


    Por ultimo añadimos esta tag en:

    data/creaturescripts/creaturescripts.xml

    Código:
    <event type="advance" name="UpAbsolute" event="script" value="uplevelabsolute.lua"/>

    configuracion:

    local config = {
    [50] = {item = 2160, count = 5},
    [100] = {item = 2160, count = 15},
    [150] = {item = 2160, count = 20},
    [200] = {item = 2160, count = 25},
    [250] = {item = 2160, count = 30},
    [300] = {item = 2160, count = 50},
    [350] = {item = 4891, count = 1},
    [400] = {item = 4892, count = 1},
    }

    [50] <----- es el level donde el player ganara el premio

    item = 2160, <---- item que ganara

    count = 15 <----- cantidad que ganara



    creditos: Absolute



    [CreatureEvents] (UP-LEVEL) Recompensa al subir de level YNU5B25
    https://www.tibiaface.com

    shuyin

    shuyin
    Miembro
    Miembro
    [Tienes que estar registrado y conectado para ver este vínculo] escribió:Hola Usuarios de TibiaFace

    Hoy le traigo un script que al subir un level el player recibe un premio bueno muy sencillo de instalar.

    Nos vamos a :


    data/creaturescripts/scripts


    copiamos cualquier archivo y renombramos por uplevelabsolute.lua y pegamos esto dentro

    Código:
    function onAdvance(cid, skill, oldLevel, newLevel)

    local config = {
    [50] = {item = 2160, count = 5},
    [100] = {item = 2160, count = 15},
    [150] = {item = 2160, count = 20},
    [200] = {item = 2160, count = 25},
    [250] = {item = 2160, count = 30},
    [300] = {item = 2160, count = 50},
    [350] = {item = 4891, count = 1},
    [400] = {item = 4892, count = 1},
    }

    if skill == 8 then
    for level, info in pairs(config) do
    if newLevel >= level and (getPlayerStorageValue(cid, 30700) == -1 or not (string.find(getPlayerStorageValue(cid, 30700), "'" .. level .. "'"))) then
    doPlayerAddItem(cid, info.item, info.count)
    doPlayerSendTextMessage(cid, MESSAGE_STATUS_WARNING, "Parabéns, você atingiu o level "..newLevel.." e ganhou "..info.count.." "..getItemNameById(info.item)..".")
    local sat = getPlayerStorageValue(cid, 30700) == -1 and "Values: '" .. level .. "'" or getPlayerStorageValue(cid, 30700) .. ",'" .. level .. "'"
    setPlayerStorageValue(cid, 30700, sat)
    end
    end
    end

    return TRUE
    end


    En la misma carpeta

    data/creaturescripts/scripts

    buscamos el srchivo llamado login.lua lo abrimos y añadimos esta linea:

    Código:
    registerCreatureEvent(cid, "UpAbsolute")


    Por ultimo añadimos esta tag en:

    data/creaturescripts/creaturescripts.xml

    Código:
    <event type="advance" name="UpAbsolute" event="script" value="uplevelabsolute.lua"/>

    configuracion:

    local config = {
    [50] = {item = 2160, count = 5},
    [100] = {item = 2160, count = 15},
    [150] = {item = 2160, count = 20},
    [200] = {item = 2160, count = 25},
    [250] = {item = 2160, count = 30},
    [300] = {item = 2160, count = 50},
    [350] = {item = 4891, count = 1},
    [400] = {item = 4892, count = 1},
    }

    [50] <----- es el level donde el player ganara el premio

    item = 2160, <---- item que ganara

    count = 15 <----- cantidad que ganara



    creditos: Absolute
    buenas es bueno esto, pero funciona en el global v24 10.90?

    Simon Marin

    Simon Marin
    Miembro
    Miembro
    y un mensaje ... es posible en medio del cliente con letras blancas??

    paulina24

    paulina24
    Miembro
    Miembro
    Código:
    Maya tengo este Login.lua pero nose donde meter el "registerCreatureEvent" ayudita porfavor


    local events = {
    'TutorialCockroach',
    'ElementalSpheresOverlords',
    'BigfootBurdenVersperoth',
    'BigfootBurdenWarzone',
    'BigfootBurdenWeeper',
    'BigfootBurdenWiggler',
    'SvargrondArenaKill',
    'NewFrontierShardOfCorruption',
    'NewFrontierTirecz',
    'ServiceOfYalaharDiseasedTrio',
    'ServiceOfYalaharAzerus',
    'ServiceOfYalaharQuaraLeaders',
    'InquisitionBosses',
    'InquisitionUngreez',
    'KillingInTheNameOfKills',
    'MastersVoiceServants',
    'SecretServiceBlackKnight',
    'ThievesGuildNomad',
    'WotELizardMagistratus',
    'WotELizardNoble',
    'WotEKeeper',
    'WotEBosses',
    'WotEZalamon',
    'PlayerDeath',
    'AdvanceSave',
    'AdvanceRookgaard',
    'PythiusTheRotten',
    'DropLoot'
    }

    local function onMovementRemoveProtection(cid, oldPosition, time)
    local player = Player(cid)
    if not player then
    return true
    end

    local playerPosition = player:getPosition()
    if (playerPosition.x ~= oldPosition.x or playerPosition.y ~= oldPosition.y or playerPosition.z ~= oldPosition.z) or player:getTarget() then
    player:setStorageValue(Storage.combatProtectionStorage, 0)
    return true
    end

    addEvent(onMovementRemoveProtection, 1000, cid, oldPosition, time - 1)
    end

    function onLogin(player)
    local loginStr = 'Welcome to ' .. configManager.getString(configKeys.SERVER_NAME) .. '!'
    if player:getLastLoginSaved() <= 0 then
    loginStr = loginStr .. ' Please choose your outfit.'
    player:sendTutorial(1)
    else
    if loginStr ~= '' then
    player:sendTextMessage(MESSAGE_STATUS_DEFAULT, loginStr)
    end

    loginStr = string.format('Your last visit was on %s.', os.date('%a %b %d %X %Y', player:getLastLoginSaved()))
    end
    player:sendTextMessage(MESSAGE_STATUS_DEFAULT, loginStr)

    local playerId = player.uid

    -- Stamina
    Game.getStorageValue("stamina")[playerId] = 0

    -- Promotion
    local vocation = player:getVocation()
    local promoted = player:isPromoted()
    if player:isPremium() then
    local value = player:getStorageValue(Storage.Promotion)
    if promoted and value ~= 1 then
    player:setStorageValue(Storage.Promotion, 1)
    elseif not promoted and value == 1 then
    player:setVocation(vocation:getPromotion())
    end
    elseif promoted then
    player:setVocation(vocation:getDemotion())
    end

    -- Events
    for i = 1, #events do
    player:registerEvent(events[i])
    end

    if player:getStorageValue(Storage.combatProtectionStorage) <= os.time() then
    player:setStorageValue(Storage.combatProtectionStorage, os.time() + 10)
    onMovementRemoveProtection(playerId, player:getPosition(), 10)
    end
    return true
    end

    [Admin] God Maya

    [Admin] God Maya
    Administrador
    Administrador
    [Tienes que estar registrado y conectado para ver este vínculo] escribió:
    Código:
    Maya tengo este Login.lua pero nose donde meter el "registerCreatureEvent" ayudita porfavor


    local events = {
    'TutorialCockroach',
    'ElementalSpheresOverlords',
    'BigfootBurdenVersperoth',
    'BigfootBurdenWarzone',
    'BigfootBurdenWeeper',
    'BigfootBurdenWiggler',
    'SvargrondArenaKill',
    'NewFrontierShardOfCorruption',
    'NewFrontierTirecz',
    'ServiceOfYalaharDiseasedTrio',
    'ServiceOfYalaharAzerus',
    'ServiceOfYalaharQuaraLeaders',
    'InquisitionBosses',
    'InquisitionUngreez',
    'KillingInTheNameOfKills',
    'MastersVoiceServants',
    'SecretServiceBlackKnight',
    'ThievesGuildNomad',
    'WotELizardMagistratus',
    'WotELizardNoble',
    'WotEKeeper',
    'WotEBosses',
    'WotEZalamon',
    'PlayerDeath',
    'AdvanceSave',
    'AdvanceRookgaard',
    'PythiusTheRotten',
    'DropLoot'
    }

    local function onMovementRemoveProtection(cid, oldPosition, time)
    local player = Player(cid)
    if not player then
    return true
    end

    local playerPosition = player:getPosition()
    if (playerPosition.x ~= oldPosition.x or playerPosition.y ~= oldPosition.y or playerPosition.z ~= oldPosition.z) or player:getTarget() then
    player:setStorageValue(Storage.combatProtectionStorage, 0)
    return true
    end

    addEvent(onMovementRemoveProtection, 1000, cid, oldPosition, time - 1)
    end

    function onLogin(player)
    local loginStr = 'Welcome to ' .. configManager.getString(configKeys.SERVER_NAME) .. '!'
    if player:getLastLoginSaved() <= 0 then
    loginStr = loginStr .. ' Please choose your outfit.'
    player:sendTutorial(1)
    else
    if loginStr ~= '' then
    player:sendTextMessage(MESSAGE_STATUS_DEFAULT, loginStr)
    end

    loginStr = string.format('Your last visit was on %s.', os.date('%a %b %d %X %Y', player:getLastLoginSaved()))
    end
    player:sendTextMessage(MESSAGE_STATUS_DEFAULT, loginStr)

    local playerId = player.uid

    -- Stamina
    Game.getStorageValue("stamina")[playerId] = 0

    -- Promotion
    local vocation = player:getVocation()
    local promoted = player:isPromoted()
    if player:isPremium() then
    local value = player:getStorageValue(Storage.Promotion)
    if promoted and value ~= 1 then
    player:setStorageValue(Storage.Promotion, 1)
    elseif not promoted and value == 1 then
    player:setVocation(vocation:getPromotion())
    end
    elseif promoted then
    player:setVocation(vocation:getDemotion())
    end

    -- Events
    for i = 1, #events do
    player:registerEvent(events[i])
    end

    if player:getStorageValue(Storage.combatProtectionStorage) <= os.time() then
    player:setStorageValue(Storage.combatProtectionStorage, os.time() + 10)
    onMovementRemoveProtection(playerId, player:getPosition(), 10)
    end
    return true
    end

    este scripts no es para la version de su ot



    [CreatureEvents] (UP-LEVEL) Recompensa al subir de level YNU5B25
    https://www.tibiaface.com

    Contenido patrocinado


    Ver el tema anterior Ver el tema siguiente Volver arriba  Mensaje (Página 1 de 1.)

    Permisos de este foro:
    No puedes responder a temas en este foro.

    Temas Recomendados×+

       

      BienvenidosTibiaFace es una comunidad de Open Tibia. Para participar debes estar registrado (click para Regístrate).