• TibiaFace

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

    .
    demo menumenu

    Afiliados



    Votar:

    [NPC] problema con npc y movements

    Compartir:

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

    1[NPC] problema con npc y movements Empty [NPC] problema con npc y movements Mar Mar 21, 2023 9:12 pm

    akane

    akane
    Miembro
    Miembro
    Descripcion escribió:hola a todos, estoy tratando de que al hablar con x npc me dé un storage para que me deje pasar x tile, el problema es que al parecer el npc no me está dando el storage, ya que al hablar con el npc y tratar de pasar por ese tile no me deja, como si no hubiese hablado con el npc.

    actualmente estoy ocupando tfs 0.4

    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 onPlayerEndTrade(cid) npcHandler:onPlayerEndTrade(cid) end
    function onPlayerCloseChannel(cid) npcHandler:onPlayerCloseChannel(cid) end



    local nome = "Terribilis The fourth" --


    local function greetCallback(cid)
     local msg = "What are you doing in our kingdom, you pathetic human?... Ohh I see, you want to take our relic... in that case you will have to face my terrifying power, but I warn you, if you defeat me my 3 brothers will tear you to pieces Muahahahah.... Are you ready?"
     npcHandler:say(msg,cid)
        npcHandler:addFocus(cid)
     return false
    end
    function creatureSayCallback(cid, type, msg)
     if string.lower(msg) == 'bye' or string.lower(msg) == 'xau' then
     npcHandler:resetNpc(cid)
     return false
     end
        if(not npcHandler:isFocused(cid)) then
            return false
        end
     if (msgcontains(msg, 'yes') or msgcontains(msg, 'yes')) then
     local pos = getCreaturePosition(getNpcId())
     selfSay('Then let the massacre begin... Muahaha.',cid)
     doCreatureSay(getNpcId(), "Common!!", TALKTYPE_MONSTER_YELL)
     setPlayerStorageValue(cid,55000)
     npcHandler:resetNpc(cid)
     doRemoveCreature(getNpcId())
     doCreateMonster(nome, pos)
     end
     if (msgcontains(msg, 'no') or msgcontains(msg, 'no') or msgcontains(msg, 'não')) then
     selfSay('So dont waste my time, coward.', cid)
     npcHandler:resetNpc(cid)
     return false
     end
     
     return true
    end

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

    script del tile:

    Código:
    function onStepIn(cid, item, position, fromPosition)
    local tiles = { -- Action id / Storage, Valor
    [60000] = {storage = 50000},
    }
    local t = tiles[item.actionid]

    if getPlayerStorageValue(cid, t.storage) then
    doTeleportThing(cid, fromPosition)
    doPlayerPopupFYI(cid, "You can't pass.") return true
    end
    return true
    end
    Captura del Error escribió:Imagen del error: [NPC] problema con npc y movements Empty
    El error radica en: MoveEvents

    2 participantes

    2[NPC] problema con npc y movements Empty Re: [NPC] problema con npc y movements Mar Mar 21, 2023 11:34 pm

    [Admin] God Maya

    [Admin] God Maya
    Administrador
    Administrador
    en primer lugar os storages no son los mismo e que entrega el npc y el que requiere el piso

    y segundo la funcion esta esta escrito

    if getPlayerStorageValue(cid, t.storage) then

    por

    if getPlayerStorageValue(cid, t.storage) >= 1 then



    [NPC] problema con npc y movements YNU5B25
    2 participantes
    http://www.tibiaface.com

    3[NPC] problema con npc y movements Empty Re: [NPC] problema con npc y movements Miér Mar 22, 2023 12:35 am

    akane

    akane
    Miembro
    Miembro
    entiendo, ya funcionó muchas gracias Very Happy

    2 participantes

    4[NPC] problema con npc y movements Empty Re: [NPC] problema con npc y movements Miér Mar 22, 2023 8:44 am

    [Admin] God Maya

    [Admin] God Maya
    Administrador
    Administrador
    Tema Solucionado



    [NPC] problema con npc y movements 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).