GA
pedido

Vocações sumonar quantidades diferente de monstros.

Por gabriel28, 23 de dez. de 2015 em Scripts

34
5.1k
DanihcvD
26 de dezembro de 2015 às 02:27

Tranquilo. Amn a gnt resolve o q falta pra transformar em magia. ;)

gabriel28G
26 de dezembro de 2015 às 02:30

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

DanihcvD
26 de dezembro de 2015 às 02:33

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)

gabriel28G
26 de dezembro de 2015 às 02:37

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.

MatheusGladM
26 de dezembro de 2015 às 04:42

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 Dezembro 26 por MatheusMkalo

gabriel28G
26 de dezembro de 2015 às 05:06

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

DanihcvD
26 de dezembro de 2015 às 17:16

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 Dezembro 26 por Danihcv

gabriel28G
26 de dezembro de 2015 às 18:42

 

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."

DanihcvD
26 de dezembro de 2015 às 19:53

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

 

 

gabriel28G
26 de dezembro de 2015 às 20:58

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 Dezembro 26 por gabrielvs

DanihcvD
26 de dezembro de 2015 às 21:59

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
gabriel28G
26 de dezembro de 2015 às 22:18

 

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.

DanihcvD
26 de dezembro de 2015 às 22:31

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
gabriel28G
26 de dezembro de 2015 às 22:38

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 Dezembro 26 por gabrielvs

DanihcvD
26 de dezembro de 2015 às 23:45
Melhor resposta

A parte de implementar o custo da mana? Sim, sim. Dá pra usar:

local storage = 79845 --storage para o exhaustion
local tempo = 5 --em segundos

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}
}

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, -monsters[getPlayerVocation(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