Ir para conteúdo
  • Cadastre-se

(Resolvido)AJUDA NESSA SPELL KAMUI IN


Ir para solução Resolvido por Agaka,

Posts Recomendados

  • Solução

@leozincorsair Foi mal, realmente foi erro meu. Bom, pra fazer com que quem entre possa sair, vai ser preciso criar um novo movement. Por que? Simples, quando o player casta a spell a posição dele fica salva. Já o player que entrar no portal do mundo normal não vai ter suas posições salvas, logo não poderá retornar. Mas vamos lá.

 

Spell

Spoiler

local enter = {x = 1250, y = 1250, z = 7}

local combat = createCombatObject()
function removeTeleport(PlayerPos)
	tp = getTileItemById(PlayerPos, 5023).uid
	doRemoveItem(tp, 1)
	doSendMagicEffect(PlayerPos, 2)
end

function onCastSpell(cid, var)

local PlayerPos = getCreaturePosition(cid)
local from1,to1 = {x=979, y=911, z=7},{x=995, y=920, z=7}
local from2,to2 = {x=1964, y=731, z=7},{x=1976, y=742, z=7}
local from3,to3 = {x=1206, y=751, z=7},{x=1232, y=778, z=7}
local from4,to4 = {x=1201, y=746, z=6},{x=1238, y=782, z=6}
local from5,to5 = {x=979, y=911, z=6},{x=994, y=919, z=6}
local from6,to6 = {x=978, y=920, z=5},{x=1007, y=931, z=5}
local from7,to7 = {x=987, y=919, z=4},{x=1008, y=931, z=4}

	if isInRange(PlayerPos, from1, to1) then
		doPlayerSendCancel(cid, "Você ja esta dentro do Kamui!")
		return false
	end

	if isInRange(PlayerPos, from2, to2) or isInRange(PlayerPos, from3, to3) or isInRange(PlayerPos, from4, to4) or isInRange(PlayerPos, from5, to5) or isInRange(PlayerPos, from6, to6) or isInRange(PlayerPos, from7, to7) then
		doPlayerSendCancel(cid, "Você nao pode usar o Kamui no Jutsu aqui!")
		return false
	end

	if getTileInfo(getThingPos(cid)).pvp then
		doPlayerSendCancel(cid, "Você nao pode usar o Kamui no Jutsu aqui!")
		return false
	end

	if exhaustion.check(cid, 5570) == TRUE then
		doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, "Aguarde " .. exhaustion.get(cid, 5570) .. " segundos para usar novamente.")
		return false
	end

	local pos = getCreaturePosition(cid)
	exhaustion.set(cid, 5570, 60)
	doSendMagicEffect(PlayerPos, 196)
	doCreateTeleport(5023, enter, pos)
	setPlayerStorageValue(cid, 5020, PlayerPos.x)
	setPlayerStorageValue(cid, 5021, PlayerPos.y)
	setPlayerStorageValue(cid, 5022, PlayerPos.z)
	local tp = getTileItemById(pos, 5023).uid
	doItemSetAttribute(tp, "aid", 5560)
	addEvent(removeTeleport, 5000, pos)
	return doCombat(cid, combat, var)
end

 

 

Portal do mundo normal (Esse script vai salvar a posição dos outros players.)

Spoiler

function onStepIn(cid, fromPosition, toPosition)

local enter = {x = 1250, y = 1250, z = 7}
local PlayerPos = getCreaturePosition(cid)
	
	setPlayerStorageValue(cid, 5020, PlayerPos.x)
	setPlayerStorageValue(cid, 5021, PlayerPos.y)
	setPlayerStorageValue(cid, 5022, PlayerPos.z)
	return true
end

 

 

Portal para sair do kamui

Spoiler

function onStepIn(cid, fromPosition, toPosition)

b1 = getPlayerStorageValue(cid, 5020)
b2 = getPlayerStorageValue(cid, 5021)
b3 = getPlayerStorageValue(cid, 5022)

local pos = getCreaturePosition(cid)
local back = {x = b1, y = b2, z = b3}

	doTeleportThing(cid, back)
	return true
end

 

 

Tags dos movements

Portal do mundo normal
<movevent type="StepIn" actionid="5560" event="script" value="step.lua"/>

