Ir para conteúdo
  • 0

Vocações sumonar quantidades diferente de monstros.


Pergunta

Gostaria de uma ajuda com isso. Queria que vocações sumonassem quantidades diferentes de monstros. Por exemplo: Druid sumona até 4 e Sorc até 2.
Tenho um script pra por nas source, mas ele não é compatível com a que uso, que é a tfs 0.3.6. Se alguém souber modificá-la, só pedir pra eu mandar.
Se possível, algum pra fazer vocações poderem sumonar alguns monstros e outra não. Por exemplo: Druid sumona Dragon e Sorc não.

 

De ante mão, obrigado a quem puder ajudar.


up


up

Link para o comentário
https://xtibia.com/forum/topic/238436-voca%C3%A7%C3%B5es-sumonar-quantidades-diferente-de-monstros/
Compartilhar em outros sites

Posts Recomendados

  • 0

Ok, obrigado. Você viu meu edit sobre o problema de sumonar qualquer monstro?

  • 0

Ok. Vou pensar em uma forma de contornar isso. (O q tenho em mente eh fazer uma tabela com o nome de todos os monstros possíveis de sumonar)

  • 0

Se não for pedir de mais, tem como montar uma com monstros com restrição de vocação também? Tipo: Druid pode sumonar Dragon mas Sorc não.

  • 0

Ao inves de botar todos os monstros sumonaveis em uma table, melhor fazer if getMonsterInfo(name).summonable then, usa tabela soh pra fazer vocaçoes poderem sumonar monstros que nao sejam sumonaveis.

 

So tem um problema, players soh vao consiguir sumonar esses monstros se tiver a flag "convinceable" no xml do monstro. Então voce teria que retirar a runa que da convince pra nao ter problema ou entao mudar o code dela tambem.

Editado por MatheusMkalo
  • 0

Tirar a runa pra mim ta tranquilo, se a magia sair desse jeito como falei, pra mim vai estar ótima e estarei muito agradecido. =D

  • 0

Dei uma aperfeiçoada no script (para melhorar o desempenho), porém não sei se está sem erros:

EDIT: coloquei para remover a mana e para ter exhaustion, já.

local mana = 50 --custo de mana
local storage = 79845 --storage para o exhaustion
local tempo = 5 --em segundos

local monsters = {
[1] = {summons = {"rat", "dragon"}, maxSummons = 2},
[2] = {summons = {"rat", "dragon"}, maxSummons = 4},
[5] = {summons = {"rat", "dragon"}, maxSummons = 4},
[6] = {summons = {"rat", "dragon"}, maxSummons = 6}
}

function onSay(cid, words, param, channel)
if exhaustion.check(cid, storage) then
doPlayerSendTextMessage(cid, 22, "You are exhausted.")
return true
end
	--Player Status
	local playerpos = getPlayerPosition(cid)

	for k, v in pairs(monsters[getPlayerVocation(cid)].summons) do
		if (param == v)then
	   
			if (monsters[getPlayerVocation(cid)]) and #getCreatureSummons(cid) >= monsters[getPlayerVocation(cid)].maxSummons then
				return doPlayerSendCancel(cid, "Você já tem sumons demais.")
				
				if (param == '') then
				doPlayerSendCancel(cid,7,'Sorry not enough parameters.')
				return true
				end
			--Summon
			doConvinceCreature(cid, doCreateMonster(param, playerpos))
			doPlayerAddMana(cid, -mana, false)
			exhaustion.set(cid, storage, tempo)
			doSendMagicEffect(playerpos, 2)
			return true
			end
		end
	end
end
Editado por Danihcv
  • 0

 

Dei uma aperfeiçoada no script (para melhorar o desempenho), porém não sei se está sem erros:

 

EDIT: coloquei para remover a mana e para ter exhaustion, já.

local mana = 50 --custo de mana
local storage = 79845 --storage para o exhaustion
local tempo = 5 --em segundos

