MA
pedido

Dois Pedidos

Por MathhCunha, 29 de ago. de 2013 em Scripts

resolvido
otserv
tibia
script
32
3.2k
MathhCunhaM
29 de agosto de 2013 às 19:11

Venho aqui hoje, para pedir dois scripts :)

 

--First--

Exevo Aura (FOXWORLD 8.4)

-Informações sobre o poder:

*Ele cria uma wand na mão do jogar durante 30 min, e so pode soltar a magia novamente depois de 30min :')

 

--Second--

Bau que Learn Spell

-Informações sobre o BAU:

*Ele remove 10 points(comprado por R$) e da o char o direito de soltar a magia

 

 

Obrigado pela a AJUDA mdr.gifmdr.gif

 

Informações do Server :

New Yoruts Slayer 8.6

TFS 0.3.6 (Crying Damson)

Editado Agosto 30 por MathhCunha

OmegaO
29 de agosto de 2013 às 22:51

Cara, especifique que pontos são esses. É um storage ou alguma adição no banco de dados?

Bom, vou deixar aqui o script do baú se for de storage e se der eu faço o da wand depois, que vai dar mais trabalho.

 

 

function onUse(cid, item, fromPosition, itemEx, toPosition)
	local config =
	{
	lvl = 1, -- lvl necessário para usar o baú (deixe em um se quiser desativar)
	pointsto = 9999999, -- storage dos tais pontos
	sto = 505021, -- storage do baú, não precisa mudar
	nome_da_magia = 'Mega Ultimate Destruction' -- aqui você bota o nome da magia que tá no spells.xml entre aspas
	}
	if getPlayerStorageValue(cid,sto) == -1 then
		if getPlayerLevel(cid) > config.lvl then
			if getPlayerStorageValue(cid,pointsto) >= 10 then
				doPlayerLearnInstantSpell(cid,config.nome_da_magia)
				doPlayerSendTextMessage(cid,27,'Voce aprendeu a magia '..config.nome_da_magia..'.')
			else
				doPlayerSendTextMessage(cid,27,'Voce nao tem a quantidade necessaria de pontos.')
			end
		else
			doPlayerSendTextMessage(cid,27,'Voce nao tem level suficiente para usar este bau.')
		end
	else
		doPlayerSendTextMessage(cid,27,'Voce ja aprendeu essa magia.')
	end
	return true
end

 

 

 

Além disso, você tem que colocar isso aí na tag da magia para que somente os jogadores que fizeram essa quest possam usa-la.

needlearn="1"
MathhCunhaM
30 de agosto de 2013 às 10:57

 

Cara, especifique que pontos são esses. É um storage ou alguma adição no banco de dados?

Bom, vou deixar aqui o script do baú se for de storage e se der eu faço o da wand depois, que vai dar mais trabalho.

 

 

function onUse(cid, item, fromPosition, itemEx, toPosition)
	local config =
	{
	lvl = 1, -- lvl necessário para usar o baú (deixe em um se quiser desativar)
	pointsto = 9999999, -- storage dos tais pontos
	sto = 505021, -- storage do baú, não precisa mudar
	nome_da_magia = 'Mega Ultimate Destruction' -- aqui você bota o nome da magia que tá no spells.xml entre aspas
	}
	if getPlayerStorageValue(cid,sto) == -1 then
		if getPlayerLevel(cid) > config.lvl then
			if getPlayerStorageValue(cid,pointsto) >= 10 then
				doPlayerLearnInstantSpell(cid,config.nome_da_magia)
				doPlayerSendTextMessage(cid,27,'Voce aprendeu a magia '..config.nome_da_magia..'.')
			else
				doPlayerSendTextMessage(cid,27,'Voce nao tem a quantidade necessaria de pontos.')
			end
		else
			doPlayerSendTextMessage(cid,27,'Voce nao tem level suficiente para usar este bau.')
		end
	else
		doPlayerSendTextMessage(cid,27,'Voce ja aprendeu essa magia.')
	end
	return true
