UR
action

Script movements não esta executando da forma correta

Por UroTTa, 21 de abr. de 2014 em Archived

dúvida
script
42
3.8k
UroTTaU
21 de abril de 2014 às 13:37

É @demonbholder, não deu.

 

Tava precisando muito desse script e ninguem consegue me ajudar wacko.png

dalvorsnD
21 de abril de 2014 às 13:48

É @demonbholder, não deu.

 

Tava precisando muito desse script e ninguem consegue me ajudar :wacko:

To na estrada, quando chegar dou uma olhada, mas ja fala de uma vez qual distro ta usando.e que erros aparecem

Pode ir printando os escopos tambem pra.saber em qual condicional.ele esta parando

UroTTaU
21 de abril de 2014 às 13:52

Estou usando distro 1.0 versão 10.37, o script não da nenhum erro so que ele não obedece oque era pra ser feito. Acho que não esta checando os 4 jogadores nas posições que devia estar.

21 de abril de 2014 às 13:57

Estranho que ele ta fazendo o start ficar 4, e pra isso, ele tem que pegar o storage dos players nas 4 posições...

 

E outra, se você ta falando que com só 1 ele já ta dando, deveria dar erro quando ele chama a função doCreatureSay, já que ele não acha a criatura.

 

Vou ficar aguardando o resultado.

Editado Abril 21 por Demonbholder

UroTTaU
21 de abril de 2014 às 14:12

O seu ultimo script agora deu erro quando somente um passa na posição:

 

Lua Script Error: [MoveEvents Interface]
data/movements/scripts/children of the revolution quest/childrenOfTheRevolutionQuestClick.lua:onStepIn
...volution quest/childrenOfTheRevolutionQuestClick.lua:44: attempt to call global 'getThingFromPos' (a nil value)
stack traceback:
[C]: in function 'getThingFromPos'
...volution quest/childrenOfTheRevolutionQuestClick.lua:44: in function <...volution quest/childrenOfTheRevolutionQuestClick.lua:39>

21 de abril de 2014 às 14:16

Sim, o Techrlz falou que essa função não existe mais no tfs 1.0, mas não era a esse erro que eu tava me referindo.

UroTTaU
21 de abril de 2014 às 14:24

E o seu ultimo script que tu edito, estava percebendo que esta checando as 4 posições sim, porque,

 

function onStepIn(cid, item, position, lastPosition)
start = 0
if item.actionid == 8014 then
for i = 1, 4 do
local creature = getTopCreature(pos).uid
if creature > 0 then
if isPlayer(creature) then
if getGlobalStorageValue(8014) < 1 then
if getPlayerStorageValue(creature, 1050) == 19 then
doCreatureSay(creature, "A clicking sound tatters the silence.", TALKTYPE_ORANGE_1)
start = start + 1
end
end
end
end
end

 

 

Sempre quando um jogador passa no tile solta o doCreatureSay em cima dos outros jogadores que esta em suas respectivas posições, so que quando os 4 esta no tile o script não inicia o evento e essa mensagem o certo seria no final quando iniciase o evento.

 

 

if start == 4 then
doCreatureSay(creature, "A clicking sound tatters the silence.", TALKTYPE_ORANGE_1)
doCreateItem(3687, 1, {x = 33265, y = 31116, z = 8})
doCreateItem(3219, 1, {x = 33265, y = 31116, z = 7})
addEvent(TirarEscada, 30 * 1000)
setGlobalStorageValue(8014, 1)
addEvent(setGlobalStorageValue, 8014, 0)
creature = ""
for k = 1, 4 do
for j = 1, 20 do
if(k < 3) then
creature = "eternal guardian"
else
creature = "lizard chosen"
end
summonPos = {x = math.random(33239, 33295), y = math.random(31100, 31132), z = 7}
addEvent(doSummonCreature, k * 30 * 1000, creature, summonPos)
addEvent(doSendMagicEffect, k * 30 * 1000, summonPos, CONST_ME_TELEPORT)
end
end
addEvent(doClearMissionArea, 5 * 30 * 1000, {x = 33239, y = 31100, z = 7}, {x = 33295, y = 31132, z = 7})
addEvent(setPlayerStorageValue, 5 * 30 * 1000, cid, 15335, 2)
addEvent(setPlayerStorageValue, 5 * 30 * 1000, cid, 1050, 20)
end
end

return true
end

21 de abril de 2014 às 14:34

...

Editado Abril 21 por Demonbholder

UroTTaU
21 de abril de 2014 às 14:42

O script funcionou porem, tem uns detalhes:

 

Quando um jogador entra no tile e pra mandar uma mensagem:

 

Children13.png

 

