Postado Agosto 13, 2020 4 anos Este é um post popular. Fiz essa spell a pedido de um usuário do fórum e logo depois outro usuário pediu uma versão onde o target do player afetado pela magia ficasse bloqueado por um tempo configurável, gostei da ideia e decidi postar em forma de tópico. Primeiro de tudo você vai precisar dessa função feita/disponibilizada pelo @WooX (não se esqueçam de passar no tópico dele e agradecer) Em data/spells.xml adicione <instant name="Cancel Enemy Target" words="Cancel Enemy Target" lvl="12" mana="20" range="3" blockwalls="1" needtarget="1" exhaustion="2000" needlearn="0" event="script" value="canceltargetlurk.lua"> <vocation id="1"/> <vocation id="2"/> </instant> em data/spells/scripts crie um arquivo chamado canceltargetlurk.lua e coloque isso dentro --[[ Made by Moira (Lurk on TibiaKing) NÃO REMOVA OS CRÉDITOS ]]-- local storage = 234512 -- tenha certeza de estar usando um numero que ainda não esteja em uso no seu servidor local tempo = 50 -- tempo em segundos para usar a magia novamente local tempo_block = 5 -- quanto tempo o player afetado pela magia vai ficar sem poder atacar OUTRO PLAYER local templo_cannot_be_blocked = 50 -- tempo em que o target vai ficar invuneravel a spell caso já tenha sido afetado por ela local combat = createCombatObject() setCombatParam(combat, COMBAT_PARAM_TYPE, COMBAT_FIREDAMAGE) setCombatParam(combat, COMBAT_PARAM_EFFECT, CONST_ME_FIREATTACK) setCombatParam(combat, COMBAT_PARAM_DISTANCEEFFECT, CONST_ANI_FIRE) function onCastSpell(cid, var) local target = getCreatureTarget(cid) if isPlayer(target) and getPlayerStorageValue(cid, storage) < os.time() and getPlayerStorageValue(target, 234514) < os.time() then doPlayerTargetCreature(target, target) setPlayerStorageValue(target, 234513, tempo_block + os.time()) setPlayerStorageValue(target, 234514, templo_cannot_be_blocked + os.time()) setPlayerStorageValue(cid, storage, tempo + os.time()) return doCombat(cid, combat, var) elseif getPlayerStorageValue(target, 234514) > os.time() then doPlayerSendCancel(cid, "This player has been affect by this spell recently, you must wait ".. getPlayerStorageValue(target, 234514) - os.time() .." to block his attacks again.") return false elseif getPlayerStorageValue(cid, storage) > os.time() then doPlayerSendCancel(cid, "You must wait ".. getPlayerStorageValue(cid, storage) - os.time() .." seconds to use this spell again.") else doPlayerSendCancel(cid, "You may only cast this spell on players.") end return false end agora em data/creaturescripts.xml adicione <event type="attack" name="lurkBlockTarget" event="script" value="canceltargetlurk.lua"/> em data/creaturescripts/scripts crie um arquivo chamado canceltargetlurk.lua e cole isso dentro --[[ Made by Moira (Lurk on TibiaKing) NÃO REMOVA OS CRÉDITOS ]]-- function onAttack(cid, target) if getPlayerStorageValue(cid, 234513) > os.time() and isPlayer(target) then return doPlayerSendCancel(cid, "You're under effect of the cancel target spell, you must wait".. getPlayerStorageValue(cid, 234513) - os.time() .." seconds to attack again.") and false end return true end por ultimo, abre o arquivo login.lua que está na pasta data/creaturescripts/scripts e adicione isso ANTES DO ULTIMO RETURN TRUE registerCreatureEvent(cid, "lurkBlockTarget") Se você quer só E SOMENTE SÓ cancelar o target do inimigo uma unica vez, basta utilizar essa versão da spell --[[ Made by Moira (Lurk on TibiaKing) NÃO REMOVA OS CRÉDITOS ]]-- local storage = 234512 -- tenha certeza de estar usando um numero que ainda não esteja em uso no seu servidor local tempo = 50 -- tempo em segundos para usar a magia novamente local combat = createCombatObject() setCombatParam(combat, COMBAT_PARAM_TYPE, COMBAT_FIREDAMAGE) setCombatParam(combat, COMBAT_PARAM_EFFECT, CONST_ME_FIREATTACK) setCombatParam(combat, COMBAT_PARAM_DISTANCEEFFECT, CONST_ANI_FIRE) function onCastSpell(cid, var) local target = getCreatureTarget(cid) if isPlayer(target) and getPlayerStorageValue(cid, storage) < os.time() then doPlayerTargetCreature(target, target) setPlayerStorageValue(cid, storage, tempo + os.time()) return doCombat(cid, combat, var) elseif getPlayerStorageValue(cid, storage) > os.time() then doPlayerSendCancel(cid, "You must wait ".. getPlayerStorageValue(cid, storage) - os.time() .." seconds to use this spell again.") else doPlayerSendCancel(cid, "You may only cast this spell on players.") end return false end Créditos: Eu pela spell e creaturescript @WooX pela criação da função se gostou, rep+ aqui e no post do @WooX pela função : p Editado Agosto 13, 2020 4 anos por Lurk (veja o histórico de edições) Se eu te ajudei e você também quer me ajudar, faça uma doação Tfs 0.4 - Click up Tfs 0.4 - Countdown horário dos próximos eventos Tfs 0.4 - Spell que cancela o target do inimigo
Postado Agosto 13, 2020 4 anos @Lurk como ficaria uma spell em área que tira o target de todos menos de quem esta em party ou da mesma guilda ficaria legal também usar magia em área não permitir atacar quem tomar essa spell tanto durante 5 segundos quanto remover apenas 1 vez Compre seus Scripts Agora totalmente seguro e de forma rápida, aceitamos também encomendas. discord.gg/phJZeHa2k4 Projeto ATS (Naruto) Informações Abaixo Facebook Youtube Discord Tutoriais / Conteúdos Clique Aqui
Postado Agosto 13, 2020 4 anos Autor @LeoTK eu sei como não afetar quem é da guild e quem esta em party mas não sei como aplicar o efeito com magia em área teria que criar uma condition customizada, talvez um membro mais experiente do fórum possa ajudar... Se eu te ajudei e você também quer me ajudar, faça uma doação Tfs 0.4 - Click up Tfs 0.4 - Countdown horário dos próximos eventos Tfs 0.4 - Spell que cancela o target do inimigo
Postado Agosto 13, 2020 4 anos Em 13/08/2020 em 17:01, LeoTK disse: @Lurk como ficaria uma spell em área que tira o target de todos menos de quem esta em party ou da mesma guilda ficaria legal também usar magia em área não permitir atacar quem tomar essa spell tanto durante 5 segundos quanto remover apenas 1 vez Dessa forma que eu queria. a spell é um genjutsu de itachi
Postado Setembro 3, 2020 4 anos Em 13/08/2020 em 17:03, Lurk disse: eu sei como não afetar quem é da guild e quem esta em party mas não sei como aplicar o efeito com magia em área teria que criar uma condition customizada, talvez um membro mais experiente do fórum possa ajudar... Não é necessário, da pra fazer utilizando o callback onTargetCreature. Em 13/08/2020 em 17:01, LeoTK disse: como ficaria uma spell em área que tira o target de todos menos de quem esta em party ou da mesma guilda ficaria legal também usar magia em área não permitir atacar quem tomar essa spell tanto durante 5 segundos quanto remover apenas 1 vez Em 13/08/2020 em 21:30, BangxD disse: Dessa forma que eu queria. a spell é um genjutsu de itachi Fiz com base na spell "exevo gran mas vis" do Tibia, os parâmetros da spell podem ser alterados. --[[ <instant name="Remove Target" words="gtfo" lvl="55" mana="650" selftarget="1" prem="0" exhaustion="1800" needlearn="0" event="script" value="support/remove_target.lua"> <vocation id="1"/> <vocation id="5"/> </instant> ]] local config = { blockTarget = true, blockTime = 5, -- Segundos affectAllies = false, affectTargetCasterOnly = false -- Se marcado como true ira remover o target somente de quem estiver atacando o usuario da spell } local combat = createCombatObject() setCombatParam(combat, COMBAT_PARAM_TYPE, COMBAT_ENERGYDAMAGE) setCombatParam(combat, COMBAT_PARAM_EFFECT, CONST_ME_BIGCLOUDS) setAttackFormula(combat, COMBAT_FORMULA_LEVELMAGIC, 8, 5, 7, 11) function onTargetCreature(cid, target) if config.affectTargetCasterOnly and getCreatureTarget(target) ~= cid then return false end if not config.affectAllies then local partyMembers = getPartyMembers(cid) if getPlayerGuildId(cid) == getPlayerGuildId(target) or isInArray(partyMembers, target) then return false end end if config.blockTarget then setPlayerStorageValue(target, 234512, os.time() + config.blockTime) end --errors(false) doPlayerTargetCreature(target, target) --errors(true) return true end setCombatCallback(combat, CALLBACK_PARAM_TARGETCREATURE, "onTargetCreature") local area = createCombatArea(AREA_CROSS6X6) setCombatArea(combat, area) function onCastSpell(cid, var) return doCombat(cid, combat, var) end Editado Setembro 3, 2020 4 anos por WooX (veja o histórico de edições) Nós somos aquilo que fazemos repetidamente. Excelência, não é um modo de agir, mas um hábito. Aristóteles
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.