Postado Outubro 13, 2019 5 anos Uso TFS 0.3.7 Gostaria que alguém esboçasse uma função que da roubo de vida para os knights para cada ataque physical que ele desfira
Postado Novembro 27, 2019 5 anos Nao sei se era isso que vc queria, testado em 0.3.6 Spells/scripts/attack/vampiric touch.lua local combat = createCombatObject() local config = { spellName = "Vampiric Touch", -- NOME DA SPELL. NAO SAO AS PALAVRAS QUE VC VAI USAR PRA CASTAR. storage = 1401, timeStorage = 1402, cooldown = 240, -- COLDOWN DA MAGIA, PARA SER CASTADA DNV skillTime = 180, -- O TEMPO QUE A MAGIA VAI FICAR ATIVA } function onCastSpell(cid, var) if not exhaustion.get(cid, config.storage) then exhaustion.set(cid, config.storage, config.cooldown) exhaustion.set(cid, config.timeStorage, config.skillTime) doSendMagicEffect(getPlayerPosition(cid), CONST_ME_MAGIC_RED) doCreatureSay(cid, "VAMPIRIC TOUCH!", TALKTYPE_ORANGE_1) else doPlayerSendCancel(cid, config.spellName .. " is still on " .. exhaustion.get(cid, config.storage) .. " seconds cooldown!") doSendMagicEffect(getPlayerPosition(cid), CONST_ME_POFF) return false end doCombat(cid, combat, var) return true end Spells/spells.xml <instant name="Vampiric touch" words="utori con" lvl="75" mana="320" prem="1" selftarget="1" exhaustion="1000" needlearn="0" event="script" value="attack/vampiric touch.lua"> <vocation id="3"/> <vocation id="4"/> <vocation id="7"/> <vocation id="8"/> </instant> AQUI SIM VC CONFIGURA OQUE O PLAYER IRA DIZER PARA USAR A MAGIA EM "words" Creaturescripts/scripts/vampiric touch.lua local config = { spellName = "Vampiric Touch", storage = 1401, timeStorage = 1402, lifeStealPercent = 50, -- Porcentagem de dano que voce da, voce ira receber em life. } function onStatsChange(cid, attacker, type, combat, value) if type == COMBAT_PHYSICALDAMAGE then if exhaustion.get(attacker, config.storage) then doCreatureAddHealth(attacker, math.ceil(value * (config.lifeStealPercent / 100))) doSendMagicEffect(getPlayerPosition(cid), CONST_ME_MAGIC_RED) doSendMagicEffect(getPlayerPosition(attacker), CONST_ME_MAGIC_RED) doSendAnimatedText(getPlayerPosition(attacker), "+" .. math.ceil(value * (config.lifeStealPercent / 100)) .. " HP", TEXTCOLOR_RED) doPlayerSendTextMessage(attacker, MESSAGE_STATUS_DEFAULT, "You stole " .. math.ceil(value * (config.lifeStealPercent / 100)) .. " health from " .. getPlayerName(cid) .. "\n" .. config.spellName .. " will last for " .. exhaustion.get(attacker, config.timeStorage) .. " seconds more.") end end return true end Creaturescripts/creaturescripts.xml <event type="statschange" name="vampiricTouch" event="script" value="vampiric touch.lua"/> Creaturescripts/scripts/login.lua registerCreatureEvent(cid, "vampiricTouch")
Postado Dezembro 1, 2019 5 anos @GabrielSv Testei no meu 8.6 ts 0.4 nao mostra erro nenhum na distro, o roubo de vida so nao é aplicado
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.