samuel157
/root
- Joined
- Mar 19, 2010
- Messages
- 518
- Solutions
- 3
- Reaction score
- 71
- Location
- São Paulo, Brazil
- GitHub
- Samuel10M
THIS WILL GIVE AN UPGRADE ID: 10559
You see a spooky blue eye.
It weighs 0.86 oz.
(Used to upgrade Life Leech and Mana Leech).
CAN SOMEONE COMPILE THIS SYSTEM FOR ME OR SHOW ME A TUTORIAL PLEASE?
I did it
but it doesn't work if anyone can help me I would appreciate it I used data/action/creaturescript instead of source
You see a spooky blue eye.
It weighs 0.86 oz.
(Used to upgrade Life Leech and Mana Leech).
CAN SOMEONE COMPILE THIS SYSTEM FOR ME OR SHOW ME A TUTORIAL PLEASE?
I did it
but it doesn't work if anyone can help me I would appreciate it I used data/action/creaturescript instead of source
LUA:
local UPGRADE_ITEM_ID = 5902 -- O item de upgrade, ex: "spooky blue eye"
local LIFE_LEECH_INCREMENT = 1 -- Percentual que será adicionado de Life Leech
local MANA_LEECH_INCREMENT = 1 -- Percentual que será adicionado de Mana Leech
local LEACH_WEAPON_STORAGE = 10001 -- ID do storage para verificar leech na arma
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 houver)
local currentLifeLeech = tonumber(getItemAttribute(weapon.uid, "lifeLeech")) or 0
local currentManaLeech = tonumber(getItemAttribute(weapon.uid, "manaLeech")) or 0
-- Acumula os novos valores de leech
local newLifeLeech = currentLifeLeech + LIFE_LEECH_INCREMENT
local newManaLeech = currentManaLeech + MANA_LEECH_INCREMENT
-- Aplica os novos valores de Life Leech e Mana Leech na arma
doItemSetAttribute(weapon.uid, "lifeLeech", newLifeLeech)
doItemSetAttribute(weapon.uid, "manaLeech", newManaLeech)
-- Marca a arma com o storage para indicar que tem leech
setPlayerStorageValue(cid, LEACH_WEAPON_STORAGE, 1)
-- Modifica a descrição da arma para mostrar os novos valores de leech
local description = getItemAttribute(weapon.uid, "description") or ""
description = "Esta arma agora tem " .. newLifeLeech .. "% Life Leech e " .. newManaLeech .. "% Mana Leech."
doItemSetAttribute(weapon.uid, "description", description)
-- Mensagens e efeitos
doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "Sua arma foi aprimorada! Agora ela possui " .. newLifeLeech .. "% Life Leech e " .. newManaLeech .. "% Mana Leech.")
doSendMagicEffect(getPlayerPosition(cid), CONST_ME_MAGIC_BLUE)
-- Remove o item de upgrade
doRemoveItem(item.uid, 1)
return true
end
LUA:
-- Configurações
local LEACH_WEAPON_STORAGE = 10001 -- Armazena o valor da arma com leech
local MAX_LEECH = 1000000000 -- O valor máximo que pode ser recuperado (ajuste conforme necessário)
local leechPercent = 0.01 -- 1% de life e mana leech
-- Função para aplicar o leech de vida e mana no jogador
local function applyLeechDamage(cid, damage, target)
-- Verifica se a arma do jogador tem a habilidade de leech
if getPlayerStorageValue(cid, LEACH_WEAPON_STORAGE) > 0 then
-- Aplica o life leech
local lifeLeech = math.floor(damage * leechPercent)
if lifeLeech > MAX_LEECH then
lifeLeech = MAX_LEECH -- Limita o leech de vida
end
doCreatureAddHealth(cid, lifeLeech)
-- Aplica o mana leech
local manaLeech = math.floor(damage * leechPercent)
if manaLeech > MAX_LEECH then
manaLeech = MAX_LEECH -- Limita o leech de mana
end
doPlayerAddMana(cid, manaLeech)
-- Envia o efeito mágico para mostrar o leeching
doSendMagicEffect(getCreaturePosition(cid), CONST_ME_MAGIC_BLUE)
end
end
-- Função de combate exemplo, onde o leech será aplicado
function onCombat(cid, target, damage, damageType)
-- Aplica o leech se a arma tiver a habilidade de leech
applyLeechDamage(cid, damage, target)
end
Attachments
-
[SOURCE].rar2.2 MB · Views: 3 · VirusTotal
-
Dev-C++.rar32.9 MB · Views: 4 · VirusTotal
Last edited: