• TibiaFace

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

    .
    demo menumenu

    Afiliados



    Votar:

    [CreatureEvents] Frag Recompensa

    Compartir:

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

    1[CreatureEvents] Frag Recompensa Empty [CreatureEvents] Frag Recompensa Miér Jul 09, 2014 12:37 pm

    [Admin] God Maya

    [Admin] God Maya
    Administrador
    Administrador
    Hola usuarios de tibiaface

    Aquí le traigo un creature script que le da una recompensa por frag o por player asesinado  muy simple le dejo imaganes.

    Testeado en The Forgotten Server 0.3.7 (vrs. 0.4)

    Level: 8 - 99 [CreatureEvents] Frag Recompensa Bct3m
    Level: 100 - 199 [CreatureEvents] Frag Recompensa Hsolg0
    Level: 200 - ??? [CreatureEvents] Frag Recompensa Ih0ept
    el corazon es opcional![CreatureEvents] Frag Recompensa 219coc1

    puede activar o desactivar en configuracion explicaremos.

    [CreatureEvents] Frag Recompensa S0vh51[CreatureEvents] Frag Recompensa Wjyz4p


    bueno muy simple instalar:

    nos vamos a:


    data/creaturescripts/scripts

    copiamos cualquier archivo , renombramos por frag_reward.lua y pegamos esto dentro.

    Código:
    local config = {
    useTrophy = "yes", -- "yes" or "no"
    useHeart = "yes", -- "yes" or "no"
    killers = 1 -- only the actual killer gets rewarded.
    }

    local BRONZE, SILVER, GOLD = 10129, 10128, 10127

    function onDeath(cid, corpse, deathList)
    local reward = 0

    if(config.useTrophy) then
    config.useTrophy = getBooleanFromString(config.useTrophy)
    end
    if(config.useHeart) then
    config.useHeart = getBooleanFromString(config.useHeart)
    end

    local worldType = getConfigValue("worldType")
    if(worldType == "open") then
    for i = 1, config.killers do
    if(isPlayer(cid) and isPlayer(deathList)) then
    if(getPlayerIp(cid) ~= getPlayerIp(deathList)) then

    local var = {
    KILLER_NAME = getCreatureName(deathList),
    TARGET_NAME = getCreatureName(cid),
    KILLER_LEVEL = getPlayerLevel(deathList),
    TARGET_LEVEL = getPlayerLevel(cid)
    }

    if(var.TARGET_LEVEL > 8 and var.TARGET_LEVEL < 100) then
    reward = BRONZE
    elseif(var.TARGET_LEVEL > 99 and var.TARGET_LEVEL < 200) then
    reward = SILVER
    elseif(var.TARGET_LEVEL > 199) then
    reward = GOLD
    end

    local trophy, heart = 0, 0
    if(config.useHeart) then
    heart = doAddContainerItem(corpse.uid, 5943, 1)
    end

    if(config.useTrophy) then
    trophy = doPlayerAddItem(deathList, reward, 1)
    end

    local killers = ""
    for i = 1, math.min(getConfigInfo('deathAssistCount') + 1, #deathList) do
    killers = killers .. (i == 1 and "" or ", ") .. (isMonster(deathList) and "a " or "") .. getCreatureName(deathList)
    end

    if(config.useHeart) then
    doItemSetAttribute(heart, "name", "Heart of " .. var.TARGET_NAME)
    doItemSetAttribute(heart, "description", "It was taken from " .. var.TARGET_NAME .. "'s body. " .. (getPlayerSex(cid) == 0 and "She" or "He") .. " was killed at level " .. var.TARGET_LEVEL .. " by " .. var.KILLER_NAME .. ". " .. (getCreatureSkullType(cid) <= SKULL_GREEN and "(Unjustified)" or "(Justified)"))
    end

    if(config.useTrophy) then
    doItemSetAttribute(trophy, "description", "It was awarded to " .. var.KILLER_NAME .. " for killing " .. var.TARGET_NAME .. ". " .. (getPlayerSex(cid) == 0 and "She" or "He") .. " was killed at level " .. var.TARGET_LEVEL .. " by " .. var.KILLER_NAME .. " who was level " .. var.KILLER_LEVEL .. " at the time. " .. (getCreatureSkullType(cid) <= SKULL_GREEN and "(Unjustified)" or "(Justified)"))
    end

    doSendMagicEffect(getThingPosition(cid), CONST_ME_MAGIC_RED)
    end
    end
    end
    end
    return true
    end


    Luengo nos vamos a:


    data/creaturescripts/scripts/login.lua

    Abrimos el archivos y añadimos esta linea:

    Código:
    registerCreatureEvent(cid, "Frag Reward")



    Luego añadimos esta tag en:


    data/creaturescripts/creaturescripts.xml

    Código:
    <event type="death" name="Frag Reward" event="script" value="frag_reward.lua"/>

    configuracion:

    local config = {
    useTrophy = "yes", -- "yes" or "no"
    useHeart = "yes", -- "yes" or "no"
    killers = 1 -- only the actual killer gets rewarded.
    }



    y listo

    creditos:
    J.Dre 100% script



    [CreatureEvents] Frag Recompensa YNU5B25
    http://www.tibiaface.com

    2[CreatureEvents] Frag Recompensa Empty Re: [CreatureEvents] Frag Recompensa Jue Jul 10, 2014 12:38 pm

    Invitado

    Anonymous
    Invitado
    me gusta! laik!

    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.

     

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