• TibiaFace

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

    .
    demo menumenu

    Afiliados



    Votar:

    [NPC] como hago para que un npc me pida ir con summon

    Compartir:

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

    akane

    akane
    Miembro
    Miembro
    Descripcion escribió:hola a todos, como puedo hacer que un npc me pida ir con 3 summons para reportar una mision? y que si me falta uno de los summons no pueda reportarla y me actualice el questlog

    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, "i bring a wounded soldier")) then
             if(player:getStorageValue(12115) == 3) then
                npcHandler:say("what happened?.", cid)
                npcHandler.topic[cid] = 1
          else
                npcHandler:say("Primero habla con el npc.", cid)
          end
          elseif(msgcontains(msg, "a group of bandits attacked your soldiers")) then
             if(npcHandler.topic[cid] == 1) then
                npcHandler:say("It can't be... I need you to report directly to the king. I will give you this letter, you must show it to the guard so that he will let you enter the city... I would go myself but I cannot leave my post, much less now that we may be in serious danger", cid)
                npcHandler.topic[cid] = 0
             if(getPlayerStorageValue(cid, 205) < 1) then
                setPlayerStorageValue(cid, 205, 1)
                local letter = doPlayerAddItem(cid, 1952, 1)
                doItemSetAttribute(letter, "description", "Given to " .. getPlayerName(cid) .. " by order of the orc commander.")
                Player(cid):setStorageValue(12116, Player(cid):getStorageValue(12116) + 1) -- The Inquisition Questlog- "Mission 1: Interrogation"
                doSendMagicEffect(getCreaturePosition(cid), CONST_ME_HOLYAREA)
                end
             end
             elseif(msgcontains(msg, "i am already equipped")) then
                if(player:getStorageValue(12117) == 5) then
                   npcHandler:say("I see that you already have everything you need. Are you ready for what's coming?.", cid)
                   npcHandler.topic[cid] = 1
                else
                   npcHandler:say("Primero habla con el npc.", cid)
                end
             elseif(msgcontains(msg, "im ready")) then
                if(npcHandler.topic[cid] == 1) then
                   npcHandler:say({
                   "Okey. Listen ...",
                   "We don't know how the situation is out there, so you will go with 3 of our soldiers. I need you to check the entire perimeter and look for any survivors. ...",
                   "I will gather more soldiers and we will take another route, so we will attack them by surprise. Try not to do anything risky, okay?. ..."
                   }, cid)                          
                   npcHandler.topic[cid] = 0
                   player:setStorageValue(cid, 205, 2)
                   player:setStorageValue(12118, 1) -- The Inquisition Questlog- "Mission 4: A Mysterious Hero is Born"
                   for x = 1, 1 do
                   m = doSummonCreature("Orc Soldier", getThingPos(cid))
                   m = doSummonCreature("Orc Soldier", getThingPos(cid))
                   m = doSummonCreature("Orc Soldier", getThingPos(cid))
                   doConvinceCreature(cid, m)
                   player:getPosition():sendMagicEffect(CONST_ME_HOLYAREA)
                   doSendMagicEffect(getCreaturePosition(cid), CONST_ME_HOLYAREA)
                end
             end
             elseif(msgcontains(msg, "i bring prisioners")) then
                if(player:getStorageValue(12118) == 8) then
                   npcHandler:say("have the prisioners?.", cid)
                   npcHandler.topic[cid] = 1
                else
                   npcHandler:say("Primero habla con el npc.", cid)
                end
             elseif(msgcontains(msg, "yes")) then
                if(npcHandler.topic[cid] == 1) then
                   npcHandler:say("This is amazing.", cid)
                   npcHandler.topic[cid] = 0
                   player:setStorageValue(cid, 205, 3)
                   m = doRemoveCreature("Orc Prisioner", cid, m)
                   m = doRemoveCreature("Orc Prisioner 2", cid, m)
                   m = doRemoveCreature("Orc Prisioner 3", cid, m)
                   m = doRemoveCreature("Orc Prisioner 4", cid, m)
                end
                   player:setStorageValue(12118, 9) -- The Inquisition Questlog- "Mission 3: Desperate Moments"
                   player:getPosition():sendMagicEffect(CONST_ME_HOLYAREA)
       end
       return true
    end
       
    npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback)
    npcHandler:addModule(FocusModule:new())

    de momento me quita todos los orc prisioners esten vivos o no
    Imagen Explicativa escribió:Imagen Explicativa: [NPC] como hago para que un npc me pida ir con summon Tibiaf10
    Version del Scripts: OTx Old Version(0.3.7)

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