• TibiaFace

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

    .
    demo menumenu

    Afiliados



    Votar:

    [Function] Como puedo hacer que mi ot tenga sistema de prestigio?

    Compartir:

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

    INKDanger

    INKDanger
    Nuevo Miembro
    Nuevo Miembro
    Descripcion escribió:Como puedo hacer que mi ot tenga sistema de prestigio? es version 8.6
    ayuda porfavor Embarassed What a Face
    Captura del Error escribió:Imagen del error: [Function] Como puedo hacer que mi ot tenga sistema de prestigio? Empty
    La config. radica en: Otro Problema

    [Admin] God Maya

    [Admin] God Maya
    Administrador
    Administrador
    de que trata ese sistema



    [Function] Como puedo hacer que mi ot tenga sistema de prestigio? YNU5B25
    https://www.tibiaface.com

    Miguel Albertto

    Miguel Albertto
    Miembro
    Miembro
    supongo que te refieres al sistema de resets ?

    INKDanger

    INKDanger
    Nuevo Miembro
    Nuevo Miembro
    [Tienes que estar registrado y conectado para ver este vínculo] escribió:supongo que te refieres al sistema de resets ?

    Si ha eso me refiero
    sabes como puedo implementarlo a mi ot?

    [Admin] God Maya

    [Admin] God Maya
    Administrador
    Administrador
    aqui tienes el 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, 'prestige')) then
          selfSay('Are you ready to prestige and start a new life?', cid)
          talkState[talkUser] = 1
       elseif(msgcontains(msg, 'yes') and talkState[talkUser] == 1) then
          -------CONFIGS-------
          local level = 400
          local cost = 10000
          ------/CONFIGS-------
          -----LOCALS-----
          local id = getPlayerGUID(cid)
          local name = getCreatureName(cid)
          local vocation = getPlayerVocation(cid)
          local storage = getCreatureStorage(cid, 85987)
          ----/LOCALS-----
          if(getPlayerLevel(cid) >= level) then
             if(doPlayerRemoveMoney(cid, cost) == TRUE) then
                if(isInArray({5, 6, 7, 8}, vocation)) then
                   doCreatureSetStorage(cid, 85987, storage == -1 and 1 or storage + 1)
                   doRemoveCreature(cid)
                   db.executeQuery("UPDATE `players` SET `level` = 8, `experience` = 4200, `promotion` = 1 WHERE `id` ='"..id.."';")
                   db.executeQuery("UPDATE `players` SET `name` = '"..name.."' WHERE `id` ='"..id.."';")
                else
                   selfSay('Please talk with Promotion Guy and promote first.', cid)
                   talkState[talkUser] = 0
                end
             else
                selfSay('You don\'t have enough money. You need to pay 10 mil to be rebirthed.', cid)
                talkState[talkUser] = 0
             end
          else
             selfSay('Only characters of level 400 or higher can be rebirthed.', cid)
             talkState[talkUser] = 0
          end
       elseif(msgcontains(msg, 'no') and talkState[talkUser] == 1) then
          selfSay('Okey. Come back when you feel ready.', cid)
          talkState[talkUser] = 0
       end
     
       return true
    end
     
    npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback)
    npcHandler:addModule(FocusModule:new())

    y en creaturescripts/scrits creas un archivo llamado prestige.lua añades esto

    Código:

    function onLook(cid, thing, position, lookDistance)
        if isPlayer(thing.uid) and thing.uid ~= cid then
          local sex = getPlayerSex(thing.uid)
            local message = "You see " .. getPlayerName(thing.uid) .. " (Level " .. getPlayerLevel(thing.uid) .. ")."
            if(getPlayerFlagValue(thing.uid, PLAYERFLAG_SHOWGROUPINSTEADOFVOCATION)) then
                message = message .. " " .. (sex == PLAYERSEX_FEMALE and "She" or "He") .. " is a " .. getPlayerGroupName(thing.uid) .. "."
            elseif(getPlayerVocation(thing.uid) ~= 0) then
                message = message .. " " .. (sex == PLAYERSEX_FEMALE and "She" or "He") .. " is a " .. getPlayerVocationName(thing.uid):lower() .. "."
            else
                message = message .. " " .. (sex == PLAYERSEX_FEMALE and "She" or "He") .. " has no vocation."
            end
     
            if(getPlayerNameByGUID(getPlayerPartner(thing.uid), false, false) ~= nil) then
                message = message .. " " .. (sex == PLAYERSEX_FEMALE and "She" or "He") .. " is " .. (sex == PLAYERSEX_FEMALE and "wife" or "husband") .. " of " .. getPlayerNameByGUID(getPlayerPartner(thing.uid)) .. "."
            end
     
            if(getPlayerGuildId(thing.uid) > 0) then
                message = message .. " " .. (sex == PLAYERSEX_FEMALE and "She" or "He") .. " is " .. (getPlayerGuildRank(thing.uid) == "" and "a member" or getPlayerGuildRank(thing.uid)) .. " of the " .. getPlayerGuildName(thing.uid)
                message = getPlayerGuildNick(thing.uid) ~= "" and message .. " (" .. getPlayerGuildNick(thing.uid) .. ")." or message .. "."
            end
     
            if(getPlayerFlagValue(cid, PLAYERCUSTOMFLAG_CANSEECREATUREDETAILS)) then
                message = message .. "\nHealth: [" .. getCreatureHealth(thing.uid) .. " / " .. getCreatureMaxHealth(thing.uid) .. "], Mana: [" .. getCreatureMana(thing.uid) .. " / " .. getCreatureMaxMana(thing.uid) .. "]." 
            end
     
            if(getPlayerFlagValue(cid, PLAYERCUSTOMFLAG_CANSEEPOSITION)) then
                message = message .. "\nPosition: [X: " .. position.x .. "] [Y: " .. position.y .. "] [Z: " .. position.z .. "]."
            end
     
            doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, message .. (sex == PLAYERSEX_FEMALE and " \nShe" or " \nHe") .. " has prestiged " .. (getCreatureStorage(thing.uid, 85987) == -1 and "0" or getCreatureStorage(thing.uid, 85987)) .. " " .. (math.abs(getCreatureStorage(thing.uid, 85987)) == 1 and "time." or "times."))
          return false
        elseif thing.uid == cid then
            local message = "You see yourself."
            if(getPlayerFlagValue(cid, PLAYERFLAG_SHOWGROUPINSTEADOFVOCATION)) then
                message = message .. " You are " .. getPlayerGroupName(cid) .. "."
            elseif(getPlayerVocation(cid) ~= 0) then
                message = message .. " You are a " .. getPlayerVocationName(cid):lower() .. "."
            else
                message = message .. " You have no vocation."
            end
     
            if(getPlayerNameByGUID(getPlayerPartner(cid), false, false) ~= nil) then
                message = message .. " You are " .. (getPlayerSex(cid) == PLAYERSEX_FEMALE and "wife" or "husband") .. " of " .. getPlayerNameByGUID(getPlayerPartner(cid)) .. "."
            end
     
            if(getPlayerGuildId(cid) > 0) then
                message = message .. " You are " .. (getPlayerGuildRank(cid) == "" and "a member" or getPlayerGuildRank(cid)) .. " of the " .. getPlayerGuildName(cid)
                message = getPlayerGuildNick(cid) ~= "" and message .. " (" .. getPlayerGuildNick(cid) .. ")." or message .. "."
            end
     
            if(getPlayerFlagValue(cid, PLAYERCUSTOMFLAG_CANSEECREATUREDETAILS)) then
                message = message .. "\nHealth: [" .. getCreatureHealth(cid) .. " / " .. getCreatureMaxHealth(cid) .. "], Mana: [" .. getCreatureMana(cid) .. " / " .. getCreatureMaxMana(cid) .. "]."
            end
     
            if(getPlayerFlagValue(cid, PLAYERCUSTOMFLAG_CANSEEPOSITION)) then
                message = message .. "\nPosition: [X: " .. position.x .. "] [Y: " .. position.y .. "] [Z: " .. position.z .. "]."
            end
     
            return false, doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, message .. " \nYou have prestiged " .. (getCreatureStorage(cid, 85987) == -1 and "0" or getCreatureStorage(cid, 85987)) .. " " .. (getCreatureStorage(cid, 85987) == 1 and "time." or "times."))
        end
     
        return true
    end

     

    en login.lua

    Código:
    registerCreatureEvent(cid, "prestige")

    y en creaturecripts.xml

    Código:
    <event type="look" name="prestige" event="script" value="prestige.lua"/>



    [Function] Como puedo hacer que mi ot tenga sistema de prestigio? YNU5B25
    https://www.tibiaface.com

    INKDanger

    INKDanger
    Nuevo Miembro
    Nuevo Miembro
    [Tienes que estar registrado y conectado para ver este vínculo] escribió:aqui tienes el 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, 'prestige')) then
          selfSay('Are you ready to prestige and start a new life?', cid)
          talkState[talkUser] = 1
       elseif(msgcontains(msg, 'yes') and talkState[talkUser] == 1) then
          -------CONFIGS-------
          local level = 400
          local cost = 10000
          ------/CONFIGS-------
          -----LOCALS-----
          local id = getPlayerGUID(cid)
          local name = getCreatureName(cid)
          local vocation = getPlayerVocation(cid)
          local storage = getCreatureStorage(cid, 85987)
          ----/LOCALS-----
          if(getPlayerLevel(cid) >= level) then
             if(doPlayerRemoveMoney(cid, cost) == TRUE) then
                if(isInArray({5, 6, 7, 8}, vocation)) then
                   doCreatureSetStorage(cid, 85987, storage == -1 and 1 or storage + 1)
                   doRemoveCreature(cid)
                   db.executeQuery("UPDATE `players` SET `level` = 8, `experience` = 4200, `promotion` = 1 WHERE `id` ='"..id.."';")
                   db.executeQuery("UPDATE `players` SET `name` = '"..name.."' WHERE `id` ='"..id.."';")
                else
                   selfSay('Please talk with Promotion Guy and promote first.', cid)
                   talkState[talkUser] = 0
                end
             else
                selfSay('You don\'t have enough money. You need to pay 10 mil to be rebirthed.', cid)
                talkState[talkUser] = 0
             end
          else
             selfSay('Only characters of level 400 or higher can be rebirthed.', cid)
             talkState[talkUser] = 0
          end
       elseif(msgcontains(msg, 'no') and talkState[talkUser] == 1) then
          selfSay('Okey. Come back when you feel ready.', cid)
          talkState[talkUser] = 0
       end
     
       return true
    end
     
    npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback)
    npcHandler:addModule(FocusModule:new())

    y en creaturescripts/scrits creas un archivo llamado prestige.lua añades esto

    Código:

    function onLook(cid, thing, position, lookDistance)
        if isPlayer(thing.uid) and thing.uid ~= cid then
          local sex = getPlayerSex(thing.uid)
            local message = "You see " .. getPlayerName(thing.uid) .. " (Level " .. getPlayerLevel(thing.uid) .. ")."
            if(getPlayerFlagValue(thing.uid, PLAYERFLAG_SHOWGROUPINSTEADOFVOCATION)) then
                message = message .. " " .. (sex == PLAYERSEX_FEMALE and "She" or "He") .. " is a " .. getPlayerGroupName(thing.uid) .. "."
            elseif(getPlayerVocation(thing.uid) ~= 0) then
                message = message .. " " .. (sex == PLAYERSEX_FEMALE and "She" or "He") .. " is a " .. getPlayerVocationName(thing.uid):lower() .. "."
            else
                message = message .. " " .. (sex == PLAYERSEX_FEMALE and "She" or "He") .. " has no vocation."
            end
     
            if(getPlayerNameByGUID(getPlayerPartner(thing.uid), false, false) ~= nil) then
                message = message .. " " .. (sex == PLAYERSEX_FEMALE and "She" or "He") .. " is " .. (sex == PLAYERSEX_FEMALE and "wife" or "husband") .. " of " .. getPlayerNameByGUID(getPlayerPartner(thing.uid)) .. "."
            end
     
            if(getPlayerGuildId(thing.uid) > 0) then
                message = message .. " " .. (sex == PLAYERSEX_FEMALE and "She" or "He") .. " is " .. (getPlayerGuildRank(thing.uid) == "" and "a member" or getPlayerGuildRank(thing.uid)) .. " of the " .. getPlayerGuildName(thing.uid)
                message = getPlayerGuildNick(thing.uid) ~= "" and message .. " (" .. getPlayerGuildNick(thing.uid) .. ")." or message .. "."
            end
     
            if(getPlayerFlagValue(cid, PLAYERCUSTOMFLAG_CANSEECREATUREDETAILS)) then
                message = message .. "\nHealth: [" .. getCreatureHealth(thing.uid) .. " / " .. getCreatureMaxHealth(thing.uid) .. "], Mana: [" .. getCreatureMana(thing.uid) .. " / " .. getCreatureMaxMana(thing.uid) .. "]." 
            end
     
            if(getPlayerFlagValue(cid, PLAYERCUSTOMFLAG_CANSEEPOSITION)) then
                message = message .. "\nPosition: [X: " .. position.x .. "] [Y: " .. position.y .. "] [Z: " .. position.z .. "]."
            end
     
            doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, message .. (sex == PLAYERSEX_FEMALE and " \nShe" or " \nHe") .. " has prestiged " .. (getCreatureStorage(thing.uid, 85987) == -1 and "0" or getCreatureStorage(thing.uid, 85987)) .. " " .. (math.abs(getCreatureStorage(thing.uid, 85987)) == 1 and "time." or "times."))
          return false
        elseif thing.uid == cid then
            local message = "You see yourself."
            if(getPlayerFlagValue(cid, PLAYERFLAG_SHOWGROUPINSTEADOFVOCATION)) then
                message = message .. " You are " .. getPlayerGroupName(cid) .. "."
            elseif(getPlayerVocation(cid) ~= 0) then
                message = message .. " You are a " .. getPlayerVocationName(cid):lower() .. "."
            else
                message = message .. " You have no vocation."
            end
     
            if(getPlayerNameByGUID(getPlayerPartner(cid), false, false) ~= nil) then
                message = message .. " You are " .. (getPlayerSex(cid) == PLAYERSEX_FEMALE and "wife" or "husband") .. " of " .. getPlayerNameByGUID(getPlayerPartner(cid)) .. "."
            end
     
            if(getPlayerGuildId(cid) > 0) then
                message = message .. " You are " .. (getPlayerGuildRank(cid) == "" and "a member" or getPlayerGuildRank(cid)) .. " of the " .. getPlayerGuildName(cid)
                message = getPlayerGuildNick(cid) ~= "" and message .. " (" .. getPlayerGuildNick(cid) .. ")." or message .. "."
            end
     
            if(getPlayerFlagValue(cid, PLAYERCUSTOMFLAG_CANSEECREATUREDETAILS)) then
                message = message .. "\nHealth: [" .. getCreatureHealth(cid) .. " / " .. getCreatureMaxHealth(cid) .. "], Mana: [" .. getCreatureMana(cid) .. " / " .. getCreatureMaxMana(cid) .. "]."
            end
     
            if(getPlayerFlagValue(cid, PLAYERCUSTOMFLAG_CANSEEPOSITION)) then
                message = message .. "\nPosition: [X: " .. position.x .. "] [Y: " .. position.y .. "] [Z: " .. position.z .. "]."
            end
     
            return false, doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, message .. " \nYou have prestiged " .. (getCreatureStorage(cid, 85987) == -1 and "0" or getCreatureStorage(cid, 85987)) .. " " .. (getCreatureStorage(cid, 85987) == 1 and "time." or "times."))
        end
     
        return true
    end

     

    en login.lua

    Código:
    registerCreatureEvent(cid, "prestige")

    y en creaturecripts.xml

    Código:
    <event type="look" name="prestige" event="script" value="prestige.lua"/>



    Muchas Gracias God Maya lo probare para ver que sale Very Happy

    Contenido patrocinado


    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.

    Temas Recomendados×+

       

      BienvenidosTibiaFace es una comunidad de Open Tibia. Para participar debes estar registrado (click para Regístrate).