• TibiaFace

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

    .
    demo menumenu

    Afiliados



    Votar:

    [NPC] error reborn npc

    Compartir:

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

    1[NPC] error reborn npc Empty [NPC] error reborn npc Vie Ene 22, 2021 8:03 pm

    MClovin

    MClovin
    Miembro
    Miembro
    Descripcion escribió: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 config = {
    --[Vocation] = ( Nova Vocation, New Outfit )
    [7] = { 8, 69},
    [19] = { 20, 164},


    }
    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, 'reborn') and getPlayerStorageValue(cid,30025) == 4 then
    selfSay('You are reborn.', cid)
    focus = 0
    talk_start = 0

    elseif msgcontains(msg, 'reborn') and getPlayerLevel(cid) < 250 and getPlayerStorageValue(cid,30025) ~= 4 then
    selfSay('Hehe, I say If you READY. You do not have 250 level.', cid)

    elseif msgcontains(msg, 'reborn') then
    selfSay('Are you sure? {yes}', cid)
    talkState[talkUser] = 2

    elseif msgcontains(msg, 'yes') and talkState[talkUser] ==2 and getPlayerLevel(cid) ~= 600 then
    local voc = config[getPlayerVocation(cid)]
    doPlayerSetVocation(cid, voc[1])
    local outfit = {lookType = voc[2]}
    doCreatureChangeOutfit(cid, outfit)
    doPlayerAddExp(cid, -(getPlayerExperience(cid)-getExperienceForLevel(1)))
    setCreatureMaxHealth(cid, getCreatureMaxHealth(cid)+100000)
    setCreatureMaxMana(cid, getCreatureMaxMana(cid)+100000)
    doCreatureAddHealth(cid, getCreatureMaxHealth(cid))
    doCreatureAddMana(cid, getCreatureMaxMana(cid))
    setPlayerStorageValue(cid,30025,4)
    talkState[talkUser] = 0

    elseif msgcontains(msg, 'yes') and getPlayerLevel(cid) ~= 250 then
    selfSay('Desculpe, ' .. getCreatureName(cid) .. '! You need level 250 to reborn.', cid)
    talkState[talkUser] = 0

    elseif msgcontains(msg, 'yes') and talkState[talkUser] == 2 then
    selfSay('Sorry, ' .. getCreatureName(cid) .. '! You must revert or transform to reborn.', cid)
    talkState[talkUser] = 0

    elseif msgcontains(msg, 'bye') and getDistanceToCreature(cid) < 4 then
    selfSay('Good bye.', cid)
    focus = 0
    talk_start = 0
    end

    return true
    end
    npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback)
    npcHandler:addModule(FocusModule:new())
    Captura del Error escribió:Imagen del error: [NPC] error reborn npc Empty
    El error radica en: Npc

    2 participantes

    2[NPC] error reborn npc Empty Re: [NPC] error reborn npc Vie Ene 22, 2021 8:29 pm

    Josens

    Josens
    Miembro
    Miembro
    Prueba con esto

    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 config = {
    --[Vocation] = ( Nova Vocation, New Outfit )
    [7] = { 8, 69},
    [19] = { 20, 164},


    }
    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, 'reborn') then
          if(getPlayerLevel(cid) ~= 250)then
             selfSay('I\'m so sorry, only levels 250 can reborn.', cid)
          elseif(getPlayerStorageValue(cid, 30020) == 1) then
             selfSay('You cannot reborn two times.', cid)
          else
             talkState[talkUser] = 2
             selfSay('Do you want to reborn your warrior?' cid)
          end
       elseif msgcontains(msg, 'yes') and talkState[talkUser] ==2 and getPlayerLevel(cid) == 250 then
          local voc = config[getPlayerVocation(cid)]
          doPlayerSetVocation(cid, voc[1])
          local outfit = {lookType = voc[2]}
          doCreatureChangeOutfit(cid, outfit)
          doPlayerAddExp(cid, -(getPlayerExperience(cid)-getExperienceForLevel(1)))
          setCreatureMaxHealth(cid, getCreatureMaxHealth(cid)+100000)
          setCreatureMaxMana(cid, getCreatureMaxMana(cid)+100000)
          doCreatureAddHealth(cid, getCreatureMaxHealth(cid))
          doCreatureAddMana(cid, getCreatureMaxMana(cid))
          setPlayerStorageValue(cid,30020,1)
          talkState[talkUser] = 0
       end

       return true
    end
    npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback)
    npcHandler:addModule(FocusModule:new())



    Very Happy Que te sirva [NPC] error reborn npc 2764
    2 participantes

    3[NPC] error reborn npc Empty Re: [NPC] error reborn npc Vie Ene 22, 2021 8:41 pm

    MClovin

    MClovin
    Miembro
    Miembro
    [NPC] error reborn npc VWkZDja

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

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