Ir para conteúdo

Featured Replies

Postado

Olá a todos, estou aqui novamente. Estou tentando substituir a magia de summon do meu servidor TFS 0.4.0 (8.6) e para isso tentei utilizar um script para talkaction publicado pelo @admkhbr que encontrei neste tópico e que me pareceu bem funcional para meus objetivos. Entretanto, ao abrir o servidor me deparo com o seguinte erro no console:

 

Description:
[9:26:49.447] data/talkactions/scripts/callofnature1.lua:33: bad argument #1 to 'lower' (string expected, got nil)

 

Alguém tem alguma ideia de como fazê-lo funcionar? Ou mesmo pode me sugerir um script que substitua o summon creature que esteja funcionando para TFS 0.4.0 (8.6)?

Agradecido!

 

Segue o código do script:

-- General Configuration
		local lvlmin = 1
		local exhaustion = 3000
		local needlearn = 1
		local learnstorage = 77890
		local vocations = {2, 3}
		local maxsummons = getConfigValue("maxPlayerSummons")
		summonlist =	{
				[1] = {'rat', 4},
				[2] = {'bat', 4},
				[3] = {'bug', 4},
				[4] = {'snake', 4}
				}

		-- Player Info
		local lvl = getPlayerLevel(cid)
		local vocp = getPlayerVocation(cid)
		local mana = getCreatureMana(cid)
		local pos = getCreaturePosition(cid)

		-- Statements
		local learned = 0
		local voccan = 0
		local cansummon = 0
		local manacost = 0
		local exhaustorage = 77889

		-- Loop Control
		local vocs = #vocations
		local slistn = #summonlist

		-- Conversions
		param = string.lower(param)
		param = string.gsub(param, '\"', '')
		exhaustion = exhaustion/1000

		-- Initial Verification
		if needlearn == 0 then learned = 1 end
		if needlearn == 1 and getPlayerStorageValue(cid, learnstorage) > 0 then learned = 1 end

		while vocs > 0 do
			if vocp == vocations[vocs] then voccan = 1 end
			vocs = vocs - 1
		end

		while slistn > 0 do
			if param == summonlist[slistn][1] then
				cansummon = 1
				manacost = summonlist[slistn][2]
			end
			slistn = slistn - 1
		end

		-- Summon Monster
		if getTilePzInfo(pos) then
			doPlayerSendCancel(cid, 'This action is not permitted in a protection zone.')
		else

			if lvl < lvlmin then
				doSendMagicEffect(pos, CONST_ME_POFF)
				doPlayerSendCancel(cid, 'You do not have enough level.')
			else

				if learned == 1 then
					if voccan == 1 then
						if getPlayerStorageValue(cid, exhaustorage) >= os.time() then
							doSendMagicEffect(pos, CONST_ME_POFF)
							doPlayerSendCancel(cid, 'You are exhausted.')
						else
							if cansummon == 1 then
								if mana >= manacost then
									if #getCreatureSummons(cid) < maxsummons then
										doSendMagicEffect(pos, CONST_ME_MAGIC_BLUE)
										doCreatureAddMana(cid, 0-manacost, false)
										local summon = doCreateMonster(param, pos)
										doConvinceCreature(cid, summon)
										doSendMagicEffect(getCreaturePosition(summon), CONST_ME_TELEPORT)
										setPlayerStorageValue(cid, exhaustorage, os.time()+exhaustion)
									else
										doSendMagicEffect(pos, CONST_ME_POFF)
										doPlayerSendCancel(cid, 'You cannot summon more creatures.')

									end
								else
									doSendMagicEffect(pos, CONST_ME_POFF)
									doPlayerSendCancel(cid, 'You do not have enough mana.')
								end
							else
								doSendMagicEffect(pos, CONST_ME_POFF)
								doPlayerSendCancel(cid, 'Sorry, not possible.')
							end
						end
					else
						doSendMagicEffect(pos, CONST_ME_POFF)
						doPlayerSendCancel(cid, 'Your vocation cannot use this spell.')
					end
				else
					doSendMagicEffect(pos, CONST_ME_POFF)
					doPlayerSendCancel(cid, 'You need to learn this spell first.')
				end

			end

		end
		
	return

 

Editado por Tadelho (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.9k

Informação Importante

Confirmação de Termo