• TibiaFace

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

    .
    demo menumenu

    Afiliados



    Votar:

    [NPC] [NPC] [NPC] Necesito este npc

    Compartir:

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

    1[NPC] [NPC] [NPC] Necesito este npc Empty [NPC] [NPC] [NPC] Necesito este npc Jue Mar 24, 2022 12:49 pm

    smurfizi12

    smurfizi12
    Nuevo Miembro
    Nuevo Miembro
    Descripcion escribió:Buenas comunidad de TibiaFace!

    queria pedirles un script de 2 npc para mi servidor TFS 1.3 12.64

    1. 1r: que entregue exercices weapons (dependiendo de la vocacion, y si es para knigh que pregunte si quiere sword, axe o club), cada 24 horas y que quede en la parte de store, que no se pueda mover ni tradear.

      2do: que te de un exercice weapon al igual de arriba pero que esta vez sea por unica vez (es para el principio de bienvenida)


    gracias por su tiempo ! Razz
    Imagen Explicativa escribió:Imagen Explicativa: [NPC] [NPC] [NPC] Necesito este npc Tibiaf10
    Version del Scripts: TFs 1.x

    3 participantes

    2[NPC] [NPC] [NPC] Necesito este npc Empty Re: [NPC] [NPC] [NPC] Necesito este npc Jue Mar 24, 2022 2:12 pm

    [Admin] God Maya

    [Admin] God Maya
    Administrador
    Administrador
    todo via sources no hay nada que se pueda hacer por lua

    a nose que pida vocacion eso se podria trabjar por lua



    [NPC] [NPC] [NPC] Necesito este npc YNU5B25
    3 participantes
    http://www.tibiaface.com

    3[NPC] [NPC] [NPC] Necesito este npc Empty Re: [NPC] [NPC] [NPC] Necesito este npc Jue Mar 24, 2022 10:25 pm

    [Admin] God Maya

    [Admin] God Maya
    Administrador
    Administrador
    aqui tienes tu 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 voices = { {text = 'talk: exercise.'} }
    npcHandler:addModule(VoiceModule:new(voices))
     
    local items = {
              item5 = {10000, 5887}, -- precio, item
              item4 = {10000, 5889}, -- precio, item
            item3 = {10000, 5888}, -- precio, item
            item2 = {10000, 5892}, -- precio, item
           
            item1 = {10000, 6529} -- item3 item que será pedido e que será dado na segunda troca
          
    }
    local counts = {
              count5 = {1, 1}, -- count es la cantidad
              count4 = {1, 1}, -- count es la cantidad
            count3 = {1, 1}, -- count es la cantidad
            count2 = {1, 1}, -- count es la cantidad
           
            count1 = {1, 1} -- count es la cantidad
           
    }


    local config = {
        exhaustTime = 24 * 60 * 60, -- 24 hours
        exhaustStorage = 31402
    }

    local function secondsToString(seconds)
        if not seconds or seconds < 1 then
            return false
        end

        local hours = math.floor(seconds / 3600)
        local minutes = math.floor((seconds - (hours * 3600)) / 60)
        seconds = seconds - (hours * 3600) - (minutes * 60)

        local hour_string = hours > 0 and (hours .. (hours == 1 and " hour " or " hours ")) or ""
        local minute_string = minutes > 0 and (minutes .. (minutes == 1 and " minute " or " minutes ")) or ""
        local second_string = seconds > 0 and (seconds .. (seconds == 1 and " second " or " seconds ")) or ""

        local string = hour_string .. minute_string .. second_string

        local words = {}
        for word in string:gmatch("%S+") do
            table.insert(words, word)
        end

        if #words > 2 then
            string = ""
            for key, word in pairs(words) do
                if key == (#words - 1) then
                    string = string .. " and"
                end
                string = string .. " " .. word
            end
        end
        return string:trim()
    end
     
    function creatureSayCallback(cid, type, msg)
    local player = Player(cid)
              if(not npcHandler:isFocused(cid)) then
                        return false
              end
              local talkUser = NPCHANDLER_CONVBEHAVIOR == CONVERSATION_DEFAULT and 0 or cid
     
       
       
              if msgcontains(msg, 'exercise') or msgcontains(msg, 'exe') then
           
            local exhaustStorage = player:getStorageValue(config.exhaustStorage)
        local currentTime = os.time()
        if exhaustStorage > currentTime then
            player:sendTextMessage(MESSAGE_EVENT_ADVANCE, "You must wait " .. secondsToString(exhaustStorage - currentTime) .. ".")
            return true
        end
           
           
                        if not player:removeMoneyNpc(items.item1[1]) then
                   
                   selfSay('You need '.. counts.count1[1] ..' '.. getItemName(items.item1[1]) ..'.', cid)
                   
                   
                   else
                   
                   
                   
                   
                    if (player:getVocation():getID() == 1) or (player:getVocation():getID() == 5) then
         
                        doPlayerAddItem(cid, items.item1[2], counts.count1[2])
                           player:setStorageValue(config.exhaustStorage, currentTime + config.exhaustTime)
                                  selfSay('You '.. counts.count1[2] ..' '.. getItemName(items.item1[2]) ..'.', cid)
           
                        elseif (player:getVocation():getID() == 2) or (player:getVocation():getID() == 6) then
                   
                   doPlayerAddItem(cid, items.item2[2], counts.count2[2])
                           player:setStorageValue(config.exhaustStorage, currentTime + config.exhaustTime)
                                  selfSay('You '.. counts.count2[2] ..' '.. getItemName(items.item2[2]) ..'.', cid)
         
                        elseif (player:getVocation():getID() == 3) or (player:getVocation():getID() == 7) then
                   
                   doPlayerAddItem(cid, items.item3[2], counts.count3[2])
                           player:setStorageValue(config.exhaustStorage, currentTime + config.exhaustTime)
                                  selfSay('You '.. counts.count3[2] ..' '.. getItemName(items.item3[2]) ..'.', cid)
         
                        elseif (player:getVocation():getID() == 4) or (player:getVocation():getID() == 8) then
                   
                   doPlayerAddItem(cid, items.item4[2], counts.count4[2])
                           player:setStorageValue(config.exhaustStorage, currentTime + config.exhaustTime)
                                  selfSay('You '.. counts.count4[2] ..' '.. getItemName(items.item4[2]) ..'.', cid)
         
                      end
                   
                                 
                                 
                       
                                 
                        end

           
                   
                   
              end
           
              return TRUE
    end

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



    [NPC] [NPC] [NPC] Necesito este npc YNU5B25
    3 participantes
    http://www.tibiaface.com

    4[NPC] [NPC] [NPC] Necesito este npc Empty Re: [NPC] [NPC] [NPC] Necesito este npc Jue Mar 24, 2022 11:58 pm

    smurfizi12

    smurfizi12
    Nuevo Miembro
    Nuevo Miembro
    maya no logro entender para configurar los id de los exercises weapons ni menos la cantidad deseada. el npc si funciona, le dices "hi", "exercise", pero no entrega nada, y te dice Paid 100000 gold from inventory. yo quiero que solo le digas HI EXERCISE y te de el arma solito jejej

    3 participantes

    5[NPC] [NPC] [NPC] Necesito este npc Empty Re: [NPC] [NPC] [NPC] Necesito este npc Vie Mar 25, 2022 2:39 am

    zerochile

    zerochile
    Miembro
    Miembro
    El de bienvenida seria este:

    Recuerda editar donde dice:
    player:addItem(XXXX, 1) -- ITEMID, COUNT      ◄◄◄ NO TE OLVIDES DE ESO

    Obviamente donde dice XXXX, seria el ID del objeto que va a dar.
    Y donde dice 1, es la cantidad que dará del objeto que indicaste.
    (Igualmente puedes editar los mensajes del NPC en cada "npcHandler:say")

    SCRIPT:
    Código:
    local keywordHandler = KeywordHandler:new()
    local npcHandler = NpcHandler:new(keywordHandler)
    NpcSystem.parseParameters(npcHandler)

    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

    function creatureSayCallback(cid, type, msg)
    local player = Player(cid)
    local storageitems = 500
     if msgcontains(msg, "exercise weapon") then
     npcHandler:say("Do you want your exercise weapon for your vocation? {yes}", cid)
     npcHandler.topic[cid] = 2
     end
     if msgcontains(msg, "yes") and npcHandler.topic[cid] == 2 then
     if (player:getVocation():getId() == 1 or player:getVocation():getId() == 5) and player:getStorageValue(storageitems) < 1 then
     npcHandler:say("Take this item for Sorcerer!", cid)
     player:addItem(XXXX, 1) -- ITEMID, COUNT
     player:setStorageValue(storageitems, 1)
     elseif (player:getVocation():getId() == 2 or player:getVocation():getId() == 6) and player:getStorageValue(storageitems) < 1 then
     npcHandler:say("Take this item for Druid!", cid)
     player:addItem(XXXX, 1) -- ITEMID, COUNT
     player:setStorageValue(storageitems, 1)
     elseif (player:getVocation():getId() == 3 or player:getVocation():getId() == 7) and player:getStorageValue(storageitems) < 1 then
     npcHandler:say("Take this item for Paladin!", cid)
     player:addItem(XXXX, 1) -- ITEMID, COUNT
     player:setStorageValue(storageitems, 1)
     elseif (player:getVocation():getId() == 4 or player:getVocation():getId() ==  and player:getStorageValue(storageitems) < 1 then
     npcHandler:say("Uhh I see you are a knight, what type of weapon do you want {axe, club} or {sword}.", cid) -- Mensaje del NPC
     npcHandler.topic[cid] = 3
     elseif player:getStorageValue(storageitems) > 0 then
     npcHandler:say("Hmm sorry bro you already have that items...", cid)
     end
     end
     if msgcontains(msg, "axe") and npcHandler.topic[cid] == 3 and player:getStorageValue(storageitems) < 1 then
     npcHandler:say("Take this AXE!", cid) -- Mensaje del NPC
     player:addItem(XXXX, 1) -- ITEMID, COUNT
     player:setStorageValue(storageitems, 1)
     elseif msgcontains(msg, "club") and npcHandler.topic[cid] == 3 and player:getStorageValue(storageitems) < 1 then
     npcHandler:say("Take this CLUB!", cid) -- Mensaje del NPC
     player:addItem(XXXX, 1) -- ITEMID, COUNT
     player:setStorageValue(storageitems, 1)
     elseif msgcontains(msg, "sword") and npcHandler.topic[cid] == 3 and player:getStorageValue(storageitems) < 1 then
     npcHandler:say("Take this SWORD!", cid) -- Mensaje del NPC
     player:addItem(XXXX, 1) -- ITEMID, COUNT
     player:setStorageValue(storageitems, 1)
     end
     return true
    end

    npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback)
    npcHandler:setMessage(MESSAGE_GREET, "Hum! Welcume |PLAYERNAME|. I only deliver the exercise items to the people, if you want one, then say {exercise weapon}.")
    npcHandler:setMessage(MESSAGE_FAREWELL, "Good bye |PLAYERNAME|.")
    npcHandler:setMessage(MESSAGE_WALKAWAY, "Good bye |PLAYERNAME|.")
    npcHandler:addModule(FocusModule:new())

    Smile

    3 participantes
    http://venore-war.sytes.net

    6[NPC] [NPC] [NPC] Necesito este npc Empty Re: [NPC] [NPC] [NPC] Necesito este npc Vie Mar 25, 2022 1:02 pm

    smurfizi12

    smurfizi12
    Nuevo Miembro
    Nuevo Miembro
    Excelente, funciona bien. Pero queria pedir unos detalles a agregarle al script

    necesito que npc de esos items cada 24hrs y que los items se vayan a la Store Inbox que no sean tradeables ni que se puedan mover

    3 participantes

    7[NPC] [NPC] [NPC] Necesito este npc Empty Re: [NPC] [NPC] [NPC] Necesito este npc Vie Mar 25, 2022 1:10 pm

    [Admin] God Maya

    [Admin] God Maya
    Administrador
    Administrador
    imposible de que se puede enviar al store se puede pero para que no se pueda mover de la store box habría que meter mano sources y hacer un identificación al objeto y se le agregue cierta condición para que no se mueva de ahí



    [NPC] [NPC] [NPC] Necesito este npc YNU5B25
    3 participantes
    http://www.tibiaface.com

    8[NPC] [NPC] [NPC] Necesito este npc Empty Re: [NPC] [NPC] [NPC] Necesito este npc Vie Mar 25, 2022 1:58 pm

    zerochile

    zerochile
    Miembro
    Miembro
    Yo no se si tendrá algo que ver con esto, como repito, no tengo conocimiento para las versiones sobre 11.x+ o 12.x+ ya que los clientes contienen cosas extras tales como el store inbox y yo no tengo server ni cliente para probar (si tuviera como testear te ayudaría)

    Pero por ahí encontré un script:
    Código:
    local storeInbox = player:getStoreInbox()
        if storeInbox then
            local item = Game.createItem(2598, 1)
            if item then
                item:setStoreItem(true) --evita que el item se mueva del store inbox
                storeInbox:addItemEx(item)
            end
        end
    (Alguien que sepa de 11.x+ o 12.x+ te lo podra implementar)

    En donde:
    Código:
    item:setStoreItem(true)
    Se supone que serviría para que el item no se pueda mover de store inbox.

    Mas allá, yo no puedo hacer... Por lo que alguien que tenga mas conocimiento para las versiones 11.x+ o 12.x+ podrá ayudarte
    Laughing

    3 participantes
    http://venore-war.sytes.net

    Contenido patrocinado


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