Ir para conteúdo

Duvida Script Poi


Luquetes

Posts Recomendados

Queria um script que funcionasse e que fissesse issu na POI:

 

quando passar pelo trono das salas, automaticamente o player fikar com storagevalue, como amostra de q ele fez akela parte,

assim qnd ele passasse nas 7 salas, teria 7 storagevalues e poderia passar por uma porta.

 

Tenho esse script aki :

 

function onStepIn(cid, item, pos)

if item.uid == 10001 then

if getPlayerStorageValue(cid,1234561) == -1 then

setPlayerStorageValue(cid,1234561,1)

doPlayerSendTextMessage(cid,MESSAGE_EVENT_ADVANCE,'You have touched Verminor´s throne and absorbed some of his spirit.')

else

doPlayerSendTextMessage(cid,MESSAGE_EVENT_ADVANCE,'You have already absorbed some of Veminor´s spirit.')

end

elseif item.uid == 10002 then

if getPlayerStorageValue(cid,1234562) == -1 then

setPlayerStorageValue(cid,1234562,1)

doPlayerSendTextMessage(cid,MESSAGE_EVENT_ADVANCE,'You have touched Infernatil´s throne and absorbed some of his spirit.')

else

doPlayerSendTextMessage(cid,MESSAGE_EVENT_ADVANCE,'You have already absorbed some of Infernatil´s spirit.')

end

elseif item.uid == 10003 then

if getPlayerStorageValue(cid,1234563) == -1 then

setPlayerStorageValue(cid,1234563,1)

doPlayerSendTextMessage(cid,MESSAGE_EVENT_ADVANCE,'You have touched Tafariel´s throne and absorbed some of his spirit.')

else

doPlayerSendTextMessage(cid,MESSAGE_EVENT_ADVANCE,'You have already absorbed some of Tafariel´s spirit.')

end

elseif item.uid == 10004 then

if getPlayerStorageValue(cid,1234564) == -1 then

setPlayerStorageValue(cid,1234564,1)

doPlayerSendTextMessage(cid,MESSAGE_EVENT_ADVANCE,'You have touched Apocalypse´s throne and absorbed some of his spirit.')

else

doPlayerSendTextMessage(cid,MESSAGE_EVENT_ADVANCE,'You have already absorbed some of Apocalypse´s spirit.')

end

elseif item.uid == 10005 then

if getPlayerStorageValue(cid,1234565) == -1 then

setPlayerStorageValue(cid,1234565,1)

doPlayerSendTextMessage(cid,MESSAGE_EVENT_ADVANCE,'You have touched Pumin´s throne and absorbed some of his spirit.')

else

doPlayerSendTextMessage(cid,MESSAGE_EVENT_ADVANCE,'You have already absorbed some of Pumin´s spirit.')

end

elseif item.uid == 10006 then

if getPlayerStorageValue(cid,1234566) == -1 then

setPlayerStorageValue(cid,1234566,1)

doPlayerSendTextMessage(cid,MESSAGE_EVENT_ADVANCE,'You have touched Bazir´s throne and absorbed some of his spirit.')

else

doPlayerSendTextMessage(cid,MESSAGE_EVENT_ADVANCE,'You have already absorbed some of Bazir´s spirit.')

end

elseif item.uid == 10007 then

if getPlayerStorageValue(cid,1234567) == -1 then

setPlayerStorageValue(cid,1234567,1)

doPlayerSendTextMessage(cid,MESSAGE_EVENT_ADVANCE,'You have touched Ashfalor´s throne and absorbed some of his spirit.')

else

doPlayerSendTextMessage(cid,MESSAGE_EVENT_ADVANCE,'You have already absorbed some of Ashfalor´s spirit.')

end

elseif item.uid == 22222 and item.itemid == 1210 and pos == {x=57, y=263, z=5} then

if getPlayerStorageValue(cid,1234561) == -1 or getPlayerStorageValue(cid,1234562) == -1 or getPlayerStorageValue(cid,1234563) == -1 or getPlayerStorageValue(cid,1234564) == -1 or getPlayerStorageValue(cid,1234565) == -1 then

doTransformItem(item.uid,item.itemid+1)

doPlayerSendTextMessage(cid,MESSAGE_EVENT_ADVANCE,'Sorry, but you did not absorb enough energy!')

else

doPlayerSendTextMessage(cid,MESSAGE_EVENT_ADVANCE,'You absorbed enough energy! You may pass.')

end

end

return 1

end

----------------

 

mas n ta funcionando, alguem sabe pq?, alguem ajuda ai?

 

urgent,

vlw!

Editado por Luquetes
Link para o comentário
Compartilhar em outros sites

sinceramente? só bati o olho no seu script, nem analisei muito ;)

 

a dica que eu tenho é a seguinte:

 

assumindo que vc já definiu no mapEditor todos os actionId dos tiles e eles são

1234561, 1234562, 1234563, 1234564, 1234565, 1234566, 1234567, 1234568

 

agora vc vai no arquivo data\movements\movements.xml e adiciona:

<movement event="stepIn" actionid="123456X" script="poi.lua" />

onde X = terminação do tile, ao final, vc terá que ter 8 novos movements, todos apontando para o arquivo poi.lua

 

vamos ao que interessa data\movements\scripts\poi.lua

local vars = {"Verminor","Infernatil","Tafariel","Apocalypse","Pumim","Bazir","Ashfalor"}

function onStepIn(cid, item, pos)
  if (not isPlayer(cid)) then return FALSE end
  for i=1,7 do
  if item.actionid == 123456..i then
	 if getPlayerStorageValue(cid,123456..i) == -1 then
	 setPlayerStorageValue(cid,123456..i,1)
	 doPlayerSendTextMessage(cid,MESSAGE_EVENT_ADVANCE,'You have touched '..var[i]..'\'s throne and absorbed some of his spirit.')
	 else doPlayerSendTextMessage(cid,MESSAGE_EVENT_ADVANCE,'You have already absorbed some '..vars[i]..'\'s spirit.') end
  end
  end
  if item.actionid == 1234568 then
  local spirits = 0
  for i=1,7 do spirits = spirits + getPlayerStorageValue(cid,123456..i) end
  if spirits == 7 then doPlayerSendTextMessage(cid,MESSAGE_EVENT_ADVANCE,'You\'ve absorbed enough energy! You may pass.')
  else
	 doTransformItem(item.uid,item.itemid+1)
	 doPlayerSendTextMessage(cid,MESSAGE_EVENT_ADVANCE,'Sorry, but you did not absorb enough energy!')
  end
  end
end

 

 

cara, viciei em loops, fica muito mais fácil pra corrigir, arruma-se uma vez e arruma-se para todas

revisei o script umas 5 vezes sem exagero, mas como não foi testado, não está livre de erros

qualquer coisa, copie as mensagens de erro do console ou, como estou trabalhando com loopings, se o erro ficar se repetindo, faça um PrintScreen do console ok?

Link para o comentário
Compartilhar em outros sites

Visitante
Este tópico está impedido de receber novos posts.
×
×
  • Criar Novo...