Ir para conteúdo

Featured Replies

Postado

Boa tarde, peguei um script de base daqui do Tibiaking o sistema de aura.

 

Base: 

 

Porém eu gostaria de fazer com que a pessoa só usasse a aura se tivesse feito a quest.

Scripts da quest já estão feitos:

 

Bau.lua

function onUse(cid, item, fromPosition, itemEx, toPosition)
if (getPlayerStorageValue(cid, 25950) == -1) then
doPlayerSendTextMessage(cid,22,"Aura Level 1") 
setPlayerStorageValue(cid, 25950, 1)
doSendMagicEffect(getCreaturePosition(cid), CONST_ME_HOLYDAMAGE)
else
doPlayerSendTextMessage(cid,22,"O bau esta vazio.")
end
return true
end

 

Creio que é aqui que muda algo:

function onSay(cid, words, param, channel)
	if(param=="on") then
		if getPlayerStorageValue(cid, estr) > os.time() then
			doPlayerSendCancel(cid, "Espere "..(getPlayerStorageValue(cid, estr) - os.time()).." segundos para poder habilitar aura novamente.")
		else
			if(getPlayerStorageValue(cid, aurastr)==2) then
				doPlayerSendCancel(cid,"Sua Aura Level 1 já está habilitada.")
			elseif(getPlayerStorageValue(cid, aurastr)==-1) then
				doPlayerSendCancel(cid,"Aura ligada!")
				setPlayerStorageValue(cid, aurastr, 2)
				efeitosAura(1,tempo/8,cid)
		end
		end
	elseif(param=="off") then
		if(getPlayerStorageValue(cid, aurastr)==2) then
			setPlayerStorageValue(cid, estr, os.time()+2)
			setPlayerStorageValue(cid, aurastr, -1)
			doPlayerSendCancel(cid,"Aura Level 1 desligada!")
		end
	else	
		doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, "Digite '!aura on' para ligar sua aura, e '!aura off' para desligá-la.")
	end
	return TRUE
end 

 

Também tentei modificar o creaturescript porém não deu certo.

 

function onLogin(cid)
	aurastr = 25950 -- storage da aura
	if getPlayerStorageValue(cid, 25950) == 1 then
	setPlayerStorageValue(cid, aurastr, -1)
	return TRUE
end
end

 

Agradeço desde já.

Postado
function onSay(cid, words, param, channel)
if getPlayerStorageValue(cid, 25950) <= 0 then
doPlayerSendCancel(cid, "Você precisa ter feito a quest.")
return true
end
	if(param=="on") then
		if getPlayerStorageValue(cid, estr) > os.time() then
			doPlayerSendCancel(cid, "Espere "..(getPlayerStorageValue(cid, estr) - os.time()).." segundos para poder habilitar aura novamente.")
		else
			if(getPlayerStorageValue(cid, aurastr)==2) then
				doPlayerSendCancel(cid,"Sua Aura Level 1 já está habilitada.")
			elseif(getPlayerStorageValue(cid, aurastr)==-1) then
				doPlayerSendCancel(cid,"Aura ligada!")
				setPlayerStorageValue(cid, aurastr, 2)
				efeitosAura(1,tempo/8,cid)
		end
		end
	elseif(param=="off") then
		if(getPlayerStorageValue(cid, aurastr)== 2) then
			setPlayerStorageValue(cid, estr, os.time()+2)
			setPlayerStorageValue(cid, aurastr, -1)
			doPlayerSendCancel(cid,"Aura Level 1 desligada!")
		end
	else	
		doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, "Digite '!aura on' para ligar sua aura, e '!aura off' para desligá-la.")
	end
	return true
end 

 

 

Editado por Vodkart (veja o histórico de edições)

vodkart_logo.png

[*Ninguém será digno do sucesso se não usar suas derrotas para conquistá-lo.*]

 

DISCORDvodkart#6090

 

Postado
  • Autor
1 hora atrás, Vodkart disse:

function onSay(cid, words, param, channel)
if getPlayerStorageValue(cid, 25950) <= 0 then
doPlayerSendCancel(cid, "Você precisa ter feito a quest.")
return true
end
	if(param=="on") then
		if getPlayerStorageValue(cid, estr) > os.time() then
			doPlayerSendCancel(cid, "Espere "..(getPlayerStorageValue(cid, estr) - os.time()).." segundos para poder habilitar aura novamente.")
		else
			if(getPlayerStorageValue(cid, aurastr)==2) then
				doPlayerSendCancel(cid,"Sua Aura Level 1 já está habilitada.")
			elseif(getPlayerStorageValue(cid, aurastr)==-1) then
				doPlayerSendCancel(cid,"Aura ligada!")
				setPlayerStorageValue(cid, aurastr, 2)
				efeitosAura(1,tempo/8,cid)
		end
		end
	elseif(param=="off") then
		if(getPlayerStorageValue(cid, aurastr)== 2) then
			setPlayerStorageValue(cid, estr, os.time()+2)
			setPlayerStorageValue(cid, aurastr, -1)
			doPlayerSendCancel(cid,"Aura Level 1 desligada!")
		end
	else	
		doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, "Digite '!aura on' para ligar sua aura, e '!aura off' para desligá-la.")
	end
	return true
end 

 

 

 

Funcionou perfeitamente, porém tem o problema de logar e ter que diminuir a storage:

 

function onLogin(cid)
	aurastr = 25950 -- storage da aura
	if getPlayerStorageValue(cid, 25950) == 1 then
	setPlayerStorageValue(cid, aurastr, -1)
	return TRUE
end
end

Encontrei outro erro. Tentei fazer outra aura, mas elas não são independentes. Se eu uso !aura1 on ela liga a mais forte que no caso é a aura 3

Editado por moviebr (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.

Visitante
Responder

Quem Está Navegando 0

  • Nenhum usuário registrado visualizando esta página.

Estatísticas dos Fóruns

  • Tópicos 96.9k
  • Posts 519.7k

Informação Importante

Confirmação de Termo