local monsters = {
[1] = {summons = {"rat", "dragon"}, maxSummons = 2},
[2] = {summons = {"rat", "dragon"}, maxSummons = 4},
[5] = {summons = {"rat", "dragon"}, maxSummons = 4},
[6] = {summons = {"rat", "dragon"}, maxSummons = 6}
}

function onSay(cid, words, param, channel)
if exhaustion.check(cid, storage) then
doPlayerSendTextMessage(cid, 22, "You are exhausted.")
return true
end
	--Player Status
	local playerpos = getPlayerPosition(cid)

	for k, v in pairs(monsters[getPlayerVocation(cid)].summons) do
		if (param == v)then
	   
			if (monsters[getPlayerVocation(cid)]) and #getCreatureSummons(cid) >= monsters[getPlayerVocation(cid)].maxSummons then
				return doPlayerSendCancel(cid, "Você já tem sumons demais.")
				
				if (param == '') then
				doPlayerSendCancel(cid,7,'Sorry not enough parameters.')
				return true
				end
			--Summon
			doConvinceCreature(cid, doCreateMonster(param, playerpos))
			doPlayerAddMana(cid, -mana, false)
			exhaustion.set(cid, storage, tempo)
			doSendMagicEffect(playerpos, 2)
			return true
			end
		end
	end
end

 

Tá muito bom cara, só tem o problema da runa e o utevo res, sendo preciso tirar ambos do servidor. Não tem como transformar isso em magia? Ou, pelo menos, quando o player tentar sumonar um mostro que não pode, mandar uma mensagem, do tipo: "You can't summon this monster."

  • 0

Bom, vc terá que remover a spell do servidor. E após removê-la, colocar na tag xml da talkaction:

words="utevo res"

Quanto à runa, manda o script dela que eu modifico.

 

 

 

Sobre a mensagem de não poder sumonar, aqui está:

 

local mana = 50 --custo de mana
local storage = 79845 --storage para o exhaustion
local tempo = 5 --em segundos

local monsters = {
[1] = {summons = {"rat", "dragon"}, maxSummons = 2},
[2] = {summons = {"rat", "dragon"}, maxSummons = 4},
[5] = {summons = {"rat", "dragon"}, maxSummons = 4},
[6] = {summons = {"rat", "dragon"}, maxSummons = 6}
}

function onSay(cid, words, param, channel)
if exhaustion.check(cid, storage) then
doPlayerSendTextMessage(cid, 22, "You are exhausted.")
return true
end
	--Player Status
	local playerpos = getPlayerPosition(cid)

	for k, v in pairs(monsters[getPlayerVocation(cid)].summons) do
		if (param == v)then
	   
			if (monsters[getPlayerVocation(cid)]) and #getCreatureSummons(cid) >= monsters[getPlayerVocation(cid)].maxSummons then
				return doPlayerSendCancel(cid, "Você já tem sumons demais.")
				
				if (param == '') then
				doPlayerSendCancel(cid,7,'Sorry not enough parameters.')
				return true
				end
			--Summon
			doConvinceCreature(cid, doCreateMonster(param, playerpos))
			doPlayerAddMana(cid, -mana, false)
			exhaustion.set(cid, storage, tempo)
			doSendMagicEffect(playerpos, 2)
			return true
			end
		else
		doPlayerSendCancel(cid, "You can't summon this monster.")
		end
	end
end

 

 

  • 0

Bom, vc terá que remover a spell do servidor. E após removê-la, colocar na tag xml da talkaction:

 

words="utevo res"

Quanto à runa, manda o script dela que eu modifico.

 

 

 

Sobre a mensagem de não poder sumonar, aqui está:

 

 

local mana = 50 --custo de mana
local storage = 79845 --storage para o exhaustion
local tempo = 5 --em segundos

local monsters = {
[1] = {summons = {"rat", "dragon"}, maxSummons = 2},
[2] = {summons = {"rat", "dragon"}, maxSummons = 4},
[5] = {summons = {"rat", "dragon"}, maxSummons = 4},
[6] = {summons = {"rat", "dragon"}, maxSummons = 6}
}

