UroTTa 6 Postado Abril 21, 2014 Share Postado Abril 21, 2014 Gostaria de uma pequena ajuda em um script de movements de uma quest que estou fazendo, é o seguinte: E uma quest que 4 jogadores pisam em um tile é abre uma escada ao sul, eu consegui fazer tudo, porem quando somente um jogador pisa ja abre a escada e executa suas funções. Gostaria que somente quando os 4 jogadores com tal storage executava as funções. 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 = false if(getPlayerStorageValue(cid, 1050) == 19) then if(item.actionid == 8014) then for i = 1, 4 do if(getTopCreature(pos[i]).uid > 0) then if(isPlayer(getTopCreature(pos[i]).uid)) then if(getGlobalStorageValue(8014) < 1) then doCreatureSay(getTopCreature(pos[i]).uid, "A clicking sound tatters the silence.", TALKTYPE_ORANGE_1) start = true end end end end if(start == true) 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 end return true end Link para o comentário https://xtibia.com/forum/topic/232159-script-movements-n%C3%A3o-esta-executando-da-forma-correta/ Compartilhar em outros sites More sharing options...
Skymagnum 234 Postado Abril 21, 2014 Share Postado Abril 21, 2014 Você chega se eles tem storage da mesma forma ué. player = getTopCreature({x = x, y = y, z = z}).uid if getPlayerStorageValue(player, STORAGE) == 1 then Link para o comentário https://xtibia.com/forum/topic/232159-script-movements-n%C3%A3o-esta-executando-da-forma-correta/#findComment-1639661 Compartilhar em outros sites More sharing options...
Techrlz 39 Postado Abril 21, 2014 Share Postado Abril 21, 2014 (editado) @EDITED: Ajudando skype Editado Abril 21, 2014 por Techrlz Link para o comentário https://xtibia.com/forum/topic/232159-script-movements-n%C3%A3o-esta-executando-da-forma-correta/#findComment-1639666 Compartilhar em outros sites More sharing options...
UroTTa 6 Postado Abril 21, 2014 Autor Share Postado Abril 21, 2014 (editado) @Techrlz Não funcionou. @Skymagnum Você não entendeu, esse script que eu postei era para funcionar so quando 4 jogadores pisase em seus respectivos tiles, mas so de 1 ja pisar o script executa as funções. @Alguem ajuda? Editado Abril 21, 2014 por UroTTa Link para o comentário https://xtibia.com/forum/topic/232159-script-movements-n%C3%A3o-esta-executando-da-forma-correta/#findComment-1639669 Compartilhar em outros sites More sharing options...
dalvorsn 268 Postado Abril 21, 2014 Share Postado Abril 21, 2014 Deixa variavel start inicialmente como true, e caso algum nao possa seta como false, do jeito que ta fazendo se acha um estiver já seta como true Link para o comentário https://xtibia.com/forum/topic/232159-script-movements-n%C3%A3o-esta-executando-da-forma-correta/#findComment-1639780 Compartilhar em outros sites More sharing options...
Demonbholder 420 Postado Abril 21, 2014 Share Postado Abril 21, 2014 (editado) Isso? 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(creature, "A clicking sound tatters the silence.", TALKTYPE_ORANGE_1) start = start + 1 end end end end end if start == 4 then Editado Abril 21, 2014 por Demonbholder Link para o comentário https://xtibia.com/forum/topic/232159-script-movements-n%C3%A3o-esta-executando-da-forma-correta/#findComment-1639781 Compartilhar em outros sites More sharing options...
UroTTa 6 Postado Abril 21, 2014 Autor Share Postado Abril 21, 2014 @Demonbholder Não deu, apenas 1 ja continua fazendo o efeito no tile. Link para o comentário https://xtibia.com/forum/topic/232159-script-movements-n%C3%A3o-esta-executando-da-forma-correta/#findComment-1639785 Compartilhar em outros sites More sharing options...
Demonbholder 420 Postado Abril 21, 2014 Share Postado Abril 21, 2014 Copiou tudo que eu coloquei ali mesmo? Até o start = 0 e if start == 4? O código fica assim: 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(creature, "A clicking sound tatters the silence.", TALKTYPE_ORANGE_1) 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 ps: eu não to testando, mas acho que deve funcionar... Link para o comentário https://xtibia.com/forum/topic/232159-script-movements-n%C3%A3o-esta-executando-da-forma-correta/#findComment-1639798 Compartilhar em outros sites More sharing options...
UroTTa 6 Postado Abril 21, 2014 Autor Share Postado Abril 21, 2014 Copiei e não deu Link para o comentário https://xtibia.com/forum/topic/232159-script-movements-n%C3%A3o-esta-executando-da-forma-correta/#findComment-1639802 Compartilhar em outros sites More sharing options...
Techrlz 39 Postado Abril 21, 2014 Share Postado Abril 21, 2014 (editado) . Editado Abril 21, 2014 por Techrlz Link para o comentário https://xtibia.com/forum/topic/232159-script-movements-n%C3%A3o-esta-executando-da-forma-correta/#findComment-1639817 Compartilhar em outros sites More sharing options...
dalvorsn 268 Postado Abril 21, 2014 Share Postado Abril 21, 2014 wtf HIEHEIHE rachei dos parenteses kk, como se tivesse mais de uma condicional ai ne kk ai ai Link para o comentário https://xtibia.com/forum/topic/232159-script-movements-n%C3%A3o-esta-executando-da-forma-correta/#findComment-1639823 Compartilhar em outros sites More sharing options...
UroTTa 6 Postado Abril 21, 2014 Autor Share Postado Abril 21, 2014 Alem de ficar criticando porque não tenta me ajudar @dalvorsn Link para o comentário https://xtibia.com/forum/topic/232159-script-movements-n%C3%A3o-esta-executando-da-forma-correta/#findComment-1639846 Compartilhar em outros sites More sharing options...
Demonbholder 420 Postado Abril 21, 2014 Share Postado Abril 21, 2014 (editado) hahaha, com ou sem parênteses, nesse caso, da no mesmo kkkk ... Editado Abril 21, 2014 por Demonbholder Link para o comentário https://xtibia.com/forum/topic/232159-script-movements-n%C3%A3o-esta-executando-da-forma-correta/#findComment-1639850 Compartilhar em outros sites More sharing options...
Techrlz 39 Postado Abril 21, 2014 Share Postado Abril 21, 2014 hahaha, com ou sem parênteses, nesse caso, da no mesmo kkkk enfim, tenta assim cara: 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 pos[i].stackpos = 253 local creature = getThingFromPos(pos[i]).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 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 Eu troquei uma função ali que vc tava usando por getThingFromPos. Como eu disse, não to testando, mas sei lá, eu nunca tinha usado essa função getTopCreature, então troquei, de repente é isso... Essa função getThingFromPos nem existe em tfs 1.0 o certo e usar getTopCreature mesmo. Link para o comentário https://xtibia.com/forum/topic/232159-script-movements-n%C3%A3o-esta-executando-da-forma-correta/#findComment-1639851 Compartilhar em outros sites More sharing options...
dalvorsn 268 Postado Abril 21, 2014 Share Postado Abril 21, 2014 Alem de ficar criticando porque não tenta me ajudar @dalvorsn Amigo a solução para o seu problena ja foi dita, se nao esta funcionando e por algum defeito no seu code Link para o comentário https://xtibia.com/forum/topic/232159-script-movements-n%C3%A3o-esta-executando-da-forma-correta/#findComment-1639852 Compartilhar em outros sites More sharing options...
Posts Recomendados