Ir para conteúdo
  • Cadastre-se

(Resolvido)Ajuda com Spells


Ir para solução Resolvido por elielder,

Posts Recomendados

.Qual servidor ou website você utiliza como base? 

rev 3777, 0.4 8.60

Qual o motivo deste tópico? 

Preciso de ajudar com a spell, preciso que ele mande uma mensagem quando falhasse a spell.

Ela está funcionando, só que como ela tem 50 % de funcionar, quando falha ela manda a mensagem "Voce so pode usar esta magia em players!"   Gostaria que quando der falha ela mande uma mensagem "Sorry, Mafuba falhou"
Edit 1: Quero que ele mande as 2 mensagens, 1 quando eu ataco o monstro e outra quando falha.

Está surgindo algum erro? Se sim coloque-o aqui. 

Citar

 

 

Você tem o código disponível? Se tiver publique-o aqui: 

local percent = 50

function onCastSpell(cid, var)
local waittime = 60 -- Tempo de exhaustion
local storage = 15288

if exhaustion.check(cid, storage) then
doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, "Aguarde " .. exhaustion.get(cid, storage) .. " segundos para usar a spell novamente.")
return false
end

exhaustion.set(cid, storage, waittime)
local Tile1 = {x=110, y=177, z=7} -- pos pra onde sera levado o target
local target = getCreatureTarget(cid)
local targetpos = getCreaturePosition(target)
local time = 30 -- tempo pra teleporta devolta, em segs


local function Target_Back(target)
doTeleportThing(target, targetpos)
end


if percent >= math.random(1,100) and isPlayer(target) then
doTeleportThing(target, Tile1)
doSendMagicEffect(targetpos, 196)
addEvent(Target_Back, time*1000, target)
doCreatureSay(cid, "Mafubaaaaaaa", TALKTYPE_MONSTER)
else
doPlayerSendCancel(cid, "Voce so pode usar esta magia em players!")
end
end

 

Você tem alguma imagem que possa auxiliar no problema? Se sim, coloque-a aqui. 

 

Editado por elielder
me expressei errado. (veja o histórico de edições)
Link para o post
Compartilhar em outros sites
Spoiler

local percent = 50

function onCastSpell(cid, var)
local waittime = 60 -- Tempo de exhaustion
local storage = 15288

if exhaustion.check(cid, storage) then
doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, "Aguarde " .. exhaustion.get(cid, storage) .. " segundos para usar a spell novamente.")
return false
end

exhaustion.set(cid, storage, waittime)
local Tile1 = {x=110, y=177, z=7} -- pos pra onde sera levado o target
local target = getCreatureTarget(cid)
local targetpos = getCreaturePosition(target)
local time = 30 -- tempo pra teleporta devolta, em segs


local function Target_Back(target)
doTeleportThing(target, targetpos)
end


if percent >= math.random(1,100) and isPlayer(target) then
doTeleportThing(target, Tile1)
doSendMagicEffect(targetpos, 196)
addEvent(Target_Back, time*1000, target)
doCreatureSay(cid, "Mafubaaaaaaa", TALKTYPE_MONSTER)
else
doPlayerSendCancel(cid, "Sorry, Mafuba falhou")
end
end

Ué mano, é só trocar uma pela outra '-'

Link para o post
Compartilhar em outros sites
1 hora atrás, Nysman disse:
  Mostrar conteúdo oculto


local percent = 50

function onCastSpell(cid, var)
local waittime = 60 -- Tempo de exhaustion
local storage = 15288

if exhaustion.check(cid, storage) then
doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, "Aguarde " .. exhaustion.get(cid, storage) .. " segundos para usar a spell novamente.")
return false
end

exhaustion.set(cid, storage, waittime)
local Tile1 = {x=110, y=177, z=7} -- pos pra onde sera levado o target
local target = getCreatureTarget(cid)
local targetpos = getCreaturePosition(target)
local time = 30 -- tempo pra teleporta devolta, em segs


local function Target_Back(target)
doTeleportThing(target, targetpos)
end


if percent >= math.random(1,100) and isPlayer(target) then
doTeleportThing(target, Tile1)
doSendMagicEffect(targetpos, 196)
addEvent(Target_Back, time*1000, target)
doCreatureSay(cid, "Mafubaaaaaaa", TALKTYPE_MONSTER)
else
doPlayerSendCancel(cid, "Sorry, Mafuba falhou")
end
end

Ué mano, é só trocar uma pela outra '-'

sim da pra fazer isso kk.
mas essa que já tem é para aparecer se eu usar a spell em Monstros.
eu quero que mostre as duas. se atacar um monstro mostrar a que já tem, e se falhar mostrar a outra.
acho que me expressei mal.

Link para o post
Compartilhar em outros sites
  • Solução
53 minutos atrás, Nysman disse:

Tenta ai, mesmo assim continuo sem entender oque você quer, pois no script não tem nada semelhante a "falha" a não ser o exast

  Ocultar conteúdo