end

 

 

 

Além disso, você tem que colocar isso aí na tag da magia para que somente os jogadores que fizeram essa quest possam usa-la.

needlearn="1"

Eu uso um sistema de point pela a DATABASE. Obrigado.

 

Eu uso esse Sistema de Points

Editado Agosto 30 por MathhCunha

OmegaO
30 de agosto de 2013 às 16:25

Então fica assim:

 

 

function onUse(cid, item, fromPosition, itemEx, toPosition)
	local config =
	{
	lvl = 1, -- lvl necessário para usar o baú (deixe em 1 se quiser desativar)
	points = 10 -- pontos necessários para usar o baú
	sto = 505021, -- storage do baú, não precisa mudar
	nome_da_magia = 'Mega Ultimate Destruction' -- aqui você bota o nome da magia que tá no spells.xml entre aspas
	}
	if getPlayerStorageValue(cid,config.sto) == -1 then
		if getPlayerLevel(cid) > config.lvl then
			if getPoints(cid) >= config.points then
				doPlayerLearnInstantSpell(cid,config.nome_da_magia)
				doPlayerSendTextMessage(cid,27,'Voce aprendeu a magia '..config.nome_da_magia..'.')
				removePoints(cid,config.points)
			else
				doPlayerSendTextMessage(cid,27,'Voce nao tem a quantidade necessaria de pontos.')
			end
		else
			doPlayerSendTextMessage(cid,27,'Voce nao tem level suficiente para usar este bau.')
		end
	else
		doPlayerSendTextMessage(cid,27,'Voce ja aprendeu essa magia.')
	end
	return true
end

 

 

Editado Agosto 30 por omega blueheaven

MathhCunhaM
30 de agosto de 2013 às 18:01

Então fica assim:

 

 

function onUse(cid, item, fromPosition, itemEx, toPosition)
	local config =
	{
	lvl = 1, -- lvl necessário para usar o baú (deixe em 1 se quiser desativar)
	points = 10 -- pontos necessários para usar o baú
	sto = 505021, -- storage do baú, não precisa mudar
	nome_da_magia = 'Mega Ultimate Destruction' -- aqui você bota o nome da magia que tá no spells.xml entre aspas
	}
	if getPlayerStorageValue(cid,config.sto) == -1 then
		if getPlayerLevel(cid) > config.lvl then
			if getPoints(cid) >= config.points then
				doPlayerLearnInstantSpell(cid,config.nome_da_magia)
				doPlayerSendTextMessage(cid,27,'Voce aprendeu a magia '..config.nome_da_magia..'.')
				removePoints(cid,config.points)
			else
				doPlayerSendTextMessage(cid,27,'Voce nao tem a quantidade necessaria de pontos.')
			end
		else
			doPlayerSendTextMessage(cid,27,'Voce nao tem level suficiente para usar este bau.')
		end
	else
		doPlayerSendTextMessage(cid,27,'Voce ja aprendeu essa magia.')
	end
	return true
end

 

 

Deu Erro. Me Manda as linhas tudinho.

 

Obrigado

 

 

[30/08/2013 18:07:01] [Error - LuaScriptInterface::loadFile] data/actions/scripts/a/podernovo.lua:6: '}' expected (to close '{' at line 3) near 'sto'

[30/08/2013 18:07:01] [Warning - Event::loadScript] Cannot load script (data/actions/scripts/a/podernovo.lua)
[30/08/2013 18:07:01] data/actions/scripts/a/podernovo.lua:6: '}' expected (to close '{' at line 3) near 'sto'

Editado Agosto 30 por MathhCunha

OmegaO
30 de agosto de 2013 às 18:42

Erro bobo meu, tenta de novo.

 

