Ir para conteúdo
  • 0

Concertar Essa Spell


Pergunta

Olá.. estou com uma SPELL que o CRBM fes e postou em um outro Forum..

 

Se chama KAGEMANE, essa spell quando usada em um target fas ele seguir seus movimentos..

Ela funciona perfeitamente quando usada em MONSTERS... mas quando usada em PLAYERS não funciona.. os PLAYERS ao inves de andar apenas 1 sqm igual o Personagem que a Ativou.. anda uns 4 SQM =\

 

tag da spell:

<instant name="Kagemane No Jutsu" words="kagemane no jutsu" lvl="125" mana="3300" exhaustion="2000" blockwalls="1" needlearn="0" event="script" value="shikamaru/kagemane.lua"></instant>

 

spell:

local function move(cid, target, playerpos, targetpos, times)
if playerdir ~= getCreatureLookDirection(cid) then
	doCreatureSetLookDirection(target, getCreatureLookDirection(cid))
end

if playerpos ~= getCreaturePosition(cid) then
	if playerpos.z == getCreaturePosition(cid).z then
		local ntpos = getCreaturePosition(cid)
		local x,y,z = ntpos.x-playerpos.x,ntpos.y-playerpos.y,ntpos.z-playerpos.z
		ntpos = getCreaturePosition(target)
		ntpos.x, ntpos.y, ntpos.z = ntpos.x+x,ntpos.y+y,ntpos.z+z
		if queryTileAddThing(target, ntpos) == RETURNVALUE_NOERROR and getCreaturePosition(cid).z == getCreaturePosition(target).z then
			doMoveCreature(target, getCreatureLookDirection(cid))
		end
	end
end
local playerpos, targetpos = getCreaturePosition(cid), getCreaturePosition(target)
local times = times+1
if times < 100 then
	addEvent(move, 1, cid, target, playerpos, targetpos, times)
else
	doCreatureSetNoMove(target, 0)
	doSendDistanceShoot(targetpos, playerpos, 31)
	doSendAnimatedText(targetpos, "FREE!", math.random(1,255))
 doPlayerSendCancel(cid, "You have lost control of "..getCreatureName(target)..".")
	if (isPlayer(target)) then
  doPlayerSendCancel(cid, "You've been freed from "..getPlayerName(cid).."'s Shadow Imitation Technique.")
  setPlayerStorageValue(target, 14755, -1)
 end
end
end

function onCastSpell(cid, var)
local target = getCreatureTarget(cid)
if (isPlayer(target)) or (isMonster(target)) then
	if getPlayerStorageValue(cid, 14755) == -1 then
		doCreatureSetNoMove(target, 1)
  doPlayerSendCancel(cid, "You have possessed "..getCreatureName(target)..".")
		if (isPlayer(target)) then
doPlayerSendCancel(target, "You have been possessed by "..getPlayerName(cid)..".")
setPlayerStorageValue(target, 14755, 1)
  end
		doSendAnimatedText(getCreaturePosition(target), "POSSESSED!", math.random(1,255))
		local playerpos,playerdir,targetpos = getCreaturePosition(cid), getPlayerLookDir(cid), getCreaturePosition(target)
		doSendDistanceShoot(playerpos, targetpos, 31)
		doSendMagicEffect(getCreaturePosition(target), CONST_ME_SMALLCLOUDS)
		local times = 1
		addEvent(move, 1000, cid, target, playerpos, targetpos, times)
	else
		doPlayerSendCancel(cid, "Your Shadow Imitation Technique isn't worn out yet.")
	end
end
end

 

em creaturescripts/login.lua:

setPlayerStorageValue(cid, 14755, -1)

 

Agredeço desde JA!!

Editado por milbradt
Link para o comentário
https://xtibia.com/forum/topic/192461-concertar-essa-spell/
Compartilhar em outros sites

4 respostass a esta questão

Posts Recomendados

  • 0

A tag esta certa, não coloquei certinha antes la por que não tinha nada a ver...

A spell funciona no servidor.. ela controla todos monsters perfeitamente, porem se usada em players não funciona direito, eu ando 1 SQM e o Player anda 4 sqm.

Link para o comentário
https://xtibia.com/forum/topic/192461-concertar-essa-spell/#findComment-1321844
Compartilhar em outros sites

  • 0

 

local function move(cid, target, playerpos, targetpos, times)

if playerdir ~= getCreatureLookDirection(cid) then

doCreatureSetLookDirection(target, getCreatureLookDirection(cid))

end

 

if playerpos ~= getCreaturePosition(cid) then

if playerpos.z == getCreaturePosition(cid).z then

local ntpos = getCreaturePosition(cid)

local x,y,z = ntpos.x-playerpos.x,ntpos.y-playerpos.y,ntpos.z-playerpos.z

ntpos = getCreaturePosition(target)

ntpos.x, ntpos.y, ntpos.z = ntpos.x+x,ntpos.y+y,ntpos.z+z

if queryTileAddThing(target, ntpos) == RETURNVALUE_NOERROR and getCreaturePosition(cid).z == getCreaturePosition(target).z then

doMoveCreature(target, getCreatureLookDirection(cid))

end

end

end

local playerpos, targetpos = getCreaturePosition(cid), getCreaturePosition(target)

local times = times+1

if times < 100 then

addEvent(move, 1, cid, target, playerpos, targetpos, times)

else

doCreatureSetNoMove(target, 0)

doSendDistanceShoot(targetpos, playerpos, 15)

doSendAnimatedText(targetpos, "LIVRE!", math.random(1,255))

doPlayerSendCancel(cid, "Você perdeu o controle de "..getCreatureName(target)..".")

if (isPlayer(target)) then

doPlayerSendCancel(cid, "Você está liberto from "..getPlayerName(cid).."'s Shadow Imitation Technique.")

setPlayerStorageValue(target, 14755, -1)

end

end

end

 

function onCastSpell(cid, var)

local target = getCreatureTarget(cid)

if (isPlayer(target)) or (isMonster(target)) then

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

doCreatureSetNoMove(target, 1)

doPlayerSendCancel(cid, "You have possessed "..getCreatureName(target)..".")

if (isPlayer(target)) then

doPlayerSendCancel(target, "Você foi possuido por "..getPlayerName(cid)..".")

setPlayerStorageValue(target, 14755, 1)

end

doSendAnimatedText(getCreaturePosition(target), "POSSUIDO!", math.random(1,255))

local playerpos,playerdir,targetpos = getCreaturePosition(cid), getPlayerLookDir(cid), getCreaturePosition(target)

doSendDistanceShoot(playerpos, targetpos, 15)

doSendMagicEffect(getCreaturePosition(target), 186)

local times = 1

addEvent(move, 1000, cid, target, playerpos, targetpos, times)

else

doPlayerSendCancel(cid, "Your Shadow Imitation Technique isn't worn out yet.")

end

end

end

 

Tenta asssim..

Link para o comentário
https://xtibia.com/forum/topic/192461-concertar-essa-spell/#findComment-1322405
Compartilhar em outros sites

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