function onSay(cid, words, param, channel)
if exhaustion.check(cid, storage) then
doPlayerSendTextMessage(cid, 22, "You are exhausted.")
return true
end
	--Player Status
	local playerpos = getPlayerPosition(cid)

	for k, v in pairs(monsters[getPlayerVocation(cid)].summons) do
		if (param == v)then
	   
			if (monsters[getPlayerVocation(cid)]) and #getCreatureSummons(cid) >= monsters[getPlayerVocation(cid)].maxSummons then
				return doPlayerSendCancel(cid, "Você já tem sumons demais.")
				
				if (param == '') then
				doPlayerSendCancel(cid,7,'Sorry not enough parameters.')
				return true
				end
			--Summon
			doConvinceCreature(cid, doCreateMonster(param, playerpos))
			doPlayerAddMana(cid, -mana, false)
			exhaustion.set(cid, storage, tempo)
			doSendMagicEffect(playerpos, 2)
			return true
			end
		else
		doPlayerSendCancel(cid, "You can't summon this monster.")
		end
	end
end

 

 

 

Ta dando end expected to close if at line 25. To usando esse site >http://www.lua.org/cgi-bin/demo<pra tentar ir resolvendo, mas manda acrescentar 'end' assima do 'else' a ponto do script fechar com o 'else' fora do script. E a runa é a Convice Creature, ela é por função como o utevo res.

 

Editado por gabrielvs
  • 0

Pronto

local mana = 50 --custo de mana
local storage = 79845 --storage para o exhaustion
local tempo = 5 --em segundos

local monsters = {
[1] = {summons = {"rat", "dragon"}, maxSummons = 2},
[2] = {summons = {"rat", "dragon"}, maxSummons = 4},
[5] = {summons = {"rat", "dragon"}, maxSummons = 4},
[6] = {summons = {"rat", "dragon"}, maxSummons = 6}
}

function onSay(cid, words, param, channel)
if exhaustion.check(cid, storage) then
doPlayerSendTextMessage(cid, 22, "You are exhausted.")
return true
end
	--Player Status
	local playerpos = getPlayerPosition(cid)

	for k, v in pairs(monsters[getPlayerVocation(cid)].summons) do
		if (param == v)then

			if (monsters[getPlayerVocation(cid)]) and #getCreatureSummons(cid) >= monsters[getPlayerVocation(cid)].maxSummons then
				return doPlayerSendCancel(cid, "Você já tem sumons demais.")
			else
			--Summon
			doConvinceCreature(cid, doCreateMonster(param, playerpos))
			doPlayerAddMana(cid, -mana, false)
			exhaustion.set(cid, storage, tempo)
			doSendMagicEffect(playerpos, 2)
			return true
			end
		else
		doPlayerSendCancel(cid, "You can't summon this monster.")
		end
	end
return true
end
  • 0

 

Pronto

local mana = 50 --custo de mana
local storage = 79845 --storage para o exhaustion
local tempo = 5 --em segundos

local monsters = {
[1] = {summons = {"rat", "dragon"}, maxSummons = 2},
[2] = {summons = {"rat", "dragon"}, maxSummons = 4},
[5] = {summons = {"rat", "dragon"}, maxSummons = 4},
[6] = {summons = {"rat", "dragon"}, maxSummons = 6}
}

function onSay(cid, words, param, channel)
if exhaustion.check(cid, storage) then
doPlayerSendTextMessage(cid, 22, "You are exhausted.")
return true
end
	--Player Status
	local playerpos = getPlayerPosition(cid)

	for k, v in pairs(monsters[getPlayerVocation(cid)].summons) do
		if (param == v)then

			if (monsters[getPlayerVocation(cid)]) and #getCreatureSummons(cid) >= monsters[getPlayerVocation(cid)].maxSummons then
				return doPlayerSendCancel(cid, "Você já tem sumons demais.")
			else
			--Summon
			doConvinceCreature(cid, doCreateMonster(param, playerpos))
			doPlayerAddMana(cid, -mana, false)
			exhaustion.set(cid, storage, tempo)
			doSendMagicEffect(playerpos, 2)
			return true
			end
		else
		doPlayerSendCancel(cid, "You can't summon this monster.")
		end
	end