Portal no kamui
<movevent type="StepIn" actionid="5506" event="script" value="step2.lua"/>

 

Editado por JoviM (veja o histórico de edições)
Link para o post
Compartilhar em outros sites
12 minutos atrás, JoviM disse:

@leozincorsair Foi mal, realmente foi erro meu. Bom, pra fazer com que quem entre possa sair, vai ser preciso criar um novo movement. Por que? Simples, quando o player casta a spell a posição dele fica salva. Já o player que entrar no portal do mundo normal não vai ter suas posições salvas, logo não poderá retornar. Mas vamos lá.

 

Spell

  Mostrar conteúdo oculto


local enter = {x = 1250, y = 1250, z = 7}

local combat = createCombatObject()
function removeTeleport(PlayerPos)
	tp = getTileItemById(PlayerPos, 5023).uid
	doRemoveItem(tp, 1)
	doSendMagicEffect(PlayerPos, 2)
end

function onCastSpell(cid, var)

local PlayerPos = getCreaturePosition(cid)
local from1,to1 = {x=979, y=911, z=7},{x=995, y=920, z=7}
local from2,to2 = {x=1964, y=731, z=7},{x=1976, y=742, z=7}
local from3,to3 = {x=1206, y=751, z=7},{x=1232, y=778, z=7}
local from4,to4 = {x=1201, y=746, z=6},{x=1238, y=782, z=6}
local from5,to5 = {x=979, y=911, z=6},{x=994, y=919, z=6}
local from6,to6 = {x=978, y=920, z=5},{x=1007, y=931, z=5}
local from7,to7 = {x=987, y=919, z=4},{x=1008, y=931, z=4}

	if isInRange(PlayerPos, from1, to1) then
		doPlayerSendCancel(cid, "Você ja esta dentro do Kamui!")
		return false
	end

	if isInRange(PlayerPos, from2, to2) or isInRange(PlayerPos, from3, to3) or isInRange(PlayerPos, from4, to4) or isInRange(PlayerPos, from5, to5) or isInRange(PlayerPos, from6, to6) or isInRange(PlayerPos, from7, to7) then
		doPlayerSendCancel(cid, "Você nao pode usar o Kamui no Jutsu aqui!")
		return false
	end

	if getTileInfo(getThingPos(cid)).pvp then
		doPlayerSendCancel(cid, "Você nao pode usar o Kamui no Jutsu aqui!")
		return false
	end

	if exhaustion.check(cid, 5570) == TRUE then
		doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, "Aguarde " .. exhaustion.get(cid, 5570) .. " segundos para usar novamente.")
		return false
	end

	local pos = getCreaturePosition(cid)
	exhaustion.set(cid, 5570, 60)
	doSendMagicEffect(PlayerPos, 196)
	doCreateTeleport(5023, enter, pos)
	setPlayerStorageValue(cid, 5020, PlayerPos.x)
	setPlayerStorageValue(cid, 5021, PlayerPos.y)
	setPlayerStorageValue(cid, 5022, PlayerPos.z)
	local tp = getTileItemById(pos, 5023).uid
	doItemSetAttribute(tp, "aid", 5560)
	addEvent(removeTeleport, 5000, pos)
	return doCombat(cid, combat, var)
end

 

 

Portal do mundo normal (Esse script vai salvar a posição dos outros players.)

  Mostrar conteúdo oculto



function onStepIn(cid, fromPosition, toPosition)

local enter = {x = 1250, y = 1250, z = 7}
local PlayerPos = getCreaturePosition(cid)
	
	setPlayerStorageValue(cid, 5020, PlayerPos.x)
	setPlayerStorageValue(cid, 5021, PlayerPos.y)
	setPlayerStorageValue(cid, 5022, PlayerPos.z)
	return true
end

 

 

Portal para sair do kamui

  Mostrar conteúdo oculto


function onStepIn(cid, fromPosition, toPosition)

b1 = getPlayerStorageValue(cid, 5020)
b2 = getPlayerStorageValue(cid, 5021)
b3 = getPlayerStorageValue(cid, 5022)

local pos = getCreaturePosition(cid)
local back = {x = b1, y = b2, z = b3}

	doTeleportThing(cid, back)
	return true
end

 

 

Tags dos movements