E o seguinte, se tem 1 jogador numa pos manda 1x, se tem 2 manda 2x, se tem 3, vai mandar 4x o docreaturesay e o certo seria mandar somente uma.

 

Outro detalhe tambem é que quando as funções fosse executada era pra executar um docreaturesay no meio da sala avisando, mas não consegui por.

 

Children14.png

 

 

codigo abaixo:

local pos = {
	{x = 33258, y = 31079, z = 8},
	{x = 33259, y = 31089, z = 8},
	{x = 33266, y = 31084, z = 8},
	{x = 33263, y = 31093, z = 8}
}


function doClearMissionArea(fromPos, toPos)
	for x = fromPos.x, toPos.x do
		for y = fromPos.y, toPos.y do
			for z = fromPos.z, toPos.z do
				if(getTopCreature({x = x, y = y, z = z}).uid > 0) then
					if(isPlayer(getTopCreature({x = x, y = y, z = z}).uid)) then
						doTeleportThing(getTopCreature({x = x, y = y, z = z}).uid, {x = 33353, y = 31410, z = 8})
						doSendMagicEffect({x = 33353, y = 31410, z = 8}, CONST_ME_TELEPORT)
					else
						doRemoveCreature(getTopCreature({x = x, y = y, z = z}).uid)
					end
				end
			end
		end
	end
	return true
end

function TirarEscada()
    local escada = getTileItemById({x = 33265, y = 31116, z = 8}, 3687)
    local escada2 = getTileItemById({x = 33265, y = 31116, z = 7}, 3219)
    if escada then
        doRemoveItem(escada.uid, 1)
	doRemoveItem(escada2.uid, 1)
	doCreateItem(11097, 1, {x = 33265, y = 31116, z = 7})
    end
    return true
end


function onStepIn(cid, item, position, lastPosition)
	start = 0
	if item.actionid == 8014 then
		for i = 1, 4 do
			local creature = getTopCreature(pos[i]).uid
			if creature > 0 then
				if isPlayer(creature) then
					if getGlobalStorageValue(8014) < 1 then
						if getPlayerStorageValue(creature, 1050) == 19 then
						doCreatureSay(cid, "A clicking sound tatters the silence.", TALKTYPE_ORANGE_1)
							start = start + 1
						end
					end
				end
			end
		end
		if start == 4 then
			doCreatureSay("The army is complete again. You hear a hatch opening elsewhere, followed by a grinding sound.", TALKTYPE_ORANGE_1, false, cid, {x =  33261, y = 31086, z = 8})
			doCreateItem(3687, 1, {x = 33265, y = 31116, z = 8})
			doCreateItem(3219, 1, {x = 33265, y = 31116, z = 7})
			addEvent(TirarEscada, 30 * 1000)
			setGlobalStorageValue(8014, 1)
			addEvent(setGlobalStorageValue, 8014, 0)
			creature = ""
			for k = 1, 4 do
				for j = 1, 20 do
					if(k < 3) then
						creature = "eternal guardian"
					else
						creature = "lizard chosen"
					end
					summonPos = {x = math.random(33239, 33295), y = math.random(31100, 31132), z = 7}
					addEvent(doSummonCreature, k * 30 * 1000, creature, summonPos)
					addEvent(doSendMagicEffect, k * 30 * 1000, summonPos, CONST_ME_TELEPORT)
				end
			end
			addEvent(doClearMissionArea, 5 * 30 * 1000, {x = 33239, y = 31100, z = 7}, {x = 33295, y = 31132, z = 7})
			addEvent(setPlayerStorageValue, 5 * 30 * 1000, cid, 15335, 2)
			addEvent(setPlayerStorageValue, 5 * 30 * 1000, cid, 1050, 20)
		end
	end

return true
end
21 de abril de 2014 às 14:51

Então o código antigo tava funcionando? Não sei se eu entendi direito o que você quer, vê se é isso:

local pos = {
	{x = 33258, y = 31079, z = 8},
	{x = 33259, y = 31089, z = 8},
	{x = 33266, y = 31084, z = 8},
	{x = 33263, y = 31093, z = 8}
}


function doClearMissionArea(fromPos, toPos)
	for x = fromPos.x, toPos.x do
		for y = fromPos.y, toPos.y do
			for z = fromPos.z, toPos.z do
				if(getTopCreature({x = x, y = y, z = z}).uid > 0) then
					if(isPlayer(getTopCreature({x = x, y = y, z = z}).uid)) then
						doTeleportThing(getTopCreature({x = x, y = y, z = z}).uid, {x = 33353, y = 31410, z = 8})
						doSendMagicEffect({x = 33353, y = 31410, z = 8}, CONST_ME_TELEPORT)
					else
						doRemoveCreature(getTopCreature({x = x, y = y, z = z}).uid)
					end
				end
			end
		end
	end
	return true