function onUse(cid, item, fromPosition, itemEx, toPosition)
	local config =
	{
	lvl = 1, -- lvl necessário para usar o baú (deixe em 1 se quiser desativar)
	points = 10, -- pontos necessários para usar o baú
	sto = 505021, -- storage do baú, não precisa mudar
	nome_da_magia = 'Mega Ultimate Destruction' -- aqui você bota o nome da magia que tá no spells.xml entre aspas
	}
	if getPlayerStorageValue(cid,config.sto) == -1 then
		if getPlayerLevel(cid) > config.lvl then
			if getPoints(cid) >= config.points then
				doPlayerLearnInstantSpell(cid,config.nome_da_magia)
				doPlayerSendTextMessage(cid,27,'Voce aprendeu a magia '..config.nome_da_magia..'.')
				removePoints(cid,config.points)
			else
				doPlayerSendTextMessage(cid,27,'Voce nao tem a quantidade necessaria de pontos.')
			end
		else
			doPlayerSendTextMessage(cid,27,'Voce nao tem level suficiente para usar este bau.')
		end
	else
		doPlayerSendTextMessage(cid,27,'Voce ja aprendeu essa magia.')
	end
	return true
end

 

 

MathhCunhaM
31 de agosto de 2013 às 16:14

Erro bobo meu, tenta de novo.

 

function onUse(cid, item, fromPosition, itemEx, toPosition)
	local config =
	{
	lvl = 1, -- lvl necessário para usar o baú (deixe em 1 se quiser desativar)
	points = 10, -- pontos necessários para usar o baú
	sto = 505021, -- storage do baú, não precisa mudar
	nome_da_magia = 'Mega Ultimate Destruction' -- aqui você bota o nome da magia que tá no spells.xml entre aspas
	}
	if getPlayerStorageValue(cid,config.sto) == -1 then
		if getPlayerLevel(cid) > config.lvl then
			if getPoints(cid) >= config.points then
				doPlayerLearnInstantSpell(cid,config.nome_da_magia)
				doPlayerSendTextMessage(cid,27,'Voce aprendeu a magia '..config.nome_da_magia..'.')
				removePoints(cid,config.points)
			else
				doPlayerSendTextMessage(cid,27,'Voce nao tem a quantidade necessaria de pontos.')
			end
		else
			doPlayerSendTextMessage(cid,27,'Voce nao tem level suficiente para usar este bau.')
		end
	else
		doPlayerSendTextMessage(cid,27,'Voce ja aprendeu essa magia.')
	end
	return true
end

 

 

Qual as Linhas? Esse Sto e a que eu tenho que coloca no bau?

OmegaO
31 de agosto de 2013 às 16:42

 

Erro bobo meu, tenta de novo.

 

function onUse(cid, item, fromPosition, itemEx, toPosition)
	local config =
	{
	lvl = 1, -- lvl necessário para usar o baú (deixe em 1 se quiser desativar)
	points = 10, -- pontos necessários para usar o baú
	sto = 505021, -- storage do baú, não precisa mudar
	nome_da_magia = 'Mega Ultimate Destruction' -- aqui você bota o nome da magia que tá no spells.xml entre aspas
	}
	if getPlayerStorageValue(cid,config.sto) == -1 then
		if getPlayerLevel(cid) > config.lvl then
			if getPoints(cid) >= config.points then
				doPlayerLearnInstantSpell(cid,config.nome_da_magia)
				doPlayerSendTextMessage(cid,27,'Voce aprendeu a magia '..config.nome_da_magia..'.')
				removePoints(cid,config.points)
			else
				doPlayerSendTextMessage(cid,27,'Voce nao tem a quantidade necessaria de pontos.')
			end
		else
			doPlayerSendTextMessage(cid,27,'Voce nao tem level suficiente para usar este bau.')
		end
	else
		doPlayerSendTextMessage(cid,27,'Voce ja aprendeu essa magia.')
	end
	return true
end

 

 

Qual as Linhas? Esse Sto e a que eu tenho que coloca no bau?

 

 

