Ir para conteúdo
  • Cadastre-se

Posts Recomendados

  • 3 weeks later...
Em 04/10/2021 em 17:30, najatheus disse:

Sistema funciona da seguinte maneira, ao clicar na alavanca, vai gerar um numero de 1 a quantidade de mesa ou piso que for configurado na tabela, esse numero sera a posição do item até o ponto que o player vai receber o item, assim si o player tirar o menor numero possivel ele podera ter a sorte de receber os stacks do items, vou estar deixando um video aqui em baixo mostrando o sistema

 

tem como add um itens pro player poder girar a roleta? por ex: o player presisa de determinado item e lvl pra poder girar e se ele nao tiver aparecera uma mensagem e se ele tive ele consegue girar e os itens que presisa some do inventario dele

Link para o post
Compartilhar em outros sites
Em 29/10/2021 em 09:37, rafersiq disse:

 

tem como add um itens pro player poder girar a roleta? por ex: o player presisa de determinado item e lvl pra poder girar e se ele nao tiver aparecera uma mensagem e se ele tive ele consegue girar e os itens que presisa some do inventario dele

local configuration_table = {
    storage_pos_item = 0; -- não mexa
    level_requeriment = { -- requimento para poder girar alavanca
        min = 1;
        max = 100;
    };
    count = 0; -- não mexa
    player_to_use_item_id = 3000; -- id do item que o player precisa ter para girar a roleta
    count_gire_item = 0; -- não mexa
    bag_id = 1991; -- id da bag que o player vai receber junto com o item
    count_remove = 0; -- não mexa
    floor_id_or_table = 10449; -- id da mesa ou piso que vão ficar os item por cima
    items = {3000, 2012, 13042, 13045, 13047, 13051, 13044, 13041}; -- items da roleta que vai ser usado na roleta
    effect_item = 8; -- efeito de quando estiver gerando o item
    effect_addItem = 1;  -- efeito de qnd o player receber o item
    effect_addItem_remove = 32; -- efeito de qnd o item for pro slot do player
    effect_removeItem = 36; -- efeito de qnd for remover os item da mesa ou piso
    time_create_item = 400; -- tempo para criar um a um item na mesa ou piso
    time_calcule_pos_item = 500; -- tempo para mover o item para a proxima posição
    time_count_calcule_pos_item = 3200; -- tempo para começar a mover o item ( obs o calculo min tem que ser a quantidade de mesa que vai ter x o tempo time_create_item)
    position = { -- configuração dos movimentos e posição
        create_item = { -- posição para criar os items
            [1] = {x = 981, y = 945, z = 7};
            [2] = {x = 981, y = 946, z = 7};
            [3] = {x = 982, y = 945, z = 7};
            [4] = {x = 982, y = 946, z = 7};
            [5] = {x = 983, y = 945, z = 7};
            [6] = {x = 983, y = 946, z = 7};
            [7] = {x = 984, y = 945, z = 7};
            [8] = {x = 984, y = 946, z = 7};
        };
        roleta = { -- giros da roleta
            [1] = {            
                [1] = {x = 0, y = 1, z = 0};
                [2] = {x = 1, y = -1, z = 0};
                [3] = {x = 0, y = 1, z = 0};
                [4] = {x = 1, y = -1, z = 0};
                [5] = {x = 0, y = 1, z = 0};
                [6] = {x = 1, y = -1, z = 0};
                [7] = {x = 0, y = 1, z = 0};
                [8] = {x = 3, y = 0, z = 0};
            };
            [2] = {
                [1] = {x = 0, y = 0, z = 0};
                [2] = {x = 1, y = -1, z = 0};
                [3] = {x = 0, y = 1, z = 0};
                [4] = {x = 1, y = -1, z = 0};
                [5] = {x = 0, y = 1, z = 0};
                [6] = {x = 1, y = -1, z = 0};
                [7] = {x = 0, y = 1, z = 0};
                [8] = {x = 3, y = 0, z = 0};
            };
            [3] = {
                [1] = {x = 0, y = 0, z = 0};
                [2] = {x = 0, y = 0, z = 0};
                [3] = {x = 0, y = 1, z = 0};
                [4] = {x = 1, y = -1, z = 0};
                [5] = {x = 0, y = 1, z = 0};
                [6] = {x = 1, y = -1, z = 0};
                [7] = {x = 0, y = 1, z = 0};
                [8] = {x = 3, y = 0, z = 0};
            };
            [4] = {
                [1] = {x = 0, y = 0, z = 0};
                [2] = {x = 0, y = 0, z = 0};
                [3] = {x = 0, y = 0, z = 0};
                [4] = {x = 1, y = -1, z = 0};
                [5] = {x = 0, y = 1, z = 0};
                [6] = {x = 1, y = -1, z = 0};
                [7] = {x = 0, y = 1, z = 0};
                [8] = {x = 3, y = 0, z = 0};
            };
            [5] = {
                [1] = {x = 0, y = 0, z = 0};
                [2] = {x = 0, y = 0, z = 0};
                [3] = {x = 0, y = 0, z = 0};
                [4] = {x = 0, y = 0, z = 0};
                [5] = {x = 0, y = 1, z = 0};
                [6] = {x = 1, y = -1, z = 0};
                [7] = {x = 0, y = 1, z = 0};
                [8] = {x = 3, y = 0, z = 0};
            };
            [6] = {
                [1] = {x = 0, y = 0, z = 0};
                [2] = {x = 0, y = 0, z = 0};
                [3] = {x = 0, y = 0, z = 0};
                [4] = {x = 0, y = 0, z = 0};
                [5] = {x = 0, y = 0, z = 0};
                [6] = {x = 1, y = -1, z = 0};
                [7] = {x = 0, y = 1, z = 0};
                [8] = {x = 3, y = 0, z = 0};
            };
            [7] = {
                [1] = {x = 0, y = 0, z = 0};
                [2] = {x = 0, y = 0, z = 0};
                [3] = {x = 0, y = 0, z = 0};
                [4] = {x = 0, y = 0, z = 0};
                [5] = {x = 0, y = 0, z = 0};
                [6] = {x = 0, y = 0, z = 0};
                [7] = {x = 0, y = 1, z = 0};
                [8] = {x = 3, y = 0, z = 0};
            };
            [8] = {
                [1] = {x = 0, y = 0, z = 0};
                [2] = {x = 0, y = 0, z = 0};
                [3] = {x = 0, y = 0, z = 0};
                [4] = {x = 0, y = 0, z = 0};
                [5] = {x = 0, y = 0, z = 0};
                [6] = {x = 0, y = 0, z = 0};
                [7] = {x = 0, y = 0, z = 0};
                [8] = {x = 3, y = 0, z = 0};
            };
        }
    }
}