Portal do mundo normal
<movevent type="StepIn" actionid="5560" event="script" value="step.lua"/>

Portal no kamui
<movevent type="StepIn" actionid="5506" event="script" value="step2.lua"/>

 

 

man , não tem como coloca um action id no portal do "mundo normal" pq o portal e criado ao usar a spell.

Link para o post
Compartilhar em outros sites

@JoviM obrigado funcinou corretamente , tu e fera d+

+rep <3

 

( so podia alterar para tipo quando entrar no mundo, esperar 30 segundos para entrar no portal para sair )

Link para o post
Compartilhar em outros sites

@leozincorsair É nóis UHASUUAHSU.

 

Para que o player não possa sair do kamui tão rápido, no script do portal do mundo normal use o código abaixo.

function onStepIn(cid, fromPosition, toPosition)

local enter = {x = 1250, y = 1250, z = 7}
local tempo = 30
local s_time = 992343
local PlayerPos = getCreaturePosition(cid)
	
	setPlayerStorageValue(cid, 5020, PlayerPos.x)
	setPlayerStorageValue(cid, 5021, PlayerPos.y)
	setPlayerStorageValue(cid, 5022, PlayerPos.z)
	setPlayerStorageValue(cid, s_time, os.time() + tempo)
	return true
end

Agora no portal do kamui..

function onStepIn(cid, fromPosition, toPosition)

b1 = getPlayerStorageValue(cid, 5020)
b2 = getPlayerStorageValue(cid, 5021)
b3 = getPlayerStorageValue(cid, 5022)

local s_time = 992343
local pos = getCreaturePosition(cid)
local back = {x = b1, y = b2, z = b3}
local cantGo = {x = pos.x, y = pos.y + 1, z = pos.z}

	if getPlayerStorageValue(cid, s_time) >= os.time() then
		doPlayerSendTextMessage(cid, 27, "Espere "..getPlayerStorageValue(cid, s_time) - os.time().." segundos para sair.")
		doTeleportThing(cid, cantGo)
		return true
	end
	
	doTeleportThing(cid, back)
	return true
end

OBS: As storages dos 2 arquivos precisam ser a mesma.

Link para o post
Compartilhar em outros sites
6 horas atrás, JoviM disse:

@leozincorsair É nóis UHASUUAHSU.

 

Para que o player não possa sair do kamui tão rápido, no script do portal do mundo normal use o código abaixo.


function onStepIn(cid, fromPosition, toPosition)

local enter = {x = 1250, y = 1250, z = 7}
local tempo = 30
local s_time = 992343
local PlayerPos = getCreaturePosition(cid)
	
	setPlayerStorageValue(cid, 5020, PlayerPos.x)
	setPlayerStorageValue(cid, 5021, PlayerPos.y)
	setPlayerStorageValue(cid, 5022, PlayerPos.z)
	setPlayerStorageValue(cid, s_time, os.time() + tempo)
	return true
end

Agora no portal do kamui..


function onStepIn(cid, fromPosition, toPosition)

b1 = getPlayerStorageValue(cid, 5020)
b2 = getPlayerStorageValue(cid, 5021)
b3 = getPlayerStorageValue(cid, 5022)

local s_time = 992343
local pos = getCreaturePosition(cid)
local back = {x = b1, y = b2, z = b3}
local cantGo = {x = pos.x, y = pos.y + 1, z = pos.z}

	if getPlayerStorageValue(cid, s_time) >= os.time() then
		doPlayerSendTextMessage(cid, 27, "Espere "..getPlayerStorageValue(cid, s_time) - os.time().." segundos para sair.")
		doTeleportThing(cid, cantGo)
		return true
	end
	
	doTeleportThing(cid, back)
	return true
end

OBS: As storages dos 2 arquivos precisam ser a mesma.

 

onde exatamente coloco a primeira parte na spell ? 

tentei colocar deu error

Link para o post
Compartilhar em outros sites

@leozincorsair Usa essa spell, os portais são 1 para o mundo normal e outro para o kamui. Como o portal já vai estar salvando a posição do player, eu removi essa 'função' da spell.

 

Spell

Spoiler

local enter = {x = 1250, y = 1250, z = 7}

