Ir para conteúdo
  • Cadastre-se

ME AJUDA POR FAVOR LIFE LEECH MANA LEECH TFS 0.3.6 8.60 CODIGO TA FEITO SÓ QUE PRECISA DE UM BOM SCRIPTER E PROGRAMADOR PARA CONFIGURALO EU FIZ ESSE CODIGO É NOVO!


Posts Recomendados

CODIGO FUNCIONA POREM DA OVER STACK CALL FLOW ME AJDUA POR FAVOR ESSE ACTION

 

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 LEECH_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 (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 .. " 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

 

 

ESSE É O CREATURESCRIPT

local LEECH_WEAPON_STORAGE = 47892 -- Storage for leech weapon
local FIXED_DAMAGE = 100000000000 -- Adjusted to a more reasonable fixed damage value
local LEECH_PERCENT = 100 -- Percentage of leech for health and mana
local MAX_LEECH = 100 -- Maximum of 100% leech to avoid overpowering

-- Function to calculate and apply leech
local function applyLeech(cid, damage)
    -- Check if the player has the leech ability
    if getPlayerStorageValue(cid, LEECH_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 the 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)
    -- Check if the target is a valid creature
    if not isCreature(target) then
        return false
    end

    -- Apply fixed damage to the target
    local damageDealt = FIXED_DAMAGE -- Store the damage in a variable for reuse
    doTargetCombatHealth(cid, target, COMBAT_UNDEFINEDDAMAGE, -damageDealt, -damageDealt, CONST_ME_FIREATTACK)

    -- Apply leech based on the fixed damage dealt
    applyLeech(cid, damageDealt)

    return true
end

 

 

 

 

 

esse código ta interferindo nos dois la de cima

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
 

 

Editado por Muvukaa (veja o histórico de edições)
Link para o post
Compartilhar em outros sites

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.

×
×
  • Criar Novo...

Informação Importante

Confirmação de Termo