end

function TirarEscada()
    local escada = getTileItemById({x = 33265, y = 31116, z = 8}, 3687)
    local escada2 = getTileItemById({x = 33265, y = 31116, z = 7}, 3219)
    if escada then
        doRemoveItem(escada.uid, 1)
	doRemoveItem(escada2.uid, 1)
	doCreateItem(11097, 1, {x = 33265, y = 31116, z = 7})
    end
    return true
end


function onStepIn(cid, item, position, lastPosition)
	start = 0
	if item.actionid == 8014 then
		for i = 1, 4 do
			local creature = getTopCreature(pos[i]).uid
			if creature > 0 then
				if isPlayer(creature) then
					if getGlobalStorageValue(8014) < 1 then
						if getPlayerStorageValue(creature, 1050) == 19 then
							start = start + 1
						end
					end
				end
			end
		end
		if start == 4 then
			doCreatureSay(cid, "A clicking sound tatters the silence.", TALKTYPE_ORANGE_1)
			doSendAnimatedText({x =  33261, y = 31086, z = 8}, "The army is complete again. You hear a hatch opening elsewhere, followed by a grinding sound.", TALKTYPE_ORANGE_1)
			doCreateItem(3687, 1, {x = 33265, y = 31116, z = 8})
			doCreateItem(3219, 1, {x = 33265, y = 31116, z = 7})
			addEvent(TirarEscada, 30 * 1000)
			setGlobalStorageValue(8014, 1)
			addEvent(setGlobalStorageValue, 8014, 0)
			creature = ""
			for k = 1, 4 do
				for j = 1, 20 do
					if(k < 3) then
						creature = "eternal guardian"
					else
						creature = "lizard chosen"
					end
					summonPos = {x = math.random(33239, 33295), y = math.random(31100, 31132), z = 7}
					addEvent(doSummonCreature, k * 30 * 1000, creature, summonPos)
					addEvent(doSendMagicEffect, k * 30 * 1000, summonPos, CONST_ME_TELEPORT)
				end
			end
			addEvent(doClearMissionArea, 5 * 30 * 1000, {x = 33239, y = 31100, z = 7}, {x = 33295, y = 31132, z = 7})
			addEvent(setPlayerStorageValue, 5 * 30 * 1000, cid, 15335, 2)
			addEvent(setPlayerStorageValue, 5 * 30 * 1000, cid, 1050, 20)
		end
	end

return true
end

Editado Abril 21 por Demonbholder

TechrlzT
21 de abril de 2014 às 14:54

 

Então o código antigo tava funcionando? Não sei se eu entendi direito o que você quer, vê se é isso:

local pos = {
	{x = 33258, y = 31079, z = 8},
	{x = 33259, y = 31089, z = 8},
	{x = 33266, y = 31084, z = 8},
	{x = 33263, y = 31093, z = 8}
}


function doClearMissionArea(fromPos, toPos)
	for x = fromPos.x, toPos.x do
		for y = fromPos.y, toPos.y do
			for z = fromPos.z, toPos.z do
				if(getTopCreature({x = x, y = y, z = z}).uid > 0) then
					if(isPlayer(getTopCreature({x = x, y = y, z = z}).uid)) then
						doTeleportThing(getTopCreature({x = x, y = y, z = z}).uid, {x = 33353, y = 31410, z = 8})
						doSendMagicEffect({x = 33353, y = 31410, z = 8}, CONST_ME_TELEPORT)
					else
						doRemoveCreature(getTopCreature({x = x, y = y, z = z}).uid)
					end
				end
			end
		end
	end
	return true
end

function TirarEscada()
    local escada = getTileItemById({x = 33265, y = 31116, z = 8}, 3687)
    local escada2 = getTileItemById({x = 33265, y = 31116, z = 7}, 3219)
    if escada then
        doRemoveItem(escada.uid, 1)
	doRemoveItem(escada2.uid, 1)
	doCreateItem(11097, 1, {x = 33265, y = 31116, z = 7})
    end
    return true
end


