- 0
dúvida Ajuda a arrumar essas spells.
-
Quem Está Navegando 0 membros estão online
- Nenhum usuário registrado visualizando esta página.
-
Conteúdo Similar
-
- 0 respostas
- 3204 visualizações
-
- 1 resposta
- 1603 visualizações
-
- 2 respostas
- 2579 visualizações
-
- 1 resposta
- 2266 visualizações
-
- 2 respostas
- 3087 visualizações
-

Pergunta
gabriel28 60
Estou com algumas spells que estão com erro e queria a ajuda de alguém, na medida que eu por o script, digo também qual o erro dela.
Nessa script, não estou conseguindo adicionar a função de cooldown nela, sempre diz que está faltando um 'end' pra fechar a função onCastSpell.
Script:
local combat = createCombatObject() setCombatParam(combat, COMBAT_PARAM_TARGETCASTERORTOPMOST, true) setCombatParam(combat, COMBAT_PARAM_EFFECT, CONST_ME_MAGIC_RED) local time = 2 --Tempo de stun. function onCastSpell(cid) local target = getCreatureTarget(cid) if not isCreature(target) then return doPlayerSendCancel(cid, "You do not have a target.") end doCreatureSetNoMove(target, true) addEvent(function() if not isCreature(target) then return true end doCreatureSetNoMove(target, false) end, time * 1000) return true if exhaustion.check(cid, 100019) == false then exhaustion.set(cid, 100019, 60) return doCombat(cid, combat, var) else doPlayerSendCancel(cid, "Wait "..exhaustion.get(cid, 100019).." second(s) to use this spell again.") end endEssa spell é de ficar healando X porcento de vida em Y segundos. Eu conseguir por cooldown, tudo direitinho, quando usa, ela pega o cooldown e sem aquele bug que alguns tem, que faz o player não castar a magia, mas ainda assim, gasta mana. Até aqui tudo certo, o problema é que mesmo não castando, não gastando mana, depois que usa a primeira vez e ela pega o cooldown, se o player continuar a tentar usar, ela vai adicionando mais 'addEvent' de heal no player.
Ex: Ela fica healando 400 de vida no player durante 20s, se eu usar de novo, mesmo em cooldown, ela adiciona esse event de novo, se eu usar 10x, vai adicionar o evento 10x, como se tivesse acumulando a magia no player, dai em vez de healar 400 de life por rodada, heala 400x10 por rodada.
Script:
local config = { tempo = 20, -- tempo em segundos que ficará healando percent = 30, --- porcentagem da vida que cura effect = 12 --- efeito que vai sair } function onCastSpell(cid, var) for i = 1, config.tempo do addEvent(function() if isCreature(cid) then local lifedraw = math.ceil(getCreatureMaxHealth(cid) * (config.percent)/100) local pos = getPlayerPosition(cid) doCreatureAddHealth(cid, lifedraw, 1) doSendAnimatedText(pos, "+"..lifedraw , TEXTCOLOR_TEAL) doSendMagicEffect(pos, config.effect) end end, 1000*i) end if exhaustion.check(cid, 100100) == false then exhaustion.set(cid, 100100, 30) return doCombat(cid, combat, var) else doPlayerSendCancel(cid, "Wait "..exhaustion.get(cid, 100101).." second(s) to use this spell again.") end endEssa outra tem o mesmo erro da Spell de cima. Essa não heala por porcentagem, e sim, de acordo com uma formula.
Script:
local tempo = 10 local combat = createCombatObject() setCombatParam(combat, COMBAT_PARAM_EFFECT, CONST_ME_MAGIC_BLUE) setCombatParam(combat, COMBAT_PARAM_AGGRESSIVE, false) local condition = createConditionObject(CONDITION_ATTRIBUTES) setConditionParam(condition, CONDITION_PARAM_TICKS, tempo * 1000) setConditionParam(condition, CONDITION_PARAM_BUFF, true) function onCastSpell(cid, var) heal(cid) if exhaustion.check(cid, 100101) == false then exhaustion.set(cid, 100101, 30) return doCombat(cid, combat, var) else doPlayerSendCancel(cid, "Wait "..exhaustion.get(cid, 100101).." second(s) to use this spell again.") end end function heal(cid) local formula = 0.5 * getPlayerLevel(cid) for i = 1, tempo do addEvent(doCreatureAddHealth,1000 * i,cid, formula) end endEssa Spell, faz sair um effect em área, e todos que estiverem na área de ação da spell, ficam perdendo life, enquanto o player que usou, fica ganhando esse life que está sendo drenado dos players atingidos. O erro é que não está saindo o efeito, consequentemente, não está realizando as funções da spell.
Script:
local combat = createCombatObject() setCombatParam(combat, COMBAT_PARAM_TYPE, COMBAT_HEALING) setCombatParam(combat, COMBAT_PARAM_EFFECT, CONST_ME_MAGIC_BLUE) arr = { {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, {0, 0, 0, 0, 1, 1, 1, 0, 0, 0, 0}, {0, 0, 0, 1, 1, 1, 1, 1, 0, 0, 0}, {0, 0, 1, 1, 1, 1, 1, 1, 1, 0, 0}, {0, 0, 1, 1, 1, 3, 1, 1, 1, 0, 0}, {0, 0, 1, 1, 1, 1, 1, 1, 1, 0, 0}, {0, 0, 0, 1, 1, 1, 1, 1, 0, 0, 0}, {0, 0, 0, 0, 1, 1, 1, 0, 0, 0, 0}, {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, } local area = createCombatArea(arr) setCombatArea(combat, area) function spellCallbackLifeDrainArea(param) if (isPlayer(param.cid)) == 1 then if (param.hitmin == nil or param.hitmax == nil or param.healmin == nil or param.healmax == nil) then param.hitmin = math.floor(-getPlayerLevel(param.cid) * 0.1 + -getPlayerMagLevel(param.cid) * 0.1) param.hitmax = math.floor(-getPlayerLevel(param.cid) * 0.2 + -getPlayerMagLevel(param.cid) * 0.15) param.healmin = -param.hitmin param.healmax = -param.hitmax end local onPos = param.pos if param.count > 0 or math.random(0, 1) == 1 then local creatureToHit = getThingfromPos({x=onPos.x,y=onPos.y,z=onPos.z,stackpos=STACKPOS_TOP_CREATURE}) if isCreature(creatureToHit.uid) == 1 and creatureToHit.uid ~= param.cid then doCreatureAddHealth(param.cid, math.random(param.healmin, param.healmax+1)) doAreaCombatHealth(param.cid, COMBAT_LIFEDRAIN, param.pos, 0, param.hitmin, param.hitmax, CONST_ME_NONE) end end if(param.count < 30) then param.count = param.count + 1 addEvent(spellCallbackLifeDrainArea, 500, param) end end end function onTargetTileLifeDrainArea(cid, pos) local param = {} param.cid = cid param.pos = pos param.count = 0 spellCallbackLifeDrainArea(param) end setCombatCallback(combat, CALLBACK_PARAM_TARGETTILE, "onTargetTileLifeDrainArea") function onCastSpell(cid, var) if exhaustion.check(cid, 100102) == false then exhaustion.set(cid, 100102, 30) return doCombat(cid, combat, var) else doPlayerSendCancel(cid, "Wait "..exhaustion.get(cid, 100102).." second(s) to use this spell again.") end endEssa Spell, não estou conseguindo adicionar cooldown. Ela é uma spell de múltiplos attacks.
Script:
-- SpellCreator generated. -- =============== COMBAT VARS =============== -- Areas/Combat for 0ms local combat = createCombatObject() setCombatParam(combat, COMBAT_PARAM_TYPE, COMBAT_PHYSICALDAMAGE) setCombatParam(combat, COMBAT_PARAM_BLOCKARMOR, true) setCombatParam(combat, COMBAT_PARAM_DISTANCEEFFECT, CONST_ANI_ARROW) function onGetFormulaValues(cid, level, skill, attack, factor) min = -(level * 1 + skill * 1.5) * 0.3 max = -(level * 1 + skill * 1.5) * 0.7 return min, max end setCombatCallback(combat, CALLBACK_PARAM_SKILLVALUE, "onGetFormulaValues") function onCastSpell(cid, var) return doCombat(cid, combat, var) end -- Areas/Combat for 500ms local combat = createCombatObject() setCombatParam(combat, COMBAT_PARAM_TYPE, COMBAT_PHYSICALDAMAGE) setCombatParam(combat, COMBAT_PARAM_BLOCKARMOR, true) setCombatParam(combat, COMBAT_PARAM_DISTANCEEFFECT, CONST_ANI_ARROW) function onGetFormulaValues(cid, level, skill, attack, factor) min = -(level * 1 + skill * 1.5) * 0.3 max = -(level * 1 + skill * 1.5) * 0.7 return min, max end setCombatCallback(combat, CALLBACK_PARAM_SKILLVALUE, "onGetFormulaValues") function onCastSpell(cid, var) return doCombat(cid, combat, var) end -- Areas/Combat for 1000ms local combat = createCombatObject() setCombatParam(combat, COMBAT_PARAM_TYPE, COMBAT_PHYSICALDAMAGE) setCombatParam(combat, COMBAT_PARAM_BLOCKARMOR, true) setCombatParam(combat, COMBAT_PARAM_DISTANCEEFFECT, CONST_ANI_ARROW) function onGetFormulaValues(cid, level, skill, attack, factor) min = -(level * 1 + skill * 1.5) * 0.3 max = -(level * 1 + skill * 1.5) * 0.7 return min, max end setCombatCallback(combat, CALLBACK_PARAM_SKILLVALUE, "onGetFormulaValues") function onCastSpell(cid, var) return doCombat(cid, combat, var) end -- Areas/Combat for 1500ms local combat = createCombatObject() setCombatParam(combat, COMBAT_PARAM_TYPE, COMBAT_PHYSICALDAMAGE) setCombatParam(combat, COMBAT_PARAM_BLOCKARMOR, true) setCombatParam(combat, COMBAT_PARAM_DISTANCEEFFECT, CONST_ANI_ARROW) function onGetFormulaValues(cid, level, skill, attack, factor) min = -(level * 1 + skill * 1.5) * 0.3 max = -(level * 1 + skill * 1.5) * 0.7 return min, max end setCombatCallback(combat, CALLBACK_PARAM_SKILLVALUE, "onGetFormulaValues") function onCastSpell(cid, var) return doCombat(cid, combat, var) end -- =============== CORE FUNCTIONS =============== local function RunPart(c,cid,var,dirList,dirEmitPos) -- Part if (isCreature(cid)) then doCombat(cid, c, var) if (dirList ~= nil) then -- Emit distance effects local i = 2; while (i < #dirList) do doSendDistanceShoot(dirEmitPos,{x=dirEmitPos.x-dirList[i],y=dirEmitPos.y-dirList[i+1],z=dirEmitPos.z},dirList[1]) i = i + 2 end end end end function onCastSpell(cid, var) local startPos = getCreaturePosition(cid) RunPart(combat,cid,var) addEvent(RunPart,500,combat,cid,var) addEvent(RunPart,1000,combat,cid,var) addEvent(RunPart,1500,combat,cid,var) return true endSe puderem ajudar, agradeço desde já.
Editado por gabrielvsLink para o comentário
https://xtibia.com/forum/topic/239196-ajuda-a-arrumar-essas-spells/Compartilhar em outros sites
0 respostass a esta questão
Posts Recomendados