local function createItemPos()
    if(configuration_table.count >= #configuration_table.position.create_item)then
        configuration_table.count = 0
        return
    end

    configuration_table.count = configuration_table.count + 1

    local item = Game.createItem(configuration_table.items[math.random(1, #configuration_table.items)], 1, configuration_table.position.create_item[configuration_table.count])
    local pos_item = item:getPosition()
    pos_item:sendMagicEffect(configuration_table.effect_item)
    item:setAttribute(ITEM_ATTRIBUTE_DESCRIPTION, "Item do evento da roleta")
    addEvent(createItemPos, configuration_table.time_create_item)
end

local function removeItemPos()
    if(configuration_table.count_remove >= #configuration_table.position.create_item)then
        configuration_table.count_remove = 0
        return
    end

    configuration_table.count_remove = configuration_table.count_remove + 1

    local tile = Tile(configuration_table.position.create_item[configuration_table.count_remove])
    if not tile then
        return
    end

   local item = tile:getTopVisibleThing()
   if not item then
       return
   end

   if(item:getId() == configuration_table.floor_id_or_table)then
        return removeItemPos()
   end

   item:getPosition():sendMagicEffect(configuration_table.effect_removeItem)
   item:remove()
   removeItemPos()
end

local function addItemPlayer(player_uid)
    local player = Player(player_uid)
    if not player then
        return
    end

    local tile = Tile(configuration_table.storage_pos_item)
    if not tile then
        return
    end

    local item = tile:getTopVisibleThing()
    if not item then
        return
    end

    local player_pos = player:getPosition()
    local item_pos = item:getPosition()

    local bag = player:addItem(configuration_table.bag_id, 1, true, 1, 3)
    bag:addItem(item:getId(), item:getCount(), true, 1, 3)
    player_pos:sendMagicEffect(configuration_table.effect_addItem)
    item_pos:sendMagicEffect(configuration_table.effect_addItem_remove)
    item:remove(item:getCount())
end

local function calculePosItem(value, player_uid)
    if(configuration_table.count_gire_item >= #configuration_table.position.create_item)then
        removeItemPos()
        addItemPlayer(player_uid)
        configuration_table.count_gire_item = 0
        return nil
    end

    configuration_table.count_gire_item = configuration_table.count_gire_item + 1

    local tile = Tile(configuration_table.position.create_item[configuration_table.count_gire_item])
    if not tile then
        return nil
    end

   local item = tile:getTopVisibleThing()
   if not item then
       return nil
   end

   if(item:getId() == configuration_table.floor_id_or_table)then
       return nil
   end

   local pos = item:getPosition()
   local item_pos_x = pos.x
   local item_pos_y = pos.y
   local item_pos_z = pos.z

   local pos_ = configuration_table.position.roleta[value]

   local position = Position(item_pos_x + pos_[configuration_table.count_gire_item].x, item_pos_y + pos_[configuration_table.count_gire_item].y, item_pos_z)
   if not position then
        return nil
   end

    configuration_table.storage_pos_item = position

   item:moveTo(position)
   addEvent(calculePosItem, configuration_table.time_calcule_pos_item, value, player_uid)
end

function onUse(player, item, fromPosition, target, toPosition, isHotkey)
    if(player:getLevel() > configuration_table.level_requeriment.max)then
        return(not(player:sendTextMessage(MESSAGE_INFO_DESCR, player:getName() .. " your level(" .. player:getLevel() .. ") needs to be bigger(" .. configuration_table.level_requeriment.max .. ")")))
    end

    if(player:getLevel() < configuration_table.level_requeriment.min)then
        return(not(player:sendTextMessage(MESSAGE_INFO_DESCR, player:getName() .. " your level(" .. player:getLevel() .. ") needs to be smaller(" .. configuration_table.level_requeriment.min .. ")")))
    end

    local item_ = player:getItemById(configuration_table.player_to_use_item_id, true, -1)

    if not item_ then
        return not player:sendTextMessage(MESSAGE_INFO_DESCR, player:getName() .. " você não tem o item")
    end

    if(configuration_table.count_gire_item >= 1) or (configuration_table.count >= 1) or (configuration_table.count_remove >= 1)then
        return(not(player:sendTextMessage(MESSAGE_INFO_DESCR, player:getName() .. " wait the roulette is in action, wait for it to finish")))
    end

    local random = math.random(1, #configuration_table.position.roleta)

    item_:remove(1)

    configuration_table.storage_pos_item = 0

    createItemPos()
    addEvent(calculePosItem, configuration_table.time_count_calcule_pos_item, random, player.uid)
    Game.sendAnimatedText("Spin number will be: " .. random, player:getPosition(), math.random(1, 255))
    player:sendTextMessage(MESSAGE_INFO_DESCR, player:getName() .. " item of the day is on the rocks there")
  return true
end


Espero ter ajudado

Editado por najatheus (veja o histórico de edições)
Link para o post
Compartilhar em outros sites
  • 1 month later...

Participe da conversa

Você pode postar agora e se cadastrar mais tarde. Se você tem uma conta, faça o login para postar com sua conta.

Visitante
Responder

×   Você colou conteúdo com formatação.   Remover formatação

  Apenas 75 emojis são permitidos.

×   Seu link foi automaticamente incorporado.   Mostrar como link

×   Seu conteúdo anterior foi restaurado.   Limpar o editor

×   Não é possível colar imagens diretamente. Carregar ou inserir imagens do URL.

  • Quem Está Navegando   0 membros estão online

    Nenhum usuário registrado visualizando esta página.


  • Conteúdo Similar

    • Por PokemonXdemon
      [Quest System]
       
       
      Estava ontem analisando minha base, aonde tinha várias quests em arquivos separados.
      Então, pq não organizar tudo em apenas um arquivo exemplo:
      Então fiz esse script, meio simples mas útil para organizar tudo.
       
       
      Agora vamos entender oq precisamos fazer!
       
       Uma pequena atualização,  agora fica em um lugar separado a configuração para ficar mais  fácil modificar.
      Agora pode adicionar o boost que voce deseja no pokemon.
       
      Bem é isso.
    • Por Anderson Sacani
      Venho publicar uma alteração que eu e minha equipe fizemos no script já existente do Canary.
      O arquivo do script se chama quest_system1.lua.
      Fizemos essa alteração, porque o sistema original não entregava chave com actionid ao jogador. A chave vinha com o código 0000, ou seja, não abria nenhuma porta.
      A alteração que fizemos foi justamente para arrumar esse bug, por tanto, agora quando o quest ter uma chave com actionid dentro do baú, o jogador receberá essa mesma chave com o actionid definido.
       
      local specialQuests = { -- {x = 32752, y = 32343, z = 14} [52167] = Storage.DreamersChallenge.Reward, -- {x = 32806, y = 32230, z = 11} [52003] = Storage.PitsOfInferno.WeaponReward, -- {x = 32311, y = 32211, z = 8} [51400] = Storage.ThievesGuild.Reward, [51324] = Storage.WrathoftheEmperor.mainReward, -- {x = 32232, y = 31066, z = 7} [51715] = Storage.SvargrondArena.RewardGreenhorn, -- {x = 32232, y = 31059, z = 7} [51716] = Storage.SvargrondArena.RewardScrapper, -- {x = 32232, y = 31052, z = 7} [51717] = Storage.SvargrondArena.RewardWarlord } local questsExperience = { [3101] = 1 -- dummy values } local questLog = { [8213] = Storage.HiddenCityOfBeregar.DefaultStart } local tutorialIds = { [50080] = 5, [50082] = 6, [50084] = 10, [50086] = 11 } local hotaQuest = { 50950, 50951, 50952, 50953, 50954, 50955 } local questSystem1 = Action() function questSystem1.onUse(player, item, fromPosition, target, toPosition, isHotkey) local storage = specialQuests[item.actionid] if not storage then storage = item.uid if storage > 65535 then return false end end if storage == 23644 or storage == 24632 or storage == 14338 then player:setStorageValue(Storage.SvargrondArena.PitDoor, -1) end if player:getStorageValue(storage) > 0 and player:getAccountType() < ACCOUNT_TYPE_GOD then player:sendTextMessage(MESSAGE_EVENT_ADVANCE, 'The ' .. ItemType(item.itemid):getName() .. ' is empty.') return true end local function copyContainer(originalContainer, newContainer) for i = 0, originalContainer:getSize() - 1 do local originalItem = originalContainer:getItem(i) local newItem = Game.createItem(originalItem.itemid, originalItem.type) newItem:setActionId(originalItem:getActionId()) newItem:setAttribute(ITEM_ATTRIBUTE_DESCRIPTION, originalItem:getAttribute(ITEM_ATTRIBUTE_DESCRIPTION)) if originalItem:isContainer() then copyContainer(Container(originalItem.uid), Container(newItem.uid)) end newContainer:addItemEx(newItem) end end local items, reward = {} local size = item:isContainer() and item:getSize() or 0 if size == 0 then local actionId = item:getActionId() reward = Game.createItem(item.itemid, item.type) reward:setActionId(actionId) reward:setAttribute(ITEM_ATTRIBUTE_DESCRIPTION, item:getAttribute(ITEM_ATTRIBUTE_DESCRIPTION)) else local container = Container(item.uid) for i = 0, container:getSize() - 1 do local originalItem = container:getItem(i) local newItem = Game.createItem(originalItem.itemid, originalItem.type) newItem:setActionId(originalItem:getActionId()) newItem:setAttribute(ITEM_ATTRIBUTE_DESCRIPTION, originalItem:getAttribute(ITEM_ATTRIBUTE_DESCRIPTION)) if originalItem:isContainer() then copyContainer(Container(originalItem.uid), Container(newItem.uid)) end items[#items + 1] = newItem end if size == 1 then reward = items[1] end end local result = '' if reward then local ret = ItemType(reward.itemid) if ret:isRune() then result = ret:getArticle() .. ' ' .. ret:getName() .. ' (' .. reward.type .. ' charges)' elseif ret:isStackable() and reward:getCount() > 1 then result = reward:getCount() .. ' ' .. ret:getPluralName() elseif ret:getArticle() ~= '' then result = ret:getArticle() .. ' ' .. ret:getName() else result = ret:getName() end else if size > 20 then reward = Game.createItem(item.itemid, 1) elseif size > 8 then reward = Game.createItem(2854, 1) else reward = Game.createItem(2853, 1) end for i = 1, size do local tmp = items[i] if reward:addItemEx(tmp) ~= RETURNVALUE_NOERROR then Spdlog.warn("[questSystem1.onUse] - Could not add quest reward to container") end end local ret = ItemType(reward.itemid) result = ret:getArticle() .. ' ' .. ret:getName() end if player:addItemEx(reward) ~= RETURNVALUE_NOERROR then local weight = reward:getWeight() if player:getFreeCapacity() < weight then player:sendCancelMessage(string.format('You have found %s weighing %.2f oz. You have no capacity.', result, (weight / 100))) else player:sendCancelMessage('You have found ' .. result .. ', but you have no room to take it.') end return true end if questsExperience[storage] then player:addExperience(questsExperience[storage], true) end if questLog[storage] then player:setStorageValue(questLog[storage], 1) end if tutorialIds[storage] then player:sendTutorial(tutorialIds[storage]) if item.uid == 50080 then player:setStorageValue(Storage.RookgaardTutorialIsland.SantiagoNpcGreetStorage, 3) end end if isInArray(hotaQuest, item.uid) then if player:getStorageValue(Storage.TheAncientTombs.DefaultStart) ~= 1 then player:setStorageValue(Storage.TheAncientTombs.DefaultStart, 1) end end player:sendTextMessage(MESSAGE_EVENT_ADVANCE, 'You have found ' .. result .. '.') player:setStorageValue(storage, 1) return true end for index, value in pairs(specialQuests) do questSystem1:aid(index) end questSystem1:aid(2000) questSystem1:register()  
    • Por Anderson Sacani
      local config = { scrollId = 14758, premiumDays = 30, } local days = config.premiumDays local premiumScroll = Action() function premiumScroll.onUse(player, item, fromPosition, target, toPosition, isHotkey) player:addPremiumDays(days) player:sendTextMessage(MESSAGE_EVENT_ADVANCE, "Voce recebeu " .. days .. " dias de conta premium.") item:remove(1) addEvent(function() if player:isPlayer() then player:sendTextMessage(MESSAGE_EVENT_ADVANCE, "No total voce tem " .. player:getPremiumDays() .. " dias de conta premium.") end end, 2500) return true end premiumScroll:id(config.scrollId) premiumScroll:register() Percebi que alguns servidores estão vindo sem o script do premium scroll, então criei esse script para adicionar 30 dias de premium na conta do jogador que usar o premium scroll.
    • Por amoxicilina
      Action: Remover skull
       
       
    • Por ArielZeRah
      Salve, gostaria de ajuda com Função Outfits.gif em meu SCRIPT de Characters.PHP, Função que eu quero é seguinte vou deixar videio.gif abaixo pra mas informação!

      Vou deixar meu Characters.php
      characters.php 
       
      ABS; Acho que linha em questão pra editar é essa abaixo vou deixar em spooler!
       
×
×
  • Criar Novo...

Informação Importante

Confirmação de Termo