function onStepIn(cid, item, position, lastPosition)
	start = 0
	if item.actionid == 8014 then
		for i = 1, 4 do
			local creature = getTopCreature(pos[i]).uid
			if creature > 0 then
				if isPlayer(creature) then
					if getGlobalStorageValue(8014) < 1 then
						if getPlayerStorageValue(creature, 1050) == 19 then
							start = start + 1
						end
					end
				end
			end
		end
		if start == 4 then
			doCreatureSay(cid, "A clicking sound tatters the silence.", TALKTYPE_ORANGE_1)
			doSendAnimatedText({x =  33261, y = 31086, z = 8}, "The army is complete again. You hear a hatch opening elsewhere, followed by a grinding sound.", TALKTYPE_ORANGE_1)
			doCreateItem(3687, 1, {x = 33265, y = 31116, z = 8})
			doCreateItem(3219, 1, {x = 33265, y = 31116, z = 7})
			addEvent(TirarEscada, 30 * 1000)
			setGlobalStorageValue(8014, 1)
			addEvent(setGlobalStorageValue, 8014, 0)
			creature = ""
			for k = 1, 4 do
				for j = 1, 20 do
					if(k < 3) then
						creature = "eternal guardian"
					else
						creature = "lizard chosen"
					end
					summonPos = {x = math.random(33239, 33295), y = math.random(31100, 31132), z = 7}
					addEvent(doSummonCreature, k * 30 * 1000, creature, summonPos)
					addEvent(doSendMagicEffect, k * 30 * 1000, summonPos, CONST_ME_TELEPORT)
				end
			end
			addEvent(doClearMissionArea, 5 * 30 * 1000, {x = 33239, y = 31100, z = 7}, {x = 33295, y = 31132, z = 7})
			addEvent(setPlayerStorageValue, 5 * 30 * 1000, cid, 15335, 2)
			addEvent(setPlayerStorageValue, 5 * 30 * 1000, cid, 1050, 20)
		end
	end

return true
end

doSendAnimatedText não existe no tfs 1.0

UroTTaU
21 de abril de 2014 às 14:54

E mais ou menos isso so que o seu doSendAnimatedText acho que não existe essa função no 1.0.

 

[C]: in function 'debugPrint'
data/compat.lua:305: in function 'doSendAnimatedText'
...volution quest/childrenOfTheRevolutionQuestClick.lua:48: in function <...volution quest/childrenOfTheRevolutionQuestClick.lua:39>

 

E essa mensagem

 

doCreatureSay(cid, "A clicking sound tatters the silence.", TALKTYPE_ORANGE_1)

 

Era pra quando o jogador pisase no tile ja soltava ela. Não quando executase as funções.

21 de abril de 2014 às 14:58
function onStepIn(cid, item, position, lastPosition)
	start = 0
	if item.actionid == 8014 then
		doCreatureSay(cid, "A clicking sound tatters the silence.", TALKTYPE_ORANGE_1)
		for i = 1, 4 do
			local creature = getTopCreature(pos[i]).uid
			if creature > 0 then
				if isPlayer(creature) then
					if getGlobalStorageValue(8014) < 1 then
						if getPlayerStorageValue(creature, 1050) == 19 then
							start = start + 1
						end
					end
				end
			end
		end
		if start == 4 then
			doCreateItem(3687, 1, {x = 33265, y = 31116, z = 8})
			doCreateItem(3219, 1, {x = 33265, y = 31116, z = 7})
			addEvent(TirarEscada, 30 * 1000)
			setGlobalStorageValue(8014, 1)
			addEvent(setGlobalStorageValue, 8014, 0)
			creature = ""
			for k = 1, 4 do
				for j = 1, 20 do
					if(k < 3) then
						creature = "eternal guardian"
					else
						creature = "lizard chosen"
					end
					summonPos = {x = math.random(33239, 33295), y = math.random(31100, 31132), z = 7}
					addEvent(doSummonCreature, k * 30 * 1000, creature, summonPos)
					addEvent(doSendMagicEffect, k * 30 * 1000, summonPos, CONST_ME_TELEPORT)
				end
			end
			addEvent(doClearMissionArea, 5 * 30 * 1000, {x = 33239, y = 31100, z = 7}, {x = 33295, y = 31132, z = 7})
			addEvent(setPlayerStorageValue, 5 * 30 * 1000, cid, 15335, 2)
			addEvent(setPlayerStorageValue, 5 * 30 * 1000, cid, 1050, 20)
		end
	end

return true
end

Coloquei pra mandar qnd ele pisar no tile.

 

A respeito do animated text, eu não to com nada aqui pra ver qual função substituiu ela, se alguém souber, ajuda ele ai.

TechrlzT
21 de abril de 2014 às 14:58

Passei pra ele o seguinte code e resolveu:

 

doCreatureSayWithRadius(cid, "The army is complete again. You hear a hatch opening elsewhere, followed by a grinding sound.", TALKTYPE_ORANGE_1, 33261, 31086, {x = 33261, y = 31086, z = 8})

21 de abril de 2014 às 15:00

Boa, essa função é nova ou já tinha antes? Não lembro de ter visto ela...