local combat = createCombatObject()
function removeTeleport(PlayerPos)
	tp = getTileItemById(PlayerPos, 5023).uid
	doRemoveItem(tp, 1)
	doSendMagicEffect(PlayerPos, 2)
end

function onCastSpell(cid, var)

local PlayerPos = getCreaturePosition(cid)
local from1,to1 = {x=979, y=911, z=7},{x=995, y=920, z=7}
local from2,to2 = {x=1964, y=731, z=7},{x=1976, y=742, z=7}
local from3,to3 = {x=1206, y=751, z=7},{x=1232, y=778, z=7}
local from4,to4 = {x=1201, y=746, z=6},{x=1238, y=782, z=6}
local from5,to5 = {x=979, y=911, z=6},{x=994, y=919, z=6}
local from6,to6 = {x=978, y=920, z=5},{x=1007, y=931, z=5}
local from7,to7 = {x=987, y=919, z=4},{x=1008, y=931, z=4}

	if isInRange(PlayerPos, from1, to1) then
		doPlayerSendCancel(cid, "Você ja esta dentro do Kamui!")
		return false
	end

	if isInRange(PlayerPos, from2, to2) or isInRange(PlayerPos, from3, to3) or isInRange(PlayerPos, from4, to4) or isInRange(PlayerPos, from5, to5) or isInRange(PlayerPos, from6, to6) or isInRange(PlayerPos, from7, to7) then
		doPlayerSendCancel(cid, "Você nao pode usar o Kamui no Jutsu aqui!")
		return false
	end

	if getTileInfo(getThingPos(cid)).pvp then
		doPlayerSendCancel(cid, "Você nao pode usar o Kamui no Jutsu aqui!")
		return false
	end

	if exhaustion.check(cid, 5570) == TRUE then
		doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, "Aguarde " .. exhaustion.get(cid, 5570) .. " segundos para usar novamente.")
		return false
	end

	local pos = getCreaturePosition(cid)
	exhaustion.set(cid, 5570, 60)
	doSendMagicEffect(PlayerPos, 196)
	doCreateTeleport(5023, enter, pos)
	local tp = getTileItemById(pos, 5023).uid
	doItemSetAttribute(tp, "aid", 5560)
	addEvent(removeTeleport, 5000, pos)
	return doCombat(cid, combat, var)
end

 

 

Portal (mundo normal) // Configure aqui o tempo que o player demora para sair do kamui.

Spoiler

function onStepIn(cid, fromPosition, toPosition)

local enter = {x = 1250, y = 1250, z = 7}
local tempo = 30
local s_time = 992343
local PlayerPos = getCreaturePosition(cid)
	
	setPlayerStorageValue(cid, 5020, PlayerPos.x)
	setPlayerStorageValue(cid, 5021, PlayerPos.y)
	setPlayerStorageValue(cid, 5022, PlayerPos.z)
	setPlayerStorageValue(cid, s_time, os.time() + tempo)
	return true
end

 

 

Portal kamui

Spoiler

function onStepIn(cid, fromPosition, toPosition)

local b1 = getPlayerStorageValue(cid, 5020)
local b2 = getPlayerStorageValue(cid, 5021)
local b3 = getPlayerStorageValue(cid, 5022)

local s_time = 992343
local pos = getCreaturePosition(cid)
local back = {x = b1, y = b2, z = b3}
local cantGo = {x = pos.x, y = pos.y + 1, z = pos.z}

	if getPlayerStorageValue(cid, s_time) >= os.time() then
		doPlayerSendTextMessage(cid, 27, "Espere "..getPlayerStorageValue(cid, s_time) - os.time().." segundos para sair.")
		doTeleportThing(cid, cantGo)
		return true
	end
	
	doTeleportThing(cid, back)
	return true
end

 

 

Como falei acima, a storage dos 2 portais precisam ser iguais.

Link para o post
Compartilhar em outros sites

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

×   Você colou conteúdo com formatação.   Remover formatação

  Apenas 75 emojis são permitidos.

×   Seu link foi automaticamente incorporado.   Mostrar como link

×   Seu conteúdo anterior foi restaurado.   Limpar o editor

×   Não é possível colar imagens diretamente. Carregar ou inserir imagens do URL.

×
×
  • Criar Novo...

Informação Importante

Confirmação de Termo