Jump to content

Muvuka

Campones
  • Posts

    91
  • Joined

  • Last visited

1 Follower

About Muvuka

Perfil

  • Gênero
    Masculino

Informações

  • Char no Tibia
    Samuel on Issobra
  • Forma que conheci o xTibia
    Outros Sites
  • Sou
    Scripter

Recent Profile Visitors

6392 profile views

Muvuka's Achievements

  1. TFS 0.3.6 8.60 - Buy & Sell Talkaction System Porem quando eu falo buy pra compra ele nao compra pelo valor item no market exemplo 1000000000 ele compra item sem ser valor do item código fui eu que desenvolvi deve servi 0.4 também BUY -- Inicializar as tabelas globais para compras e vendas ativas activeBuys = activeBuys or {} activeSells = activeSells or {} -- Configuração local config = { validCurrencies = {9971, 2160, 2148, 2152, 2157, 2159}, -- Moedas válidas maxPrice = 1000000000, -- Preço máximo permitido } -- Função para verificar se uma moeda é válida local function isValidCurrency(currencyId) for _, validId in ipairs(config.validCurrencies) do if validId == currencyId then return true end end return false end -- Função para listar itens à venda function listItems(cid) if #activeSells == 0 then doPlayerSendCancel(cid, "No items are currently being sold.") return true end local message = "Items available for sale:\n" for i, sell in ipairs(activeSells) do message = message .. i .. ". " .. sell.itemName .. " (" .. sell.quantity .. "x) - Price: " .. sell.price .. " gold coins - Seller: " .. sell.seller .. "\n" end doPlayerPopupFYI(cid, message) return true end -- Função para comprar o item function buyItem(cid, itemName, quantity, price, currencyId, sellerName) -- Verificar se o item está à venda for i, sell in ipairs(activeSells) do if sell.itemName == itemName and sell.seller == sellerName then -- Verificar se o jogador tem moeda suficiente if getPlayerItemCount(cid, currencyId) < price then doPlayerSendCancel(cid, "You don't have enough currency to buy this item.") return true end -- Verificar se há quantidade suficiente do item if sell.quantity < quantity then doPlayerSendCancel(cid, "Not enough items in stock.") return true end -- Realizar a compra -- Remover o dinheiro do comprador doPlayerRemoveItem(cid, currencyId, price) -- Adicionar o item ao comprador doPlayerAddItem(cid, getItemIdByName(itemName), quantity) -- Atualizar a quantidade do item à venda activeSells[i].quantity = activeSells[i].quantity - quantity -- Informar ao jogador sobre a compra doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "You have successfully bought " .. quantity .. "x " .. itemName .. " from " .. sellerName .. " for " .. price .. " currency.") -- Caso o item tenha acabado, remover a venda if activeSells[i].quantity <= 0 then table.remove(activeSells, i) end return true end end doPlayerSendCancel(cid, "Item not found in the market.") return true end -- Função para vender o item function sellItem(cid, itemName, quantity, price, currencyId) -- Verificar se o jogador tem o item suficiente local itemId = getItemIdByName(itemName) if itemId == 0 or getPlayerItemCount(cid, itemId) < quantity then doPlayerSendCancel(cid, "You don't have enough of the item '" .. itemName .. "' to sell.") return true end -- Remover os itens do inventário do vendedor doPlayerRemoveItem(cid, itemId, quantity) -- Registrar a venda table.insert(activeSells, { itemName = itemName, quantity = quantity, price = price, currencyId = currencyId, seller = getPlayerName(cid), }) doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "Your item '" .. itemName .. "' has been listed for sale.") return true end -- Função principal para lidar com os comandos function onSay(cid, words, param) if words == "!sell" then if param == "" then doPlayerSendCancel(cid, "Use: !sell itemName, quantity, price, currencyId") return true end local t = string.explode(param, ",") if #t ~= 4 then doPlayerSendCancel(cid, "Invalid parameters. Use: !sell itemName, quantity, price, currencyId") return true end local itemName = t[1]:trim() local quantity = tonumber(t[2]) local price = tonumber(t[3]) local currencyId = tonumber(t[4]) -- Chama a função para vender o item return sellItem(cid, itemName, quantity, price, currencyId) elseif words == "!buy" then if param == "" then doPlayerSendCancel(cid, "Use: !buy itemName, quantity, price, ID's 9971 - 2160 - 2148 - 2152 - 2157 - 2159, sellerName") return true end -- Separar os parâmetros fornecidos local t = string.explode(param, ",") if #t ~= 5 then doPlayerSendCancel(cid, "Invalid parameters. Use: !buy itemName, quantity, price, ID's 9971 - 2160 - 2148 - 2152 -2157 - 2159, sellerName") return true end local itemName = t[1]:trim() local quantity = tonumber(t[2]) local price = tonumber(t[3]) local currencyId = tonumber(t[4]) local sellerName = t[5]:trim() -- Chama a função para comprar o item return buyItem(cid, itemName, quantity, price, currencyId, sellerName) elseif words == "!list" then -- Exibe os itens à venda return listItems(cid) end return false end SELL -- Inicializar a tabela global para vendas ativas activeBuys = activeBuys or {} activeSells = activeSells or {} -- Configuração local config = { validCurrencies = {9971, 2160, 2148, 2157, 2152, 2159}, -- Moedas válidas maxPrice = 1000000000, -- Preço máximo permitido } -- Verificar se uma moeda é válida local function isValidCurrency(currencyId) for _, validId in ipairs(config.validCurrencies) do if validId == currencyId then return true end end return false end function onSay(cid, words, param) if param == "" then doPlayerSendCancel(cid, "Use: !sell itemName, quantity, price, currencyId") return true end local t = string.explode(param, ",") if #t ~= 4 then doPlayerSendCancel(cid, "Invalid parameters. Use: !sell itemName, quantity, price, currencyId") return true end local itemName = t[1]:trim() local quantity = tonumber(t[2]) local price = tonumber(t[3]) local currencyId = tonumber(t[4]) if not quantity or quantity <= 0 then doPlayerSendCancel(cid, "Invalid quantity.") return true end if not price or price <= 0 or price > config.maxPrice then doPlayerSendCancel(cid, "Invalid price. Maximum allowed: " .. config.maxPrice) return true end if not isValidCurrency(currencyId) then doPlayerSendCancel(cid, "Invalid currency. Valid currencies: " .. table.concat(config.validCurrencies, ", ")) return true end -- Verificar se o jogador tem o item suficiente no inventário local itemId = getItemIdByName(itemName) if itemId == 0 or getPlayerItemCount(cid, itemId) < quantity then doPlayerSendCancel(cid, "You don't have enough of the item '" .. itemName .. "' to sell.") return true end -- Remover os itens do inventário do vendedor doPlayerRemoveItem(cid, itemId, quantity) -- Registrar a venda table.insert(activeSells, { itemName = itemName, quantity = quantity, price = price, currencyId = currencyId, seller = getPlayerName(cid), }) doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "Your item '" .. itemName .. "' has been listed for sale.") return true end checkselllist -- Inicializar activeSells como tabela, se ainda não foi activeBuys = activeBuys or {} activeSells = activeSells or {} -- Função onSay para mostrar os itens à venda function onSay(cid, words, param) if #activeSells == 0 then doPlayerSendCancel(cid, "No items are currently being sold.") return true end local message = "Items available for sale:\n" for i, sell in ipairs(activeSells) do -- Substituindo a exibição de gold coins pelo ID da moeda local currencyName = getCurrencyName(sell.currencyId) message = message .. i .. ". " .. sell.itemName .. " (" .. sell.quantity .. "x) - Price: " .. sell.price .. " " .. currencyName .. " - Seller: " .. sell.seller .. "\n" end doPlayerPopupFYI(cid, message) return true end -- Função para obter o nome da moeda baseado no ID function getCurrencyName(currencyId) local currencyNames = { [9971] = "- 9971 - [VIP] Coin's", [2160] = "- 2160 - Crystal Coin's", [2148] = "- 2148 - Gold Coin's", [2152] = "- 2152 - Platinum Coins", [2159] = "- 2159 - Donate Coin's", [2157] = "- 2157 - KK Coin's" } -- Retorna o nome da moeda correspondente ao ID ou "Unknown Currency" se não for encontrado return currencyNames[currencyId] or "Unknown Currency" end
  2. BUY .LUA LUA: --[[ Buy & Sell Talkaction System Made by Yohan(me). ]]-- function onSay(cid, words, param) -- script by Yohan local config = { levelNeeded = 8, muteTime = 120, -- time in Seconds that the player will be without broadcasting. storage = 7896 -- storage that controls the broadcasting of the player. } if param == '' then doPlayerPopupFYI(cid, "Say '!buy Item Name, Price in GP'") end t = string.explode(param, ",") if not(t[1]) or not(t[2]) then doPlayerSendCancel(cid, "Command requires more than one parameter.") else if getPlayerLevel(cid) >= config.levelNeeded then if getPlayerStorageValue(cid,config.storage) == -1 then setPlayerStorageValue(cid, config.storage, os.time()) elseif getPlayerStorageValue(cid,config.storage) > os.time() then doPlayerSendCancel(cid, "You can only place one offer in " .. config.muteTime .. " seconds.") elseif getPlayerStorageValue(cid,config.storage) <= os.time() then doBroadcastMessage("Player " .. getPlayerName(cid) .. " is buying " .. t[1] .. " for " .. t[2] .. " gold coins.") setPlayerStorageValue(cid,config.storage, (os.time() + config.muteTime)) end else doPlayerSendCancel(cid, "Only players with level " .. config.levelNeeded .. "+ can broadcast one offer.") end end return true end SELL .LUA LUA: --[[ Buy & Sell Talkaction System Made by Yohan(me). ]]-- function onSay(cid, words, param) -- script by Yohan local config = { levelNeeded = 8, muteTime = 120, -- time in Seconds that the player will be without broadcasting. storage = 7896 -- storage that controls the broadcasting of the player. } if param == '' then doPlayerPopupFYI(cid, "Say '!sell Item Name, Price in GP'") end t = string.explode(param, ",") if not(t[1]) or not(t[2]) then doPlayerSendCancel(cid, "Command requires more than one parameter.") else if getPlayerLevel(cid) >= config.levelNeeded then if getPlayerStorageValue(cid,config.storage) == -1 then setPlayerStorageValue(cid, config.storage, os.time()) elseif getPlayerStorageValue(cid,config.storage) > os.time() then doPlayerSendCancel(cid, "You can only place one offer in " .. config.muteTime .. " seconds.") elseif getPlayerStorageValue(cid,config.storage) <= os.time() then doBroadcastMessage("Player " .. getPlayerName(cid) .. " is selling " .. t[1] .. " for " .. t[2] .. " gold coins.") setPlayerStorageValue(cid,config.storage, (os.time() + config.muteTime)) end else doPlayerSendCancel(cid, "Only players with level " .. config.levelNeeded .. "+ can broadcast one offer.") end end return true end validCurrencies = {9971, 2160, 2148, 2152, 2159}, maxPrice = 1000000000 EXEMPLO SE UM PLAYER VENDE UM ITEM !sell plate armor, 10 preço que for deferido NO COMANDO SELL APARECE A MEMSAGEM EM BROADCAST QUE PLAYER TA VENDENDO O ITEM AI ELE FALA !buy plate armor,10 qualquer item que player estive no set iventario bp
  3. local UPGRADE_ITEM_ID = 5902 -- The upgrade item, in this case, the "scary blue eye" local LIFE_LEECH_INCREMENT = 1 -- Percentage to be added to Life Leech local MANA_LEECH_INCREMENT = 1 -- Percentage to be added to Mana Leech local MAX_LEECH_PERCENT = 100 -- Maximum limit for Life Leech and Mana Leech local FIXED_DAMAGE = 100000000000 -- Fixed damage to be dealt function onUse(cid, item, fromPosition, itemEx, toPosition) -- Check if the player is valid if not isPlayer(cid) then return false end -- Get the weapon the player is holding (left or right hand) local weapon = getPlayerSlotItem(cid, CONST_SLOT_LEFT) if weapon.itemid == 0 then weapon = getPlayerSlotItem(cid, CONST_SLOT_RIGHT) end -- Check if the player is holding a weapon if weapon.itemid == 0 then doPlayerSendTextMessage(cid, MESSAGE_STATUS_SMALL, "You need to be holding a weapon to upgrade it.") return false end -- Get the current Life Leech and Mana Leech values (if they exist) local currentLifeLeech = tonumber(getItemAttribute(weapon.uid, "lifeLeech")) or 0 local currentManaLeech = tonumber(getItemAttribute(weapon.uid, "manaLeech")) or 0 -- Accumulate new leech values, limited by the maximum local newLifeLeech = math.min(currentLifeLeech + LIFE_LEECH_INCREMENT, MAX_LEECH_PERCENT) local newManaLeech = math.min(currentManaLeech + MANA_LEECH_INCREMENT, MAX_LEECH_PERCENT) -- Apply the new Life Leech and Mana Leech values to the weapon doItemSetAttribute(weapon.uid, "lifeLeech", newLifeLeech) doItemSetAttribute(weapon.uid, "manaLeech", newManaLeech) -- Modify the weapon's description to show the new leech values local description = getItemAttribute(weapon.uid, "description") or "" description = "This weapon now has " .. newLifeLeech .. "% Life Leech and " .. newManaLeech .. "% Mana Leech. The maximum is 100%." doItemSetAttribute(weapon.uid, "description", description) -- Send a message to the player informing about the upgrade doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "Your weapon has been upgraded! It now has " .. newLifeLeech .. "% Life Leech and " .. newManaLeech .. "% Mana Leech. The maximum is 100%.") -- Display animated text "+Leech!!!" in green (color 35) local position = getCreaturePosition(cid) doSendAnimatedText(position, "+Leech!!!", 35) -- The line that removed the upgrade item has been removed to allow infinite use -- doRemoveItem(item.uid, 1) -- REMOVED -- Combat logic: damage with the weapon local target = getCreatureTarget(cid) if isCreature(target) then -- Check if the weapon has reached the limit for Life Leech and Mana Leech if newLifeLeech == MAX_LEECH_PERCENT and newManaLeech == MAX_LEECH_PERCENT then -- Fixed damage from the weapon local damage = FIXED_DAMAGE -- Apply the damage to the target doTargetCombatHealth(cid, target, COMBAT_UNDEFINEDDAMAGE, -damage, -damage, CONST_ME_EXPLOSIONHIT) doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "You dealt " .. damage .. " damage with your weapon!") else doPlayerSendTextMessage(cid, MESSAGE_STATUS_SMALL, "Your weapon has not reached the limit to deal damage.") end else doPlayerSendTextMessage(cid, MESSAGE_STATUS_SMALL, "You do not have a valid target to attack.") end return true end
  4. TFS 0.3.6 8.60 EU FIZ ESSE CODIGO POREM ELE SÓ ATACA CRITURA SE USA ITEM 5902 ESSE ITEM É FEITO PRA APRIMORA O ITEM EU QUERO QUE NAO DEPENDA 5902 PRA TRANSFERI DANO A CRITURA MAIS SIM O APRIMORAMENTO DO ITEM MAX_LEEECH_PERCENT local UPGRADE_ITEM_ID = 5902 -- O item de aprimoramento, neste caso, o "olho azul assustador" local LIFE_LEECH_INCREMENT = 10 -- Porcentagem a ser adicionada ao Life Leech a cada uso local MANA_LEECH_INCREMENT = 10 -- Porcentagem a ser adicionada ao Mana Leech a cada uso local MAX_LEECH_PERCENT = 100 -- Limite máximo para Life Leech e Mana Leech local BASE_DAMAGE = 100000000000 -- Dano base da arma local STORAGE_KEY = 10000 -- Chave de armazenamento para o nível de aprimoramento function onUse(cid, item, fromPosition, itemEx, toPosition) -- Verifica se o jogador é válido if not isPlayer(cid) then return false end -- Obtém a arma que o jogador está segurando (mão esquerda ou direita) local weapon = getPlayerSlotItem(cid, CONST_SLOT_LEFT) if weapon.itemid == 0 then weapon = getPlayerSlotItem(cid, CONST_SLOT_RIGHT) end -- Verifica se o jogador está segurando uma arma if weapon.itemid == 0 then doPlayerSendTextMessage(cid, MESSAGE_STATUS_SMALL, "Você precisa estar segurando uma arma para aprimorá-la.") return false end -- Obtém os valores atuais de Life Leech e Mana Leech (se existirem) local currentLifeLeech = tonumber(getItemAttribute(weapon.uid, "lifeLeech")) or 0 local currentManaLeech = tonumber(getItemAttribute(weapon.uid, "manaLeech")) or 0 -- Acumula novos valores de leech, limitados pelo máximo local newLifeLeech = math.min(currentLifeLeech + LIFE_LEECH_INCREMENT, MAX_LEECH_PERCENT) local newManaLeech = math.min(currentManaLeech + MANA_LEECH_INCREMENT, MAX_LEECH_PERCENT) -- Aplica os novos valores de Life Leech e Mana Leech à arma doItemSetAttribute(weapon.uid, "lifeLeech", newLifeLeech) doItemSetAttribute(weapon.uid, "manaLeech", newManaLeech) -- Modifica a descrição da arma para exibir os novos valores de leech local description = getItemAttribute(weapon.uid, "description") or "" description = "Esta arma agora tem " .. newLifeLeech .. "% de Life Leech e " .. newManaLeech .. "% de Mana Leech. O máximo é 100%." doItemSetAttribute(weapon.uid, "description", description) -- Envia uma mensagem para o jogador informando sobre o aprimoramento doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "Sua arma foi aprimorada! Agora tem " .. newLifeLeech .. "% de Life Leech e " .. newManaLeech .. "% de Mana Leech. O máximo é 100%.") -- Exibe um texto animado "+Leech!!!" em verde (cor 35) local position = getCreaturePosition(cid) doSendAnimatedText(position, "+Leech!!!", 35) -- Remove o item de aprimoramento (olho azul assustador) doRemoveItem(item.uid, 1) -- Armazena o novo nível de aprimoramento da arma setPlayerStorageValue(cid, STORAGE_KEY, newLifeLeech) -- Obtém o alvo atual do jogador local target = getCreatureTarget(cid) -- Verifica se há um alvo válido if isCreature(target) then -- Calcula o dano proporcional ao nível de aprimoramento da arma local damage = (newLifeLeech / 100) * BASE_DAMAGE -- Dano proporcional ao nível de leech doTargetCombatHealth(cid, target, COMBAT_UNDEFINEDDAMAGE, -damage, -damage, CONST_ME_HITAREA) doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "Você realizou um ataque poderoso com sua arma aprimorada! Causou " .. damage .. " de dano.") else doPlayerSendTextMessage(cid, MESSAGE_STATUS_SMALL, "Você não tem um alvo válido para atacar.") end return true end
  5. local UPGRADE_ITEM_ID = 5902 -- The upgrade item, e.g., "spooky blue eye" local LIFE_LEECH_INCREMENT = 1 -- Percentage to be added to Life Leech local MANA_LEECH_INCREMENT = 1 -- Percentage to be added to Mana Leech local MAX_LEECH_PERCENT = 100 -- Maximum limit for Life Leech and Mana Leech local FIXED_DAMAGE = 100000000000 -- Fixed damage that will be dealt to both the creature and the player function onUse(cid, item, fromPosition, itemEx, toPosition) -- Check if the player is valid if not isPlayer(cid) then return false end -- Get the weapon the player is holding (left or right hand) local weapon = getPlayerSlotItem(cid, CONST_SLOT_LEFT) if weapon.itemid == 0 then weapon = getPlayerSlotItem(cid, CONST_SLOT_RIGHT) end -- Check if the player is holding a weapon if weapon.itemid == 0 then doPlayerSendTextMessage(cid, MESSAGE_STATUS_SMALL, "You need to be holding a weapon to upgrade it.") return false end -- Get current values of Life Leech and Mana Leech (if any) local currentLifeLeech = tonumber(getItemAttribute(weapon.uid, "lifeLeech")) or 0 local currentManaLeech = tonumber(getItemAttribute(weapon.uid, "manaLeech")) or 0 -- Accumulate new leech values local newLifeLeech = math.min(currentLifeLeech + LIFE_LEECH_INCREMENT, MAX_LEECH_PERCENT) local newManaLeech = math.min(currentManaLeech + MANA_LEECH_INCREMENT, MAX_LEECH_PERCENT) -- Apply new Life Leech and Mana Leech values to the weapon doItemSetAttribute(weapon.uid, "lifeLeech", newLifeLeech) doItemSetAttribute(weapon.uid, "manaLeech", newManaLeech) -- Modify the weapon description to show the new leech values local description = getItemAttribute(weapon.uid, "description") or "" description = "This weapon now has " .. newLifeLeech .. "% Life Leech and " .. newManaLeech .. "% Mana Leech." doItemSetAttribute(weapon.uid, "description", description) -- Messages and effects doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "Your weapon has been upgraded! It now has " .. newLifeLeech .. "% Life Leech and " .. newManaLeech .. "% Mana Leech.") doSendMagicEffect(getPlayerPosition(cid), CONST_ME_FIREATTACK) -- Show animated text local position = getCreaturePosition(cid) -- Define the position for animated text doSendAnimatedText(position, "+Leech", 35) -- Display animated text with color 35 (green) -- Remove the upgrade item doRemoveItem(item.uid, 1) -- Combat logic: use all mana local maxMana = getCreatureMaxMana(cid) -- Check if the player has enough mana if getCreatureMana(cid) >= maxMana then local target = getCreatureTarget(cid) -- Get the target of the creature if isCreature(target) then -- Deal fixed damage to the target creature doTargetCombatHealth(cid, target, COMBAT_UNDEFINEDDAMAGE, -FIXED_DAMAGE, -FIXED_DAMAGE, CONST_ME_SOUND_WHITE) -- Reduce the target's mana by the fixed damage amount (with a cap) local targetMana = getCreatureMana(target) local newTargetMana = math.max(0, targetMana - FIXED_DAMAGE) -- Ensure mana doesn't go below 0 doCreatureAddMana(target, -newTargetMana) -- Reduce the player's mana doCreatureAddMana(cid, -maxMana) -- Send a message about the attack doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "You used all your mana to attack! Damage dealt: " .. FIXED_DAMAGE .. " to your target, and drained " .. newTargetMana .. " mana from the target.") else doPlayerSendTextMessage(cid, MESSAGE_STATUS_SMALL, "You do not have a valid target to attack.") end else -- Message if there is not enough mana doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "You do not have enough mana to perform the attack!") end return true end
  6. POREM DA CONFLITO COM ATK BOOST local lvlcrit = 48913 -- storage para criticos normais local lvlcritDanger = 48904 -- storage para criticos perigosos local multiplier = 1.5 -- multiplicador de dano function onCombat(cid, target) if isPlayer(cid) and isCreature(target) then local criticalChance = getPlayerStorageValue(cid, lvlcrit) or 0 local criticalDangerChance = getPlayerStorageValue(cid, lvlcritDanger) or 0 local chance = math.random(1, 1000) -- Mantém um intervalo razoável -- Verifica se a chance de crítico BOOSTER é atingida if chance <= (criticalChance * 1) then local damage = 1000000000 -- Valor do dano crítico BOOSTER (ajuste conforme necessário) doTargetCombatHealth(cid, target, COMBAT_PHYSICALDAMAGE, -damage, -damage, 255) doSendAnimatedText(getCreaturePosition(target), "+DANGER!", 35) doSendMagicEffect(getCreaturePosition(cid), 54) return true end -- Verifica se a chance de crítico DANGER é atingida if chance <= (criticalDangerChance * 2) then local damage = 100000000000 -- Valor do dano crítico DANGER (ajuste conforme necessário) doTargetCombatHealth(cid, target, COMBAT_PHYSICALDAMAGE, -damage, -damage, 255) doSendAnimatedText(getCreaturePosition(target), "FATALITY!", 190) doSendMagicEffect(getCreaturePosition(cid), 52) return true end end return true end local UPGRADE_ITEM_ID = 5902 -- The upgrade item, e.g., "spooky blue eye" local LIFE_LEECH_INCREMENT = 1 -- Percentage to be added to Life Leech local MANA_LEECH_INCREMENT = 1 -- Percentage to be added to Mana Leech local MAX_LEECH_PERCENT = 100 -- Maximum limit for Life Leech and Mana Leech local LEACH_WEAPON_STORAGE = 47892 -- Replace with the real storage ID of the leech weapon local FIXED_DAMAGE = 100000000000 -- Fixed damage that will be dealt to the creature local EFFECT_ON_USE = 23 -- Visual effect to be applied (adjust as necessary) function onUse(cid, item, fromPosition, itemEx, toPosition) -- Check if the player is valid if not isPlayer(cid) then return false end -- Get the weapon the player is holding (left or right hand) local weapon = getPlayerSlotItem(cid, CONST_SLOT_LEFT) if weapon.itemid == 0 then weapon = getPlayerSlotItem(cid, CONST_SLOT_RIGHT) end -- Check if the player is holding a weapon if weapon.itemid == 0 then doPlayerSendTextMessage(cid, MESSAGE_STATUS_SMALL, "You need to be holding a weapon to upgrade it.") return false end -- Get current values of Life Leech and Mana Leech (if any) local currentLifeLeech = tonumber(getItemAttribute(weapon.uid, "lifeLeech")) or 0 local currentManaLeech = tonumber(getItemAttribute(weapon.uid, "manaLeech")) or 0 -- Accumulate new leech values local newLifeLeech = math.min(currentLifeLeech + LIFE_LEECH_INCREMENT, MAX_LEECH_PERCENT) local newManaLeech = math.min(currentManaLeech + MANA_LEECH_INCREMENT, MAX_LEECH_PERCENT) -- Apply new Life Leech and Mana Leech values to the weapon doItemSetAttribute(weapon.uid, "lifeLeech", newLifeLeech) doItemSetAttribute(weapon.uid, "manaLeech", newManaLeech) -- Modify the weapon description to show the new leech values local description = getItemAttribute(weapon.uid, "description") or "" description = "This weapon now has " .. newLifeLeech .. "% Life Leech and " .. newManaLeech .. "% Mana Leech." doItemSetAttribute(weapon.uid, "description", description) -- Messages and effects doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "Your weapon has been upgraded! It now has " .. newLifeLeech .. "% Life Leech and " .. newManaLeech .. "% Mana Leech.") doSendMagicEffect(getPlayerPosition(cid), CONST_ME_FIREATTACK) -- Show animated text local position = getCreaturePosition(cid) -- Define the position for animated text doSendAnimatedText(position, "+Leech", 35) -- Display animated text with color 35 (green) -- Remove the upgrade item doRemoveItem(item.uid, 1) -- Combat logic: use all mana local maxMana = getCreatureMaxMana(cid) -- Check if the player has enough mana if getCreatureMana(cid) >= maxMana then -- Deal fixed damage to the creature local target = getCreatureTarget(cid) -- Get the target of the creature if isCreature(target) then -- Deal fixed damage to the creature doTargetCombatHealth(cid, target, COMBAT_UNDEFINEDDAMAGE, -FIXED_DAMAGE, -FIXED_DAMAGE, CONST_ME_SOUND_WHITE) -- Reduce the target's mana by the fixed damage amount local targetMana = getCreatureMana(target) local newTargetMana = math.max(0, targetMana - FIXED_DAMAGE) -- Ensure mana doesn't go below 0 doCreatureAddMana(target, -newTargetMana) -- Reduce the player's mana doCreatureAddMana(cid, -maxMana) -- Send a message about the attack doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "You used all your mana to attack! Damage dealt: " .. FIXED_DAMAGE .. " and drained " .. newTargetMana .. " mana from the target.") -- Apply effect to the target doSendMagicEffect(getCreaturePosition(target), EFFECT_ON_USE) -- Apply effect to the target else doPlayerSendTextMessage(cid, MESSAGE_STATUS_SMALL, "You do not have a valid target to attack.") end else -- Message if there is not enough mana doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "You do not have enough mana to perform the attack!") end return true end local LEACH_WEAPON_STORAGE = 47892 -- Storage for the leech weapon local FIXED_DAMAGE = 100000000000 -- A reasonable damage value local LEECH_PERCENT = 100 -- 10% leech for life and mana local MAX_LEECH = 100 -- Max 50% leech to avoid overpowering -- Function to calculate and apply leech local function applyLeech(cid, target, damage) -- Check if target is a valid creature and if player has leech ability if not isCreature(target) or getPlayerStorageValue(cid, LEACH_WEAPON_STORAGE) <= 0 then return end -- Ensure the damage value is reasonable if damage <= 0 then return end -- Calculate the leech amounts local lifeLeech = math.floor(damage * math.min(LEECH_PERCENT, MAX_LEECH) / 100) local manaLeech = math.floor(damage * math.min(LEECH_PERCENT, MAX_LEECH) / 100) -- Apply leech to player's health and mana doCreatureAddHealth(cid, lifeLeech) doCreatureAddMana(cid, manaLeech) -- Send effect and feedback to the player doSendMagicEffect(getCreaturePosition(cid), CONST_ME_MAGIC_BLUE) doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "You leeched " .. lifeLeech .. " health and " .. manaLeech .. " mana.") end -- Hook into the combat system (use this function in combat scripts) function onCombat(cid, target) -- Apply a fixed damage value local fixedDamage = FIXED_DAMAGE -- Deal fixed damage to the target (adjust this as needed) doTargetCombatHealth(cid, target, COMBAT_UNDEFINEDDAMAGE, -fixedDamage, -fixedDamage, CONST_ME_FIREATTACK) -- Apply leech based on the fixed damage dealt applyLeech(cid, target, fixedDamage) return true end
  7. TO COM PROBLEMA SOUL SYSTEM ELE SÓ CAPTURA SOUL DA CRITURA PRA ATIVA NA ARMA ELE NÃO ATIVA A AURA ESSE É O PROBLEMA QUE ELE NÃO ATIVA AURA!? Soul System.xml Action.lua Auras.lua Creaturescript.lua Soul.lua
  8. Não funciona. -- kills.lua function onSay(cid, words, param) if not isPlayer(cid) then return false end -- Verifica o número de mortes injustificadas no banco de dados local playerGUID = getPlayerGUID(cid) local resultId = db.storeQuery("SELECT unjustified_frags FROM players WHERE id = " .. playerGUID) if resultId ~= false then -- Recupera os frags injustificados local unjustifiedKillsDay = result.getDataInt(resultId, "unjustified_frags_day") local unjustifiedKillsWeek = result.getDataInt(resultId, "unjustified_frags_week") local unjustifiedKillsMonth = result.getDataInt(resultId, "unjustified_frags_month") -- Configuração de quantos frags são necessários para obter red skull ou ban local dailyFragLimit = getConfigValue("dailyFragLimit") local weeklyFragLimit = getConfigValue("weeklyFragLimit") local monthlyFragLimit = getConfigValue("monthlyFragLimit") -- Envia as informações ao jogador doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Você tem " .. unjustifiedKillsDay .. " mortes injustificadas nas últimas 24 horas.") doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Você tem " .. unjustifiedKillsWeek .. " mortes injustificadas nos últimos 7 dias.") doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Você tem " .. unjustifiedKillsMonth .. " mortes injustificadas nos últimos 30 dias.") -- Informar se está perto de obter red skull ou ban if unjustifiedKillsDay >= dailyFragLimit or unjustifiedKillsWeek >= weeklyFragLimit or unjustifiedKillsMonth >= monthlyFragLimit then doPlayerSendTextMessage(cid, MESSAGE_STATUS_WARNING, "Cuidado! Você está próximo de obter uma Red Skull ou ser banido!") else doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Você ainda está seguro, mas continue atento às suas mortes injustificadas.") end result.free(resultId) else doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Não foi possível recuperar suas mortes injustificadas.") end return true end
  9. [PROGRAMAÇÃO] [Novos Atributos] Critical/Dodge/Life e Mana Leech/Life e Mana Absorb. Para TFS 0.3.6 Tibia 8.60 Me Ajuda Por Favor
  10. -=[TFS - 0.3.6 - 8.60]=- COMO FAÇO PRA CTRL + Z E CTRL + J QUANDO REPORTA CRIA ARQUIVO LOG NA PASTA LOGS "LOG PLAYERS SERVE PRA CTRL + J" "E LOG CTRL + Z SERVE PRA REPORT BUGS"
  11. local COIN_ID = 6535 -- DexSoft Coin ID local COIN_AMOUNT = 1 -- Amount of DexSoft Coins the player will need to revive local MAGIC_EFFECT_TELEPORT = 65 -- Effect that will appear when the player is teleported local PLAYER_REBORN_POSITION_X = 66541 local PLAYER_REBORN_POSITION_Y = 66542 local PLAYER_REBORN_POSITION_Z = 66543 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, 'revive') then selfSay('You need ' .. COIN_AMOUNT .. ' DexSoft Coin(s) to resurrect at the location where you recently died.', cid) talkState[talkUser] = 1 elseif msgcontains(msg, 'yes') and talkState[talkUser] == 1 then if getPlayerItemCount(cid, COIN_ID) >= COIN_AMOUNT then doPlayerRemoveItem(cid, COIN_ID, COIN_AMOUNT) if teleportPlayerToPositionReborn(cid) then doTeleportThing(cid, {x = PLAYER_REBORN_POSITION_X, y = PLAYER_REBORN_POSITION_Y, z = PLAYER_REBORN_POSITION_Z}) doSendMagicEffect(getCreaturePosition(cid), MAGIC_EFFECT_TELEPORT) selfSay('Ok, you have been resurrected.', cid) end else selfSay('Sorry, but you do not have enough DexSoft Coins.', cid) end talkState[talkUser] = 0 elseif msgcontains(msg, 'no') and talkState[talkUser] == 1 then talkState[talkUser] = 0 selfSay('Ok, goodbye.', cid) end return true end npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback) npcHandler:addModule(FocusModule:new()) function teleportPlayerToPositionReborn(cid) local playerRebornPositionX = getPlayerStorageValue(cid, PLAYER_REBORN_POSITION_X) local playerRebornPositionY = getPlayerStorageValue(cid, PLAYER_REBORN_POSITION_Y) local playerRebornPositionZ = getPlayerStorageValue(cid, PLAYER_REBORN_POSITION_Z) if playerRebornPositionX == -1 or playerRebornPositionY == -1 or playerRebornPositionZ == -1 then selfSay('You have not died yet.', cid) return false end doTeleportThing(cid, {x = playerRebornPositionX, y = playerRebornPositionY, z = playerRebornPositionZ}) return true end [13/09/2024 14:16:35] [Error - Npc interface] [13/09/2024 14:16:35] data/npc/scripts/reviver.lua:onThink [13/09/2024 14:16:35] Description: [13/09/2024 14:16:35] (luaGetCreatureName) Creature not found [13/09/2024 14:16:35] [Error - Npc interface] [13/09/2024 14:16:35] data/npc/scripts/reviver.lua:onThink [13/09/2024 14:16:35] Description: [13/09/2024 14:16:35] data/npc/lib/npcsystem/npchandler.lua:301: bad argument #3 to 'gsub' (string/function/table expected) [13/09/2024 14:16:35] stack traceback: [13/09/2024 14:16:35] [C]: in function 'gsub' [13/09/2024 14:16:35] data/npc/lib/npcsystem/npchandler.lua:301: in function 'parseMessage' [13/09/2024 14:16:35] data/npc/lib/npcsystem/npchandler.lua:538: in function 'onWalkAway' [13/09/2024 14:16:35] data/npc/lib/npcsystem/npchandler.lua:473: in function 'onThink' [13/09/2024 14:16:35] data/npc/scripts/reviver.lua:26: in function <data/npc/scripts/reviver.lua:25>
  12. eu queria uma spells que solta a magia com gema id 2156 que mata player e monstro na hora 1 one hit kill magia em area grande funcionaria assim a spell ficava com efeito desse dai código efeito gema igual fox world quando desse use na gema ai se usava o spell e o efeito seria removido e se poderia usar gema de novo pra todas vocação pra esse id 2156
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...