O erro foi que eu tinha esquecido de colocar vírgula listar no config.

Pra colocar esse baú no jogo você coloca uma tag com a seguinte tag no actions.xml:

<action actionid="actionid" script="baumagiavip.lua"/>

Aí coloca um baú com o action id que você preencher (salva o código como baumagiavip.lua em actions/scripts)

MathhCunhaM
31 de agosto de 2013 às 17:05

 

 

Erro bobo meu, tenta de novo.

 

function onUse(cid, item, fromPosition, itemEx, toPosition)
	local config =
	{
	lvl = 1, -- lvl necessário para usar o baú (deixe em 1 se quiser desativar)
	points = 10, -- pontos necessários para usar o baú
	sto = 505021, -- storage do baú, não precisa mudar
	nome_da_magia = 'Mega Ultimate Destruction' -- aqui você bota o nome da magia que tá no spells.xml entre aspas
	}
	if getPlayerStorageValue(cid,config.sto) == -1 then
		if getPlayerLevel(cid) > config.lvl then
			if getPoints(cid) >= config.points then
				doPlayerLearnInstantSpell(cid,config.nome_da_magia)
				doPlayerSendTextMessage(cid,27,'Voce aprendeu a magia '..config.nome_da_magia..'.')
				removePoints(cid,config.points)
			else
				doPlayerSendTextMessage(cid,27,'Voce nao tem a quantidade necessaria de pontos.')
			end
		else
			doPlayerSendTextMessage(cid,27,'Voce nao tem level suficiente para usar este bau.')
		end
	else
		doPlayerSendTextMessage(cid,27,'Voce ja aprendeu essa magia.')
	end
	return true
end

 

 

Qual as Linhas? Esse Sto e a que eu tenho que coloca no bau?

 

 

O erro foi que eu tinha esquecido de colocar vírgula listar no config.

Pra colocar esse baú no jogo você coloca uma tag com a seguinte tag no actions.xml:

<action actionid="actionid" script="baumagiavip.lua"/>

Aí coloca um baú com o action id que você preencher (salva o código como baumagiavip.lua em actions/scripts)

 

 

Já coloquei, eu pensei que era UniqueID, só que eu já arrumei.

-- 1ºPedido Solucionado.

 

-- 2ºPedido em Aberto

 

A wand, tu vai fazer?

 

 

Obrigado.

KilluaK
01 de setembro de 2013 às 04:37

Eu fiz o baú pra você, ve se funciona

 

function onUse(cid, item)
   local pontos = 2160 -- id dos pontos.
   if getPlayerStorageValue(cid, 18382) < 1 then
      if getPlayerItem(cid, pontos) >= 10 then
         doPlayerLearnSpell(cid, "exevo aura")
         doPlayerSendTextMessage(cid, 27, "vc ganhou a magia exevo aura")
         doPlayerRemoveItem(cid, pontos, 10)
         setPlayerStorageValue(cid, 18382, 1)
      else
         doPlayerSendTextMessage(cid, 22, "vc nao tem os 10 pontos necessarios para apreder a magia!")
      end
   else
      doPlayerSensTextMessage(cid, 22, "vc ja aprendeu a magia!")
   end
   return TRUE
end
MathhCunhaM
01 de setembro de 2013 às 11:00

Eu fiz o baú pra você, ve se funciona

 

function onUse(cid, item)
   local pontos = 2160 -- id dos pontos.
   if getPlayerStorageValue(cid, 18382) < 1 then
      if getPlayerItem(cid, pontos) >= 10 then
         doPlayerLearnSpell(cid, "exevo aura")
         doPlayerSendTextMessage(cid, 27, "vc ganhou a magia exevo aura")
         doPlayerRemoveItem(cid, pontos, 10)
         setPlayerStorageValue(cid, 18382, 1)
      else
         doPlayerSendTextMessage(cid, 22, "vc nao tem os 10 pontos necessarios para apreder a magia!")
      end
   else
      doPlayerSensTextMessage(cid, 22, "vc ja aprendeu a magia!")
   end
   return TRUE
