• TibiaFace

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

    .
    demo menumenu

    Afiliados



    Votar:

    problema con script

    Compartir:

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

    1problema con script Empty problema con script Miér Mar 23, 2022 9:08 pm

    akane

    akane
    Miembro
    Miembro
    Descripcion escribió:hola a todos, tengo un problema estoy haciendo una quest en la que un npc te da un item la cual tienes que presentárselo mas adelante a otro npc y este te deja pasar una puerta, el problema es que cuando el primer npc te da el item te puedes pasar la puerta sin tener que hablar con el npc y necesito que primero se hable con el npc, vea que tienes el item y despues te deje pasar y si no lo tienes no

    script del 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
    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, 'i have the permission')) then
    selfSay('Mmm...lets see...', cid)
    talkState[talkUser] = 1
    elseif(msgcontains(msg, 'orc commander permission letter') and talkState[talkUser] == 1) then
    if(getPlayerStorageValue(cid, 206) < 1) then
    selfSay('You can pass now.', cid)
    else
    if(doPlayerRemoveItem(cid, 1952, 0) == TRUE) then
    setPlayerStorageValue(cid,206,1)
    selfSay('I understand, go ahead and good luck', cid)
    else
    selfSay('You cant pass without special permission', cid)
    end
    end
    return true
    end
    ---------------------------------------------------------
    end
    npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback)
    npcHandler:addModule(FocusModule:new())

    script del actions:

    Código:
    function onUse(cid, item, frompos, item2, topos)
    if (getPlayerStorageValue(cid,205) > 0) then
                pos = getPlayerPosition(cid)
                if pos.x == topos.x then
                  if pos.y < topos.y then
                      pos.y = topos.y + 1
                  else
                      pos.y = topos.y - 1
                  end
                elseif pos.y == topos.y then
                      if pos.x < topos.x then
                          pos.x = topos.x + 1
                      else
                          pos.x = topos.x - 1
                      end
                else
                    doPlayerSendTextMessage(cid,22,"you need stand front of the door!.")
                return true
                end
                doTeleportThing(cid,pos)
                doSendMagicEffect(topos,12)
            else
            doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "you need to present the permit to the orc guard")
            end
            return true
    end
    Captura del Error escribió:Imagen del error: problema con script Empty
    El error radica en: Actions

    2 participantes

    2problema con script Empty Re: problema con script Miér Mar 23, 2022 11:55 pm

    zerochile

    zerochile
    Miembro
    Miembro
    storages [Tienes que estar registrado y conectado para ver este vínculo] todo lo que quieres hacer son storagesSSSSS

    Igual fíjate en ese action que pasaste, esta chequeando el storage 205
    Código:
    if (getPlayerStorageValue(cid,205) > 0) then

    Y el NPC te esta dando el storage 206
    Código:
    setPlayerStorageValue(cid,206,1)

    Si el problema no es ese, entonces intenta agregarle un nuevo storage, que ya cuando termines de hablar con el NPC y le entregues todos los items te de un nuevo storage y ese lo usas para chequear la puerta.

    Los 2 esenciales:
    Chequeo:
    Código:
    if getPlayerStorageValue(cid,XXXX) <= 0 then
    else
    -- Si el jugador no tiene el storage entonces hara lo que indiques aqui
    end

    Dar storage:
    Código:
    setPlayerStorageValue(cid,XXXX, NUMERO)

    Smile

    PD: Me fije que el action que pasaste esta hecho para OTX 2 o TFS 0.4



    Última edición por zerochile el Vie Mar 25, 2022 3:10 pm, editado 1 vez

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

    3problema con script Empty Re: problema con script Jue Mar 24, 2022 12:12 am

    akane

    akane
    Miembro
    Miembro
    zerochile escribió:storages [Tienes que estar registrado y conectado para ver este vínculo] todo lo que quieres hacer son storagesSSSSS

    Igual fíjate en ese action que pasaste, esta chequeando el storage 205
    Código:
    if (getPlayerStorageValue(cid,205) > 0) then

    Y el NPC te esta dando el storage 206
    Código:
    setPlayerStorageValue(cid,206,1)

    Si el problema no es ese, entonces intenta agregarle un nuevo storage, que ya cuando termines de hablar con el NPC y le entregues todos los items te de un nuevo storage y ese lo usas para chequear la puerta.

    Los 2 esenciales:
    Chequeo:
    Código:
    if getPlayerStorageValue(cid,XXXX) == 0 then
    else
    -- Si el jugador no tiene el storage entonces hara lo que indiques aqui
    end

    Dar storage:
    Código:
    setPlayerStorageValue(cid,XXXX, NUMERO)

    Smile

    PD: Me fije que el action que pasaste esta hecho para OTX 2 o TFS 0.4

    de hecho yo ocupo otx 3.10 no se si será compatible, porque el unico error que tengo es el de la puerta todo lo demas me funciona bíen



    Very Happy Resuelto Gracias Very Happy

    2 participantes

    4problema con script Empty [Actions] problema con script Jue Mar 24, 2022 12:38 am

    akane

    akane
    Miembro
    Miembro
    resuelto, solo dejé los 2 scripts con storage 206 y ademas los 2 quedaron con la misma línea "if player:getStorageValue(206 == 1) then"

    2 participantes

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