Magia [Pula 3 Sqm]

SarioYana
em Scripts
  • 1
  • 2

SarioYana

avatar
Campones
Campones

INFOS

Grupo: CamponesRegistrado: 08/06/11Posts: 67Char no Tibia: sario yana

Bom galera

esses tempos

andei num ot ai

e vi

a magia chamada dash ela pula 3 quadrinhos

sera q tem como faze ela

lembrando que ela nao passa em cima

de paredes

eu n queria habilita o /a

para os player

queria faze

essa magia

si alguem souber ajuda aii

Oneshot

avatar
Marquês
Marquês

INFOS

Grupo: MarquêsRegistrado: 05/07/09Posts: 1347

sarioyana,

 

Para correto funcionamento do código deste post, siga as instruções com exatidão, prestando atenção para salvar as extensões pedidas corretamente.

 

 

- Abra o arquivo 050-function.lua com um Bloco de Notas em /data/lib e, no final, adicione o seguinte código:

 

function isWalkable(position, cid)
position.stackpos = 0
if getTileThingByPos(position).uid ~= 0 then
	local tile = getTileInfo(position)
	if tile.protection == false and tile.house == false and getTopCreature(position).uid == 0 and doTileQueryAdd(cid, position) == RETURNVALUE_NOERROR then
		return true
	end
end
return false
end

 

- Crie um novo arquivo chamado dash.lua em /data/spells/scripts e adicione o seguinte código

 

function onCastSpell(cid, var)
local direction = getCreatureLookDirection(cid)
local size = 3

local toPosition = getPositionByDirection(getThingPosition(cid), direction, size)
if isWalkable(toPosition, cid) then
	doSendMagicEffect(getThingPosition(cid), CONST_ME_POFF)
	doTeleportThing(cid, toPosition)
	doSendMagicEffect(getThingPosition(cid), CONST_ME_POFF)
else
	doPlayerSendDefaultCancel(cid, RETURNVALUE_NOTPOSSIBLE)
end
return true
end

 

- Abra o arquivo spells.xml e adicione a seguinte linha:

 

<instant name="Dash" words="dash" lvl="20" mana="18" exhaustion="2000" needlearn="0" event="script" value="dash.lua"/>

 

Antes de:

 

</spells>

 


 

Reporte no tópico quaisquer resultados.

fagundes14

Hy MaTTheW
avatar
Campones
Campones

INFOS

Grupo: CamponesRegistrado: 06/10/11Posts: 96Char no Tibia: Worna Crien

@Oneshot

 

Como Eu Adapto Essa Magia Paraa 8.0 Ja Que Nao Possui Lib?

ABRASS

SarioYana

avatar
Campones
Campones

INFOS

Grupo: CamponesRegistrado: 08/06/11Posts: 67Char no Tibia: sario yana

kara olha os erros que ta dando

[12/06/2012 10:18:12] [Error - Spell Interface]

[12/06/2012 10:18:12] data/spells/scripts/dash.lua:onCastSpell

[12/06/2012 10:18:12] Description:

[12/06/2012 10:18:12] data/lib/032-position.lua:49: attempt to index local 'position' (a number value)

[12/06/2012 10:18:12] stack traceback:

[12/06/2012 10:18:12] data/lib/032-position.lua:49: in function 'getPositionByDirection'

[12/06/2012 10:18:12] data/spells/scripts/dash.lua:5: in function <data/spells/scripts/dash.lua:1>

isso ta bugado

nao é para 8.0

é para 8.60

Vilden

Loading. . .
avatar
Infante
Infante

INFOS

Grupo: InfanteRegistrado: 09/05/08Posts: 1597

Titulo do tópico renomeado para melhor entendimento, quando criar um tópico deixe o titulo mais expressivo possível.

Atenciosamente, Vilden.

Oneshot

avatar
Marquês
Marquês

INFOS

Grupo: MarquêsRegistrado: 05/07/09Posts: 1347

Desculpe, foi um erro meu e este já foi consertado.

SarioYana

avatar
Campones
Campones

INFOS

Grupo: CamponesRegistrado: 08/06/11Posts: 67Char no Tibia: sario yana

olha agora o bug

[12/06/2012 13:09:54] [Error - Spell Interface]

[12/06/2012 13:09:54] data/spells/scripts/dash.lua:onCastSpell

[12/06/2012 13:09:54] Description:

[12/06/2012 13:09:54] (luaDoTileQueryAdd) Thing not found

Oneshot

avatar
Marquês
Marquês

INFOS

Grupo: MarquêsRegistrado: 05/07/09Posts: 1347

Tente agora.

 

function onCastSpell(cid, var)
	local direction = getCreatureLookDirection(cid)
	local size = 3

	local toPosition = getPositionByDirection(getThingPosition(cid), direction, size)
	if isWalkable(toPosition, cid) then
			doSendMagicEffect(getThingPosition(cid), CONST_ME_POFF)
			doTeleportThing(cid, toPosition)
			doSendMagicEffect(getThingPosition(cid), CONST_ME_POFF)
	else
			doPlayerSendDefaultCancel(cid, RETURNVALUE_NOTPOSSIBLE)
	end
	return true
end

SarioYana

avatar
Campones
Campones

INFOS

Grupo: CamponesRegistrado: 08/06/11Posts: 67Char no Tibia: sario yana

olha kara

aparece esse outro erro

[12/06/2012 14:43:06] [Warning - Spells::registerEvent] Duplicate registered instant spell with words: dash

mais quando vc fala no ot dash

ele aparece

sorry,not possible

sendo que o char nao ta encostado nenhuma parede