end

Hey valeu, mais eu ja arrumei o script. Obrigado

KilluaK
01 de setembro de 2013 às 13:15

A sim tudo bem :)

MathhCunhaM
02 de setembro de 2013 às 13:41

Agora necessito da wand :)

Se alguem ae sabe criar porfavor me ajuda :)

OmegaO
02 de setembro de 2013 às 18:00

Cara, o chato da wand é que vão ser vários arquivos: um da spell pra criar a wand, outro de movements pra não deixar o cara tirar ela depois que cria e mais um pra se o cara logar, ele perder a wand quando voltar.

Portanto, aí vai:

 

TAGs:

 

creaturescripts.xml: <event type="login" name="wandLogin" event="script" value="wandlogin.lua"/>

 

movements.xml: <movevent type="DeEquip" itemid="ID DA WAND" event="script" value="wandmove.lua"/>

 

spells.xml:

 

<instant name="Create Wand" words="exevo aura" lvl="LEVEL PRA CASTAR A MAGIA" mana="MANA" soul="1" aggressive="0" selftarget="1" exhaustion="1000" needlearn="0" event="script" value="support/conjure wand.lua">
	<vocation id="2"/> -- druid
	<vocation id="1"/> -- sorcerer
	<vocation id="6"/> -- ED
	<vocation id="5"/> -- MS
</instant>

 

 

 

Arquivos:

 

spells/support/conjurewand.lua:

local id_da_wand = 12345
local tempo_de_exhaust = 30 -- em minutos (da spell)
local tempo_de_wand = 30 -- em minutos (de duração da wand)
local wandsto = 505090
local storage = 505091
	
function doRemoveWand(cid)
	if not isPlayer(cid) then return false end
	if exhaustion.check(cid,wandsto) == true then
		return false
	end
	for slot = 5,6 do
		if getPlayerSlotItem(cid, slot).itemid == id_da_wand then
			doPlayerRemoveItem(cid,id_da_wand,1)
		end
	end
	return true
end

function onCastSpell(cid, var)	
	tempo_de_wand = tempo_de_wand * 60
	tempo_de_exhaust = tempo_de_exhaust * 60
	
	if exhaustion.check(cid, storage) == false then
		if exhaustion.check(cid,wandsto) == false then
			if not getPlayerSlotItem(cid, 5) or not getPlayerSlotItem(cid,6) then
				doPlayerAddItem(cid,id_da_wand,1)
				doSendMagicEffect(getCreaturePosition(cid),12)
				exhaustion.set(cid,wandsto,tempo_de_wand)
				exhaustion.set(cid,storage,tempo_de_exhaust)
				addEvent(doRemoveWand,(tempo_de_wand*1000)+1000,cid)
			else
				doPlayerSendCancel(cid,'You cannot use this spell with your hands full.')
				doSendMagicEffect(getCreaturePosition(cid),2)
			end
		else
			doPlayerSendCancel(cid,'You are exhausted.')
			doSendMagicEffect(getCreaturePosition(cid),2)
		end
	else
		doSendMagicEffect(getCreaturePosition(cid),2)
		doPlayerSendCancel(cid,'You are exhausted.')
	end
	return true
end

 

movements/scripts/wandmove.lua:

 

function onDeEquip(cid, item, slot)
	local tempo_restante = getPlayerStorageValue(cid,505090) - os.time(t)
	doPlayerSendTextMessage(cid,'You have to wait 'tempo_restante' seconds until the wand vanishes.')
	return false	
end

 

 

 

creaturescripts/scripts/wandlogin.lua:

 

local id_da_wand = 12345

function onLogin(cid)
	if getPlayerItemCount(cid,id_da_wand) >= 1 then
		if doRemoveWand(cid) == true then
			return true
		else
			local tempo_restante = getPlayerStorageValue(cid,505090) - os.time(t)
			addEvent(doRemoveWand,tempo_restante*1000,cid)
		end
	end
	return true
