• TibiaFace

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

    .
    demo menumenu

    Afiliados



    Votar:

    ayuda script pet

    Compartir:

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

    1ayuda script pet Empty ayuda script pet Miér Jun 26, 2019 12:43 am

    akane

    akane
    Miembro
    Miembro
    Descripcion escribió:hola a todos, tengo una duda sobre un script de pet "https://www.tibiaface.com/t1145-sistema-pet-system-evolution-vocations-tfs#6410"

    tengo la duda de donde iba el siguiente script (todos los demas funcionan bien)

    [Tienes que estar registrado y conectado para ver este vínculo]

    intente crear un npc con ese script pero al momento de colocar el npc no sale :/

    vuelvo a mencionar que todos los demas script funcionan bien solo tengo problema con el npc, si me pudieran ayudar :c muchas gracias
    Captura del Error escribió:Imagen del error: ayuda script pet Ayuda10
    El error radica en: Npc

    2 participantes

    2ayuda script pet Empty Re: ayuda script pet Miér Jun 26, 2019 11:39 am

    [Admin] God Maya

    [Admin] God Maya
    Administrador
    Administrador
    el npc supongo que lo coloco con rme en el mapa



    ayuda script pet YNU5B25
    2 participantes
    http://www.tibiaface.com

    3ayuda script pet Empty Re: ayuda script pet Miér Jun 26, 2019 10:20 pm

    akane

    akane
    Miembro
    Miembro
    sip, si lo hice pero en la consola me sale esto

    [Tienes que estar registrado y conectado para ver este vínculo]

    2 participantes

    4ayuda script pet Empty Re: ayuda script pet Miér Jun 26, 2019 10:38 pm

    [Admin] God Maya

    [Admin] God Maya
    Administrador
    Administrador
    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 dead = 0
            local pet
            function creatureSayCallback(cid, type, msg)

            if(not npcHandler:isFocused(cid)) then
            return false
            end
            local talkUser = NPCHANDLER_CONVBEHAVIOR == CONVERSATION_PRIVATE and 0 or cid
            if msgcontains(msg, 'offer') then
            local b = false
            local c = 0
            local response = "Here %s the following %s that you can buy:"
            for _, it in pairs(pets) do
            if it.cost and it.cost > 0 then
            c = c + 1
            b = true
            local voc, sep = "", ", "
            for i = 1, #it.vocations do
            if i == #it.vocations - 1 then
            sep = " and "
            elseif i == #it.vocations then
            sep = ""
            end
            voc = voc .. getVocationInfo(it.vocations).name .. sep
            end
            response = response .. "\n Name: " .. it.monster .. ", Cost: " .. it.cost .. ", Level: " .. it.level .. ", Vocations: " .. voc .. "."
            end
            end
            response = string.format(response, (c > 1 and "are" or "is"), (c > 1 and "pets" or "pet"))
            npcHandler:say(response, cid)


            elseif msgcontains(msg, 'revive') then

            for i = 1, #pets do
            if getCreatureStorage(cid, tables.isDead) > 0 then
            dead = dead + 1
            end
            end
            if dead > 0 then
            npcHandler:say('Do you want to revive ' .. dead .. ' of your pets for ' .. reviveCost * dead .. ' gold coins?.', cid)
            talkState[talkUser] = 1
            else
            npcHandler:say('Any of your pet is dead.', cid)
            talkState[talkUser] = 0
            end
            elseif msgcontains(msg, 'buy') then
            npcHandler:say('Please tell me the name of the pet that you can buy.', cid)
            talkState[talkUser] = 2
            elseif msgcontains(msg, 'yes') and talkState[talkUser] == 1 then
            if doPlayerRemoveMoney(cid, reviveCost * dead) then
            for i = 1, #tables.isDead do
            doCreatureSetStorage(cid, tables.isDead, 0)
            end
            npcHandler:say('Your pets has been revived.', cid)
            talkState[talkUser] = 0
            else
            npcHandler:say('You do not have enough money.', cid)
            talkState[talkUser] = 0
            end
            elseif talkState[talkUser] == 2 then
            pet = getPetIdByName(msg)
            if not pet then
            npcHandler:say('There is not any pet with that name.', cid)
            talkState[talkUser] = 0
            return true
            end

            if getCreatureStorage(cid, tables.buyed[pet]) > 0 then
            npcHandler:say('You already bought this pet.', cid)
            talkState[talkUser] = 0
            return true
            end

            if pets[pet].cost and pets[pet].cost > 0 then
            npcHandler:say('Do you want to buy ' .. pets[pet].monster .. ' [' .. pets[pet].level .. '] for ' .. pets[pet].cost .. ' gold coins?', cid)
            talkState[talkUser] = 3
            else
            npcHandler:say('This pet is not buyable, please tell me the name of the pet that you can buy.', cid)
            talkState[talkUser] = 2
            end
            elseif msgcontains(msg, 'yes') and talkState[talkUser] == 3 then
            if doPlayerRemoveMoney(cid, pets[pet].cost) then
            doCreatureSetStorage(cid, tables.buyed[pet], 1)
            npcHandler:say('Congratulations! you bought ' .. pets[pet].monster .. ' [' .. pets[pet].level .. '].', cid)
            talkState[talkUser] = 0
            else
            npcHandler:say('You do not have enough money to buy this pet.', cid)
            talkState[talkUser] = 0
            end
            end
            return true
            end

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

    ahi lo tienes prueba



    ayuda script pet YNU5B25
    2 participantes
    http://www.tibiaface.com

    5ayuda script pet Empty Re: ayuda script pet Miér Jun 26, 2019 10:45 pm

    akane

    akane
    Miembro
    Miembro
    si funciono Very Happy gracias maya

    2 participantes

    6ayuda script pet Empty Re: ayuda script pet Miér Jun 26, 2019 11:06 pm

    [Admin] God Maya

    [Admin] God Maya
    Administrador
    Administrador
    solucionado



    ayuda script pet YNU5B25
    2 participantes
    http://www.tibiaface.com

    Contenido patrocinado


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