local percent = 50

function onCastSpell(cid, var)
local waittime = 60 -- Tempo de exhaustion
local storage = 15288

if exhaustion.check(cid, storage) then
doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, "Aguarde " .. exhaustion.get(cid, storage) .. " segundos para usar a spell novamente.")
return false
end

exhaustion.set(cid, storage, waittime)
local Tile1 = {x=110, y=177, z=7} -- pos pra onde sera levado o target
local target = getCreatureTarget(cid)
local targetpos = getCreaturePosition(target)
local time = 30 -- tempo pra teleporta devolta, em segs


local function Target_Back(target)
doTeleportThing(target, targetpos)
end


if percent >= math.random(1,100) and isPlayer(target) then
doTeleportThing(target, Tile1)
doSendMagicEffect(targetpos, 196)
else
doPlayerSendCancel(cid,"Sorry, Mafuba falhou")
addEvent(Target_Back, time*1000, target)
doCreatureSay(cid, "Mafubaaaaaaa", TALKTYPE_MONSTER)
else
doPlayerSendCancel(cid, "Voce so pode usar esta magia em players!")
end
end

 

ou

  Ocultar conteúdo

local percent = 50

function onCastSpell(cid, var)
local waittime = 60 -- Tempo de exhaustion
local storage = 15288

if exhaustion.check(cid, storage) then
doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, "Aguarde " .. exhaustion.get(cid, storage) .. " segundos para usar a spell novamente.")
return false
end

exhaustion.set(cid, storage, waittime)
local Tile1 = {x=110, y=177, z=7} -- pos pra onde sera levado o target
local target = getCreatureTarget(cid)
local targetpos = getCreaturePosition(target)
local time = 30 -- tempo pra teleporta devolta, em segs


local function Target_Back(target)
doTeleportThing(target, targetpos)
doPlayerSendCancel(cid,"Sorry, Mafuba falhou")

end


if percent >= math.random(1,100) and isPlayer(target) then
doTeleportThing(target, Tile1)
doSendMagicEffect(targetpos, 196)
addEvent(Target_Back, time*1000, target)
doCreatureSay(cid, "Mafubaaaaaaa", TALKTYPE_MONSTER)
else
doPlayerSendCancel(cid, "Voce so pode usar esta magia em players!")
end
end

 

nenhum funcionou.

Desculpa não conseguir explicar.
Mas eu quero que apareça as duas mensagem.
exemplo se o player usar essa magia em um monstro aparece "Voce so pode usar esta magia em players!"
se o player atacar outro player e essa magia falhar  aparece "Sorry, Mafuba falhou"

É porque do jeito que a magia está, quando eu ataco um player e ele falha, aparece a mesma mensagem de quando ataco um monstro. Preciso que apareça as duas.

 

Consegui resolver assim. Se alguem ver algum erro por favor corriga. mas aqui está funcionando perfeitamente.

 

Spoiler


local percent = 50
from = {x=83, y=188, z=7} --- quina do kamui (pra impedir players de usarem o kamui dentro do kamui)
to = {x=89, y=192, z=7} --- quina do kamui (pra impedir players de usarem o kamui dentro do kamui)

function onCastSpell(cid, var)
local pos = getPlayerPosition(cid)
local waittime = 60 -- Tempo de exhaustion
local storage = 15288

if exhaustion.check(cid, storage) then
doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, "Aguarde " .. exhaustion.get(cid, storage) .. " segundos para usar a spell novamente.")
return false
end

if isInRange(pos, from, to) then
doPlayerSendCancel(cid, "Você não pode usar Mafuba aqui!")
return false
end


local Tile1 = {x=110, y=177, z=7} -- pos pra onde sera levado o target
local target = getCreatureTarget(cid)
local targetpos = getCreaturePosition(target)
local time = 30 -- tempo pra teleporta devolta, em segs


local function Target_Back(target)
doTeleportThing(target, targetpos)
end

if not isPlayer(target) then
doPlayerSendCancel(cid, "Você só pode usar essa técnica em Players.")
return false
end


if percent >= math.random(1,100) then
doTeleportThing(target, Tile1)
doSendMagicEffect(targetpos, 396)
addEvent(Target_Back, time*1000, target)
else
doPlayerSendCancel(cid, "Sorry, Mafuba Falhou!")
end
exhaustion.set(cid, storage, waittime)
return true
end

 

 

Editado por elielder
dar espaço, tava tudo junto. (veja o histórico de edições)
Link para o post
Compartilhar em outros sites

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.

Visitante
Responder

×   Você colou conteúdo com formatação.   Remover formatação

  Apenas 75 emojis são permitidos.

×   Seu link foi automaticamente incorporado.   Mostrar como link

×   Seu conteúdo anterior foi restaurado.   Limpar o editor

×   Não é possível colar imagens diretamente. Carregar ou inserir imagens do URL.

×
×
  • Criar Novo...

Informação Importante

Confirmação de Termo