end

 

 

 

MathhCunhaM
02 de setembro de 2013 às 18:53

Cara, o chato da wand é que vão ser vários arquivos: um da spell pra criar a wand, outro de movements pra não deixar o cara tirar ela depois que cria e mais um pra se o cara logar, ele perder a wand quando voltar.

Portanto, aí vai:

 

TAGs:

 

creaturescripts.xml: <event type="login" name="wandLogin" event="script" value="wandlogin.lua"/>

 

movements.xml: <movevent type="DeEquip" itemid="ID DA WAND" event="script" value="wandmove.lua"/>

 

spells.xml:

 

<instant name="Create Wand" words="exevo aura" lvl="LEVEL PRA CASTAR A MAGIA" mana="MANA" soul="1" aggressive="0" selftarget="1" exhaustion="1000" needlearn="0" event="script" value="support/conjure wand.lua">
	<vocation id="2"/> -- druid
	<vocation id="1"/> -- sorcerer
	<vocation id="6"/> -- ED
	<vocation id="5"/> -- MS
</instant>

 

 

 

Arquivos:

 

spells/support/conjurewand.lua:

local id_da_wand = 12345
local tempo_de_exhaust = 30 -- em minutos (da spell)
local tempo_de_wand = 30 -- em minutos (de duração da wand)
local wandsto = 505090
local storage = 505091
	
function doRemoveWand(cid)
	if not isPlayer(cid) then return false end
	if exhaustion.check(cid,wandsto) == true then
		return false
	end
	for slot = 5,6 do
		if getPlayerSlotItem(cid, slot).itemid == id_da_wand then
			doPlayerRemoveItem(cid,id_da_wand,1)
		end
	end
	return true
end

function onCastSpell(cid, var)	
	tempo_de_wand = tempo_de_wand * 60
	tempo_de_exhaust = tempo_de_exhaust * 60
	
	if exhaustion.check(cid, storage) == false then
		if exhaustion.check(cid,wandsto) == false then
			if not getPlayerSlotItem(cid, 5) or not getPlayerSlotItem(cid,6) then
				doPlayerAddItem(cid,id_da_wand,1)
				doSendMagicEffect(getCreaturePosition(cid),12)
				exhaustion.set(cid,wandsto,tempo_de_wand)
				exhaustion.set(cid,storage,tempo_de_exhaust)
				addEvent(doRemoveWand,(tempo_de_wand*1000)+1000,cid)
			else
				doPlayerSendCancel(cid,'You cannot use this spell with your hands full.')
				doSendMagicEffect(getCreaturePosition(cid),2)
			end
		else
			doPlayerSendCancel(cid,'You are exhausted.')
			doSendMagicEffect(getCreaturePosition(cid),2)
		end
	else
		doSendMagicEffect(getCreaturePosition(cid),2)
		doPlayerSendCancel(cid,'You are exhausted.')
	end
	return true
end

 

movements/scripts/wandmove.lua:

 

function onDeEquip(cid, item, slot)
	local tempo_restante = getPlayerStorageValue(cid,505090) - os.time(t)
	doPlayerSendTextMessage(cid,'You have to wait 'tempo_restante' seconds until the wand vanishes.')
	return false	
end

 

 

 

creaturescripts/scripts/wandlogin.lua:

 

local id_da_wand = 12345

function onLogin(cid)
	if getPlayerItemCount(cid,id_da_wand) >= 1 then
		if doRemoveWand(cid) == true then
			return true
		else
			local tempo_restante = getPlayerStorageValue(cid,505090) - os.time(t)
			addEvent(doRemoveWand,tempo_restante*1000,cid)
		end
	end
	return true
end

 

 

 

Hey, quando eu uso no char la aparece que a minha mão ta cheia, só que não tem nada da minha mão.