Ir para conteúdo

Featured Replies

Postado

oi gente eu gostaria da ajuda de vocês, sera que podem me ajudar??

primeiramente o script esta funcionando perfeitamente porem eu gostaria mudar algumas coias nele primeiro gostaria de mover o botão Craft pra dentro do botão Details
e também gostaria que ficasse gravado no item uma descrição dizendo quem foi que comprou o item
eu tentei editar essa linha de todas as formas (self:addItem(config.system[lastChoice].items[choice.id].itemID)

adicionei essa linha abaixo e tambem para colocar a descrição mas não funcionou

doItemSetAttribute(item, "description", "Item comprado por " .. getCreatureName(player))

nada de ficar gravado  a mensagem


script em si

Spoiler

-- Main Crafting Window -- This is the modal window that is displayed first
function Player:sendMainCraftWindow(config)
    local function buttonCallback(button, choice)
 
    -- Modal Window Functionallity
        if button.text == "Select" then
            self:sendVocCraftWindow(config, choice.id)
        end
    end
   
    -- Modal window design
    local window = ModalWindow {
        title = config.mainTitleMsg, -- Title of the main craft modal window
        message = config.mainMsg.."\n\n" -- Message of the main craft modal window
    }
 
    -- Add buttons to the window (Note: if you change the names of these you must change the functions in the modal window functionallity!)
    window:addButton("Select", buttonCallback)
    window:addButton("Exit", buttonCallback)
   
    -- Add choices from the action script
    for i = 1, #config.system do
        window:addChoice(config.system.vocation)
    end
 
    -- Set what button is pressed when the player presses enter or escape.
    window:setDefaultEnterButton("Select")
    window:setDefaultEscapeButton("Exit")
   
    -- Send the window to player
    window:sendToPlayer(self)
end
-- End of the first modal window
 
 
 
-- This is the modal window that displays all avalible items for the chosen vocation.
function Player:sendVocCraftWindow(config, lastChoice)
    local function buttonCallback(button, choice)  
 
-- Modal Window Functionallity
        -- If the user presses the back button they will be redirected to the main window.
        if button.text == "Back" then
            self:sendMainCraftWindow(config)
        end
        -- If the user presses the details button they will be redirected to a text window with information about the item they want to craft.
        if button.text == "Details" then
        local item = config.system[lastChoice].items[choice.id].item
        local details = "In order to craft "..item.." you must collect the following items.\n\nRequired Items:"
 
            for i = 1, #config.system[lastChoice].items[choice.id].reqItems do
            local reqItems = config.system[lastChoice].items[choice.id].reqItems.item
            local reqItemsCount = config.system[lastChoice].items[choice.id].reqItems.count
            local reqItemsOnPlayer = self:getItemCount(config.system[lastChoice].items[choice.id].reqItems.item)
                details = details.."\n- "..capAll(getItemName(reqItems).." ["..reqItemsOnPlayer.."/"..reqItemsCount.."]")
            end
       
            self:showTextDialog(item, details)
            self:sendVocCraftWindow(config, lastChoice)
        end
       
        -- if the player presses the craft button then begin checks.
        if button.text == "Craft" then
       
            -- Check if player has required items to craft the item. If they dont send needItems message.
            for i = 1, #config.system[lastChoice].items[choice.id].reqItems do
                if self:getItemCount(config.system[lastChoice].items[choice.id].reqItems.item) < config.system[lastChoice].items[choice.id].reqItems.count then
                    self:say(config.needItems..config.system[lastChoice].items[choice.id].item, TALKTYPE_MONSTER_SAY)
                    return false
                end
            end
            -- Remove the required items and there count from the player.
            for i = 1, #config.system[lastChoice].items[choice.id].reqItems do
                self:removeItem(config.system[lastChoice].items[choice.id].reqItems.item, config.system[lastChoice].items[choice.id].reqItems.count)
            end            
        -- Send effect and give player item.
        self:addItem(config.system[lastChoice].items[choice.id].itemID)
        self:getPosition():sendMagicEffect(CONST_ME_FIREATTACK)
        end
    end
 
    -- Modal window design
    local window = ModalWindow {
        title = config.craftTitle..config.system[lastChoice].vocation, -- The title of the vocation specific window
        message = config.craftMsg..config.system[lastChoice].vocation..".\n\n", -- The message of the vocation specific window
    }
   
    -- Add buttons to the window (Note: if you change the names of these you must change the functions in the modal window functionallity!)
    window:addButton("Back", buttonCallback)
    window:addButton("Exit")
    window:addButton("Details", buttonCallback)
    window:addButton("Craft", buttonCallback)
   
    -- Set what button is pressed when the player presses enter or escape
    window:setDefaultEnterButton("Craft")
    window:setDefaultEscapeButton("Exit")
   
    -- Add choices from the action script
    for i = 1, #config.system[lastChoice].items do
        window:addChoice(config.system[lastChoice].items.item)
    end
   
    -- Send the window to player
    window:sendToPlayer(self)
end

 @Vodkartpode dar uma olhada por gentileza? 

Editado por wevertonvrb (veja o histórico de edições)

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

Quem Está Navegando 0

  • Nenhum usuário registrado visualizando esta página.

Conteúdo Similar

Estatísticas dos Fóruns

  • Tópicos 96.9k
  • Posts 519.6k

Informação Importante

Confirmação de Termo