• 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 Lun Mar 21, 2022 1:01 am

    akane

    akane
    Miembro
    Miembro
    Descripcion escribió:hola a todos, tengo problemas con un script de un npc, el primer problema es que cuando quiero pedirle la ultima mision diciendo el comando mission no me dice nada y no me da la mission, tengo que ocupar el siguiente comando que es yes para que haga la función y siga con la quest.

    para que se entienda mejor:

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

    y el otro problema es que al decirle yes repetidas veces crea varios summons y no solo 1 (que es lo que necesito)

    aquí parte de mi script:

    Código:
       elseif msgcontains(msg, "mission") or msgcontains(msg, "quest") then
                npcHandler:say({"Are you ready?"}, cid)
          elseif(msgcontains(msg, "yes")) then
                npcHandler:say("let's do it", cid)
                   for x = 1, 1 do
                   m = doSummonCreature("Helpless Orc", getThingPos(cid))
                   doConvinceCreature(cid, m)
                end
          end
       end
       return true
    end
    Captura del Error escribió:Imagen del error: problema con script YW82b95
    El error radica en: Npc

    4 participantes

    2problema con script Empty Re: problema con script Lun Mar 21, 2022 11:28 am

    [Admin] God Maya

    [Admin] God Maya
    Administrador
    Administrador
    de que trata tu scripts por solo veo un pedaso



    problema con script YNU5B25
    4 participantes
    http://www.tibiaface.com

    3problema con script Empty Re: problema con script Lun Mar 21, 2022 2:34 pm

    akane

    akane
    Miembro
    Miembro
    por algo puse que era una parte xd, es un script algo extenso, es sobre una quest, y la mision final es esa parte.

    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

    local function creatureSayCallback(cid, type, msg)
       if not npcHandler:isFocused(cid) then
          return false
       end
       local player = Player(cid)
       if(msgcontains(msg, "what?")) then
          npcHandler:say("Prek tars, dekklep zurk!!", cid)
       elseif(msgcontains(msg, "i dont understand")) then
          if(player:getStorageValue(200) < 1) then
             npcHandler:say("c..ca..n h..he...lpp?", cid)
             npcHandler.topic[cid] = 2
          end
       elseif(msgcontains(msg, "mission") or msgcontains(msg, "report")) then
          if(player:getStorageValue(200) == 1) then
             npcHandler:say("ma.....mage......tr..a....ns....l...", cid)
             player:setStorageValue(200, 2)
             player:setStorageValue(12110, 2) -- The Inquisition Questlog- "Ask for Mission"
             player:setStorageValue(12111, 1) -- The Inquisition Questlog- "Mission 1: Investigate"
          elseif(player:getStorageValue(200) == 2) then
             npcHandler:say("Can you understand what I'm saying now?", cid)
             npcHandler.topic[cid] = 3
          end
       elseif(msgcontains(msg, "yes")) then
          if(npcHandler.topic[cid] == 2) then
             npcHandler:say("{mission} h...he..lp.", cid)
             npcHandler.topic[cid] = 0
             player:setStorageValue(200, 1)
             player:setStorageValue(12110, 1) -- The Inquisition Questlog- "Ask for Mission"
          elseif(npcHandler.topic[cid] == 3) then
             if(player:getStorageValue(203) == 1) then
                npcHandler:say("Very Well, i belong to a rookie group of soldiers of our kingdom, me and my team were ambushed by a large group of bandits.   I need your help to be able to rescue my companions, but for that I need equipment since mine was stolen and that you escort me to the entrance of the castle...there are soldiers guarding the entrance, and they could help. Would you help me?", cid)
                npcHandler.topic[cid] = 0
                player:setStorageValue(200, 3)
                player:setStorageValue(12111, 7) -- The Inquisition Questlog- "Mission 1: Investigate"
             else
                npcHandler:say("You haven't done your mission yet.", cid)
                npcHandler.topic[cid] = 0
          end
          elseif(player:getStorageValue(200) == 3) then
             npcHandler:say("You bring me all the equipment?.", cid)
             npcHandler.topic[cid] = 0
             player:setStorageValue(200, 4)
             player:setStorageValue(12115, 1) -- The Inquisition Questlog- "Mission 2: In Search of Survival"
          elseif(player:getStorageValue(200) == 4) then
             if(player:getItemCount(2484) == 1 and player:getItemCount(2643) == 1 and player:getItemCount(2379) == 1 and player:getItemCount(12409) == 1 and player:getItemCount(2512) == 1) then
                npcHandler:say("You're indeed a dedicated protector of the true believers. Don't stop now. Kill as many of these creatures as you can. ...", cid)
                npcHandler:say("Ok I can now equip myself, but now we must go to the entrance of the castle.", cid)
                player:setStorageValue(200, 5)
                player:setStorageValue(12115, 2) -- The Inquisition Questlog- "Mission 2: In Search of Survival"
                player:removeItem(2484, 1)
                player:removeItem(2643, 1)
                player:removeItem(2379, 1)
                player:removeItem(12409, 1)
                player:removeItem(2512, 1)
                player:getPosition():sendMagicEffect(CONST_ME_MAGIC_BLUE)
             else
                npcHandler:say("You need the items.", cid)
          end   
          elseif msgcontains(msg, "mission") or msgcontains(msg, "quest") then
                npcHandler:say({"Are you ready?"}, cid)
          elseif(msgcontains(msg, "yes")) then
                npcHandler:say("let's do it", cid)
                   for x = 1, 1 do
                   m = doSummonCreature("Helpless Orc", getThingPos(cid))
                   doConvinceCreature(cid, m)
                end
          end
       end
       return true
    end

    ese es el script completo

    4 participantes

    4problema con script Empty Re: problema con script Lun Mar 21, 2022 8:05 pm

    [Admin] God Maya

    [Admin] God Maya
    Administrador
    Administrador
    tendras que colocarle storage para que cuando ello la intenten hacer de nuevo no le reprodusca de nuevo el monsters



    problema con script YNU5B25
    4 participantes
    http://www.tibiaface.com

    5problema con script Empty Re: problema con script Lun Mar 21, 2022 9:30 pm

    akane

    akane
    Miembro
    Miembro
    y para lo otro que tendía que colocar?, ya que traté de seguir el ejemplo de las otras misiones y colocarles el storage pero no me funcionó :c

    4 participantes

    6problema con script Empty Re: problema con script Lun Mar 21, 2022 9:50 pm

    zerochile

    zerochile
    Miembro
    Miembro
    Test It
    Código:
      elseif msgcontains(msg, "mission") or msgcontains(msg, "quest") then
                npcHandler:say({"Are you ready?"}, cid)
     local thestorage = 505
     elseif(msgcontains(msg, "yes")) and player:getStorageValue(thestorage) <= 0 then
                npcHandler:say("let's do it", cid)
                   for x = 1, 1 do
                   m = doSummonCreature("Helpless Orc", getThingPos(cid))
                   doConvinceCreature(cid, m)
       player:setStorageValue(thestorage, 1)
     elseif(msgcontains(msg, "yes")) and player:getStorageValue(thestorage) > 0 then
                npcHandler:say({"Ummhh... you already have the Helpless Orc with you."}, cid)
                end
          end
       end
       return true
    end

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

    7problema con script Empty Re: problema con script Lun Mar 21, 2022 11:23 pm

    akane

    akane
    Miembro
    Miembro
    nop, nada

    4 participantes

    8problema con script Empty Re: problema con script Mar Mar 22, 2022 4:51 am

    ramses82

    ramses82
    Nuevo Miembro
    Nuevo Miembro
    Codigo merjorado y con storageid  *solo sumonea una vez*
    Código:

    local keywordHandler = KeywordHandler:new()
    local npcHandler = NpcHandler:new(keywordHandler)
    NpcSystem.parseParameters(npcHandler)
    local talkState = {}
    --by Ramses
    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 monster = "orc"

    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, "mission") or msgcontains(msg, "quest") then --como empiexza
          npcHandler:say({"texto que dira el npc para empezar"}, cid) --aja
          talkState[talkUser] = 1
      elseif(msgcontains(msg, "yes") and talkState[talkUser] == 1) then
     if(getPlayerStorageValue(cid, 3452)) == -1 then
     doSummonMonster(cid, monster)
     doConvinceCreature(cid)
     setPlayerStorageValue(cid,3452,1)
     end
        end
      end

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

    4 participantes

    9problema con script Empty Re: problema con script Mar Mar 22, 2022 2:42 pm

    akane

    akane
    Miembro
    Miembro
    ayer pude solucionar lo del summon del orc, solo que no pude hacer funcionar el comando para que me dé la misión, lo de mas ya lo solucioné (como ponerle storage para actualizar el quest log, el storage de la quest, etc)

    4 participantes

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