Postado Julho 30, 2017 7 anos @Ribeiro Foda da sim, se eu soubesse qual callback é o verdadeiro, tem 2x onCastSpell, qual é o verdadeiro, da script ? De forma resumida, o que esse script faz ? O que você quer que ele faça ?
Postado Julho 30, 2017 7 anos Autor O 1 onCastSpell é o verdadeiro. Onde ta o 2 é errado, so tirar a linha do onCastSpell e deixar a partir do ifGetPlayerStorageValue.(cid, config.storage). Eu fiz a spell pra funcionar pra cair uma chuva de fogo do Ar e dar dano, so que essa script onde ta o onCastSpell 2 previne que o player consiga spamar ela, só de tanto em tanto seconds (esquece no config que o Seconds ta = 0 pq tava testando) ai ele tambem faz a contagem se o player tenta usar do tanto tempo que falta. Eu ja uso na minhas spell esse script da contagem, mas elas são por Combat, esse esta direto na onCastSpell entao n sei configurar quando é assim. Spell verdadeira: Mostrar conteúdo oculto local config = { mana = 0, seconds = 0, storage = 111313, semMana = "Você não tem mana suficiente.", msg = "Você precisa aguardar %d segundos para usar essa magia novamente.", } local area = createCombatArea(AREA_CIRCLE2X2) function onCastSpell(cid, var) local target = getCreatureTarget(cid) for x = 1, 40 do addEvent(furyAttackTarget,250*x+500,cid,target,{x = getCreaturePosition(target).x + math.random(-1,1), y = getCreaturePosition(target).y + math.random(-1,1), z = getCreaturePosition(target).z}) end end function furyAttackTarget(cid,target,pos) if isCreature(cid) == TRUE and isCreature(target) == TRUE then doSendDistanceShoot({x = getCreaturePosition(target).x - math.random(4,6), y = getCreaturePosition(target).y - 5, z = getCreaturePosition(target).z},pos,3) doAreaCombatHealth(cid,COMBAT_FIREDAMAGE,pos,area,-1,-200,36) doAreaCombatHealth(cid,COMBAT_FIREDAMAGE,pos,area,-1,-500,36) end end Editado Julho 30, 2017 7 anos por Ribeiro Foda (veja o histórico de edições)
Postado Julho 31, 2017 7 anos Solução Não tenho certeza se entendi exatamente o que tu querias que eu fizesse, mas... tenta dessa forma: local config = { mana = 0, seconds = 0, storage = 111313, semMana = "Você não tem mana suficiente.", msg = "Você precisa aguardar %d segundos para usar essa magia novamente.", } local area = createCombatArea(AREA_CIRCLE2X2) function onCastSpell(cid, var) local target = getCreatureTarget(cid) if(isCreature(target) == 0) then return true end if getPlayerStorageValue(cid, config.storage) == -1 then setPlayerStorageValue(cid, config.storage, os.time()-config.seconds) end if config.seconds-(os.time()-getPlayerStorageValue(cid, config.storage)) > 0 then doPlayerSendCancel(cid, string.format(config.msg, config.seconds-(os.time()-getPlayerStorageValue(cid, config.storage)))) return true end if getPlayerMana(cid) >= config.mana then doPlayerAddMana(cid, -config.mana) setPlayerStorageValue(cid, config.storage, os.time()) for x = 1, 40 do addEvent(furyAttackTarget,250*x+500,cid,target,{x = getCreaturePosition(target).x + math.random(-1,1), y = getCreaturePosition(target).y + math.random(-1,1), z = getCreaturePosition(target).z}) end else doPlayerSendCancel(cid, config.semMana) doSendMagicEffect(getPlayerPosition(cid),2) end return true end function furyAttackTarget(cid,target,pos) if isCreature(cid) == TRUE and isCreature(target) == TRUE then doSendDistanceShoot({x = getCreaturePosition(target).x - math.random(4,6), y = getCreaturePosition(target).y - 5, z = getCreaturePosition(target).z},pos,3) doAreaCombatHealth(cid,COMBAT_FIREDAMAGE,pos,area,-1,-200,36) doAreaCombatHealth(cid,COMBAT_FIREDAMAGE,pos,area,-1,-500,36) end end
Postado Julho 31, 2017 7 anos Autor Em 31/07/2017 em 03:17, Rusherzin disse: Não tenho certeza se entendi exatamente o que tu querias que eu fizesse, mas... tenta dessa forma: local config = { mana = 0, seconds = 0, storage = 111313, semMana = "Você não tem mana suficiente.", msg = "Você precisa aguardar %d segundos para usar essa magia novamente.", } local area = createCombatArea(AREA_CIRCLE2X2) function onCastSpell(cid, var) local target = getCreatureTarget(cid) if(isCreature(target) == 0) then return true end if getPlayerStorageValue(cid, config.storage) == -1 then setPlayerStorageValue(cid, config.storage, os.time()-config.seconds) end if config.seconds-(os.time()-getPlayerStorageValue(cid, config.storage)) > 0 then doPlayerSendCancel(cid, string.format(config.msg, config.seconds-(os.time()-getPlayerStorageValue(cid, config.storage)))) return true end if getPlayerMana(cid) >= config.mana then doPlayerAddMana(cid, -config.mana) setPlayerStorageValue(cid, config.storage, os.time()) for x = 1, 40 do addEvent(furyAttackTarget,250*x+500,cid,target,{x = getCreaturePosition(target).x + math.random(-1,1), y = getCreaturePosition(target).y + math.random(-1,1), z = getCreaturePosition(target).z}) end else doPlayerSendCancel(cid, config.semMana) doSendMagicEffect(getPlayerPosition(cid),2) end return true end function furyAttackTarget(cid,target,pos) if isCreature(cid) == TRUE and isCreature(target) == TRUE then doSendDistanceShoot({x = getCreaturePosition(target).x - math.random(4,6), y = getCreaturePosition(target).y - 5, z = getCreaturePosition(target).z},pos,3) doAreaCombatHealth(cid,COMBAT_FIREDAMAGE,pos,area,-1,-200,36) doAreaCombatHealth(cid,COMBAT_FIREDAMAGE,pos,area,-1,-500,36) end end PERFEITO CARA ! REP+ Só uma coisa, tem como a spell cair no local que voce citar as palavras invez de precisar de target pra ela ficar caindo onde está com target? Editado Julho 31, 2017 7 anos por Ribeiro Foda (veja o histórico de edições)
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.