return true
end

 

Muito obrigado cara. Nessa table há possibilidade de acrescentar level mínimo em que pode sumonar o monstro? Porque assim a qualquer level pode sumonar.

  • 0

Aqui está:

local mana = 50 --custo de mana
local storage = 79845 --storage para o exhaustion
local tempo = 5 --em segundos

local monsters = {
[1] = {summons = {"rat", "dragon"}, maxSummons = 2, minLevel = 10},
[2] = {summons = {"rat", "dragon"}, maxSummons = 4, minLevel = 10},
[5] = {summons = {"rat", "dragon"}, maxSummons = 4, minLevel = 10},
[6] = {summons = {"rat", "dragon"}, maxSummons = 6, minLevel = 10}
}

function onSay(cid, words, param, channel)
if exhaustion.check(cid, storage) then
doPlayerSendTextMessage(cid, 22, "You are exhausted.")
return true
end
	--Player Status
	local playerpos = getPlayerPosition(cid)

	for k, v in pairs(monsters[getPlayerVocation(cid)].summons) do
		if (param == v)then

			if (monsters[getPlayerVocation(cid)]) and #getCreatureSummons(cid) >= monsters[getPlayerVocation(cid)].maxSummons then
				return doPlayerSendCancel(cid, "Você já tem sumons demais.")
			else
			--Summon
				if getPlayerLevel(cid) < monsters[getPlayerVocation(cid)].minLevel then
					return doPlayerSendCancel(cid, "Level insuficiente.")
				else
					doConvinceCreature(cid, doCreateMonster(param, playerpos))
					doPlayerAddMana(cid, -mana, false)
					exhaustion.set(cid, storage, tempo)
					doSendMagicEffect(playerpos, 2)
				end
			return true
			end
		else
		doPlayerSendCancel(cid, "You can't summon this monster.")
		end
	end
return true
end
  • 0

Só uma pergunta, pra terminar de te encher. xD
Uma table desse jeito:
[1] = {summons = {"rat"}, maxSummons = 2, minLevel = 10, mana = 50},
[2] = {summons = {"rat", maxSummons = 4, minLevel = 10, mana = 50},

[5] = {summons = {"rat"}, maxSummons = 4, minLevel = 10, mana = 50},

[6] = {summons = {"rat"}, maxSummons = 6, minLevel = 10, mana = 50},

[5] = {summons = {"dragon"}, maxSummons = 4, minLevel = 50, mana = 500},

[6] = {summons = {"dragon"}, maxSummons = 6, minLevel = 50, mana = 500}

 

Fica viável?

 

*Fiquei sem REP, quando der, darei mais.

Editado por gabrielvs
  • 0

Mas tipo, nesse jeito:

 

local monsters = {
[1] = {summons = {"rat", "dragon"}, maxSummons = 2, minLevel = 10, mana = 50},
[2] = {summons = {"rat", "dragon"}, maxSummons = 4, minLevel = 10, mana = 50},
[5] = {summons = {"rat", "dragon"}, maxSummons = 4, minLevel = 10, mana = 500},
[6] = {summons = {"rat", "dragon"}, maxSummons = 6, minLevel = 10, mana = 500}
}

Druid e Sorc vão gastar 50 de mana para invocar algum dos dois, enquanto MS e ED vão gastar 500 para invocar os mesmos monstros. Além de invocarem ambos, rat e dragon no level 10.

Pensei em separar por monstro e level, nesse estilo:

local monsters = {
[1] = {summons = {"rat", "wolf", "bear"}, maxSummons = 2, minLevel = 10, mana = 50},

[1] = {summons = {"orc warlord", "giant spider", "dragon"}, maxSummons = 2, minLevel = 50, mana = 500},

[2] = {summons = {"rat", "wolf", "bear"}, maxSummons = 4, minLevel = 10, mana = 50},

[2] = {summons = {"orc warlord", "giant spider", "dragon"}, maxSummons = 4, minLevel = 50, mana = 500},

......

}
(Encurtei só para exemplificar.)

Sacasse?

×
×
  • Criar Novo...