• TibiaFace

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

    .
    demo menumenu

    Afiliados



    Votar:

    Ayuda con script de mision en npc

    Compartir:

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

    1Thắc mắc Ayuda con script de mision en npc el Mar Mar 24, 2020 10:26 pm

    milano

    milano
    Nuevo Miembro
    Nuevo Miembro
    Hola, tengo el siguiente ejemplo de un npc que te da una mision usando storage:

    Código:


    local storage = 5000
    if msgcontains(msg, "mission") then
        if getPlayerStorageValue(cid, storage) == -1 then -- When the player comes to the NPC for the first time or didn't accepted the mission yet.
            selfSay("My daughter lost her doll, I saw a monster taking it that went in this cave, but I'm to affraid to go there, can you get it for me?", cid)
            talkState[talkUser] = 1
        elseif getPlayerStorageValue(cid, storage) == 1 then -- When the player comes back after accepting the mission.
            selfSay("Did you find the doll?", cid)
            talkState[talkUser] = 1
        else
            selfSay("Thanks again for finding the doll.", cid) -- The NPC will say this when the storage is not -1 or 1, so this means the player completed the mission.
        end
    elseif msgcontains(msg, "yes") and talkState[talkUser] == 1 then
        if getPlayerStorageValue(cid, storage) == -1 then
            selfSay("Thanks alot, come back when you have it.", cid)
            setPlayerStorageValue(cid, storage, 1)
        else -- You can use else here because it's only possible to say yes here with storagevalue -1 and 1, so if it's not -1, it has to be 1.
            if doPlayerRemoveItem(cid, 2110, 1) then -- You can use this to remove an item, by using if it will also look if it's possible, so it's not true if the player doesn't have the item.
                selfSay("That's great, my daughter will be really happy, thanks.", cid)
                doPlayerAddItem(cid, 2160, 3) -- You can add for example items as reward.
                doPlayerAddExp(cid, 5000) -- or experience
                setPlayerStorageValue(cid, 3843, 1) -- or storage, for example to open a quest door (I will not add this to the in total part, since most of the time you don't need it).
                setPlayerStorageValue(cid, storage, 2) -- Set storage to value 2, so when the value is not -1 or 1, it will say 'Thanks again for finding the doll.'.
            else -- if removing the item wasn't possible (so this means the player doesn't have it), it will do the part after else.
                selfSay("You don't have it.", cid)
            end
        end
        talkState[talkUser] = 0
    end

    quiero que cuando el jugador pida la misión, el npc le entregue un item (no como reward) sino como un objeto para usar durante la mision. me ayudaría bastante gracias.

    2Thắc mắc Re: Ayuda con script de mision en npc el Miér Mar 25, 2020 9:07 am

    [Admin] God Maya

    [Admin] God Maya
    Administrador
    Administrador
    aqui tienes

    Código:



            local storage = 5000
            if msgcontains(msg, "mission") then
                if getPlayerStorageValue(cid, storage) == -1 then -- When the player comes to the NPC for the first time or didn't accepted the mission yet.
                    selfSay("My daughter lost her doll, I saw a monster taking it that went in this cave, but I'm to affraid to go there, can you get it for me?", cid)
                 doPlayerAddItem(cid, 2160, 3) -- item que dara para recuperar la muñeca
                    talkState[talkUser] = 1
                elseif getPlayerStorageValue(cid, storage) == 1 then -- When the player comes back after accepting the mission.
                    selfSay("Did you find the doll?", cid)
                    talkState[talkUser] = 1
                else
                    selfSay("Thanks again for finding the doll.", cid) -- The NPC will say this when the storage is not -1 or 1, so this means the player completed the mission.
                end
            elseif msgcontains(msg, "yes") and talkState[talkUser] == 1 then
                if getPlayerStorageValue(cid, storage) == -1 then
                    selfSay("Thanks alot, come back when you have it.", cid)
                    setPlayerStorageValue(cid, storage, 1)
                else -- You can use else here because it's only possible to say yes here with storagevalue -1 and 1, so if it's not -1, it has to be 1.
                    if doPlayerRemoveItem(cid, 2110, 1) then -- You can use this to remove an item, by using if it will also look if it's possible, so it's not true if the player doesn't have the item.
                        selfSay("That's great, my daughter will be really happy, thanks.", cid)
                        doPlayerAddItem(cid, 2160, 3) -- You can add for example items as reward.
                        doPlayerAddExp(cid, 5000) -- or experience
                        setPlayerStorageValue(cid, 3843, 1) -- or storage, for example to open a quest door (I will not add this to the in total part, since most of the time you don't need it).
                        setPlayerStorageValue(cid, storage, 2) -- Set storage to value 2, so when the value is not -1 or 1, it will say 'Thanks again for finding the doll.'.
                    else -- if removing the item wasn't possible (so this means the player doesn't have it), it will do the part after else.
                        selfSay("You don't have it.", cid)
                    end
                end
                talkState[talkUser] = 0
            end




    Ayuda con script de mision en npc YNU5B25
    https://www.tibiaface.com

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