• TibiaFace

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

    .
    demo menumenu

    Afiliados



    Votar:

    [Pedido] npc que pida matar boss y de recompenza

    Compartir:

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

    akane

    akane
    Miembro
    Miembro
    Descripcion escribió:hola a todos, busco un script de algun npc que me pida como mision matar a un boss y que luego de matarlo me de una recompenza dependiendo de la vocación

    mi consola es The OTX Server - Version: (4)
    Imagen Explicativa escribió:Imagen Explicativa: [Pedido] npc que pida matar boss y de recompenza Tibiaf10
    Version del Scripts: OTx Old Version(0.3.7)

    4 participantes

    [Admin] God Maya

    [Admin] God Maya
    Administrador
    Administrador
    en creaturescripts

    Código:
     <event type="kill" name="troll_mission" event="script" value="trollmission.lua"/>

    Código:

    local config = {
        ['troll'] = {amount = 25, storage = 19000, startstorage = 5002, startvalue = 1},
        ['troll champion'] = {amount = 10, storage = 19001, startstorage = 5002, startvalue = 1}
    }
    function onKill(cid, target)
        local monster = config[getCreatureName(target):lower()]
        if isPlayer(target) or not monster or isSummon(target) then
            return true
        end

        if (getPlayerStorageValue(cid, monster.storage)+1) < monster.amount and getPlayerStorageValue(cid, monster.startstorage) >= monster.startvalue then
            setPlayerStorageValue(cid, monster.storage, getPlayerStorageValue(cid, monster.storage) + 1)
            doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, 'Task message: '..(getPlayerStorageValue(cid, monster.storage)+1)..' of '..monster.amount..' '..getCreatureName(target)..'s killed.')
        end
        if (getPlayerStorageValue(cid, monster.storage)+1) == monster.amount then
            doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, 'Congratulations, you have killed '..(getPlayerStorageValue(cid, monster.storage)+1)..' '..getCreatureName(target)..'s and completed the '..getCreatureName(target)..'s mission.')
            setPlayerStorageValue(cid, monster.storage, getPlayerStorageValue(cid, monster.storage) + 1)
        end
        return true
    end


    en login.lua
    Código:

    registerCreatureEvent(cid, "troll_mission")

    en data/lib/050-function.lua:

    agregas al final

    Código:

    function isSummon(cid)
    return (isCreature(cid) == TRUE and (getCreatureMaster(cid) ~= cid)) and TRUE or FALSE
    end


    npc script


    Código:


    <?xml version="1.0" encoding="UTF-8"?>
    <npc name="Tomas" script="Tomas.lua" speed="100" walkinterval="2000" floorchange="0">
      <health now="100" max="100"/>
      <look type="129" head="78" body="20" legs="116" feet="38" addons="1"/>
      <parameters>
        <parameter key="message_greet" value="Hello |PLAYERNAME|, can you do me a {favor}?"/>
      </parameters>
    </npc>


    Código:

    local keywordHandler = KeywordHandler:new()
    local npcHandler = NpcHandler:new(keywordHandler)
    NpcSystem.parseParameters(npcHandler)
    local talkState = {}

    function onCreatureAppear(cid)      npcHandler:onCreatureAppear(cid)      end
    function onCreatureDisappear(cid)    npcHandler:onCreatureDisappear(cid)      end
    function onCreatureSay(cid, type, msg)    npcHandler:onCreatureSay(cid, type, msg)    end
    function onThink()        npcHandler:onThink()          end

    local storage = 5002

    function creatureSayCallback(cid, type, msg)
        if not npcHandler:isFocused(cid) then
            return false
        end
        local talkUser = NPCHANDLER_CONVBEHAVIOR == CONVERSATION_DEFAULT and 0 or cid

        if msgcontains(msg, "favor") then
            if getPlayerStorageValue(cid, storage) == -1 then
                selfSay("I have a mission for you, to kill 25 trolls and 10 troll champions, do you accept?", cid)
                talkState[talkUser] = 1
            elseif getPlayerStorageValue(cid, storage) == 1 then
                selfSay("Did you kill 25 trolls and 10 troll champions?", cid)
                talkState[talkUser] = 1
            else
                selfSay("You already did the mission.", cid)
            end
        elseif msgcontains(msg, "yes") and talkState[talkUser] == 1 then
            if getPlayerStorageValue(cid, storage) == -1 then
                selfSay("Thank you, the trolls has been harassing this village for to long", cid)
                setPlayerStorageValue(cid, storage, 1)
            else
                if getPlayerStorageValue(cid, 19000) == 5 and getPlayerStorageValue(cid, 19001) == 3 then
                    selfSay("Good job, here is your reward. go to the anvil at Darnells shop and use this.", cid)
                    doPlayerAddItem(cid, 2225, 1)
                    setPlayerStorageValue(cid, storage, 2)
                else
                    selfSay("You didn't kill them all.", cid)
                end
            end
            talkState[talkUser] = 0
        elseif msgcontains(msg, "no") and talkState[talkUser] == 1 then
            selfSay("Ok then.", cid)
            talkState[talkUser] = 0
        end
        return true
    end

    npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback)
    npcHandler:addModule(FocusModule:new())



    [Pedido] npc que pida matar boss y de recompenza YNU5B25
    4 participantes
    http://www.tibiaface.com

    paulina24

    paulina24
    Miembro
    Miembro
    Funciona para OTX 3.7? Si no es comptabile podria hacer una adapcion? me gustaria este script

    4 participantes

    GalaxyDev

    GalaxyDev
    Miembro
    Miembro
    excelente lo usare..



    [Tienes que estar registrado y conectado para ver este vínculo] Servidor 24/7 Full Animes  Smile    MI GITHUB (REVSCRIPTS TFS 1.3-1.5))
    4 participantes

    [Admin] God Maya

    [Admin] God Maya
    Administrador
    Administrador
    Tema Resuelto



    [Pedido] npc que pida matar boss y de recompenza YNU5B25
    4 participantes
    http://www.tibiaface.com

    Contenido patrocinado


    4 participantes

    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).