e quando solta ela n acontece nada

lembrando que eu nao to na zona de proteçao

 

alguem ajuda ae??

jhon992

Dono JhonBot
avatar
Conde
Conde

INFOS

Grupo: CondeRegistrado: 30/06/11Posts: 631Char no Tibia: Warrior of Mort

Tava com preguiça de analisar a magia do @Oneshot, tão fiz essa:

local quantSqm = 3 -- quantidade de sqms

function teleportPlayer(cid, position)
if (isPlayer(cid)) then
local o = 0
local positions = {}
   for i=1, quantSqm do
    if getPlayerLookDir(cid) == 0 then
	    position = {x=position.x, y=position.y-i, z=position.z}	    
    elseif getPlayerLookDir(cid) == 1 then
	    position = {x=position.x+i, y=position.y, z=position.z}
    elseif getPlayerLookDir(cid) == 2 then
	    position = {x=position.x, y=position.y+i, z=position.z}
    elseif getPlayerLookDir(cid) == 3 then
	    position = {x=position.x-i, y=position.y, z=position.z}
    end
       positions[#positions] = position
    if isWalkable(position) then
	    o = o+1
    end
   end
   if o == 3 then
    doTeleportThing(cid, position)
       for i=1, #positions do
           doSendMagicEffect(positions[i], CONST_ME_TELEPORT)
       end
    return true
   else
    doPlayerSendCancel(cid, "Você não pode atravesar isso!")
    return false
   end
end
end

function isWalkable(pos, creature, pz, proj) -- nord
   if getTileThingByPos({x = pos.x, y = pos.y, z = pos.z, stackpos = 0}).itemid == 0 then return false end
   local creature = getTopCreature(pos)
   if creature.type > 0 then    return false end
   if getTilePzInfo(pos) and not pz then return false end
   local n = not proj and 3 or 2
   for i = 0, 255 do
    pos.stackpos = i
    local tile = getTileThingByPos(pos)
    if tile.itemid ~= 0 and not isCreature(tile.uid) then
	    if hasProperty(tile.uid, n) or hasProperty(tile.uid, 7) then
		    return false
	    end
    end
   end
return true
end

function onCastSpell(cid, var)
   if teleportPlayer(cid, getPlayerPosition(cid)) then
    return true
   end
end

 

Ja ta testada.

SarioYana

avatar
Campones
Campones

INFOS

Grupo: CamponesRegistrado: 08/06/11Posts: 67Char no Tibia: sario yana

nuss kara ta pulando uns 8

sendo que ali ta 3

como arruma isso

 

ah eu queria nos 3 sqm que ele pulasse dasse o efeito

jhon992

Dono JhonBot
avatar
Conde
Conde

INFOS

Grupo: CondeRegistrado: 30/06/11Posts: 631Char no Tibia: Warrior of Mort

Arrumei ali em cima pra soltar effect em todos os tiles, mais aqui ta pulando 3 certinho então n arrumei o oque você disse que pula 8.

SarioYana

avatar
Campones
Campones

INFOS

Grupo: CamponesRegistrado: 08/06/11Posts: 67Char no Tibia: sario yana

ele ta pulando 5 na verdade

e agr n ta aparecendo efeito em nenhum tile

ajuda ae

e passa a lista dos efeitos pra min ae vlww

 

q tag tu usou??

 

olhe o que eu quero galera

post-319424-0-53627600-1339546206_thumb.jpg

jhon992

Dono JhonBot
avatar
Conde
Conde

INFOS

Grupo: CondeRegistrado: 30/06/11Posts: 631Char no Tibia: Warrior of Mort
local quantSqm = 3 -- quantidade de sqms

function teleportPlayer(cid, position)
if (isPlayer(cid)) then
local o = 1
local positions = {}
for i=1, quantSqm do	
		if getPlayerLookDir(cid) == 0 then
				position = {x=position.x, y=position.y-1, z=position.z}
		elseif getPlayerLookDir(cid) == 1 then
				position = {x=position.x+1, y=position.y, z=position.z}					
		elseif getPlayerLookDir(cid) == 2 then
				position = {x=position.x, y=position.y+1, z=position.z}
		elseif getPlayerLookDir(cid) == 3 then
				position = {x=position.x-1, y=position.y, z=position.z}
		end
		if isWalkable(position) then
			o = o+1
		end
		positions[#positions+1] = position		  
end
if o > quantSqm then
		doTeleportThing(cid, position)
	for i=1, #positions do
		doSendMagicEffect(positions[i], CONST_ME_TELEPORT)
	end
		return true
else
		doPlayerSendCancel(cid, "Você não pode atravesar isso!")
		return false
end
end
end

function isWalkable(pos, creature, pz, proj) -- nord
if getTileThingByPos({x = pos.x, y = pos.y, z = pos.z, stackpos = 0}).itemid == 0 then return false end
local creature = getTopCreature(pos)
if creature.type > 0 then	return false end
if getTilePzInfo(pos) and not pz then return false end
local n = not proj and 3 or 2
for i = 0, 255 do
		pos.stackpos = i
		local tile = getTileThingByPos(pos)
		if tile.itemid ~= 0 and not isCreature(tile.uid) then
				if hasProperty(tile.uid, n) or hasProperty(tile.uid, 7) then
						return false
				end
		end
end
return true
end

function onCastSpell(cid, var)
if teleportPlayer(cid, getPlayerPosition(cid)) then
		return true
end
end

SarioYana

avatar
Campones
Campones

INFOS

Grupo: CamponesRegistrado: 08/06/11Posts: 67Char no Tibia: sario yana

vlw deu certo

  • 1
  • 2