SA
pedido

Magia [Pula 3 Sqm]

Por SarioYana, 11 de jun. de 2012 em Scripts

pedido de magia
19
4.6k
SarioYanaS
11 de junho de 2012 às 20:31

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

Editado Junho 12 por Vilden

OneshotO
11 de junho de 2012 às 22:15

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.

Editado Junho 12 por Oneshot

fagundes14F
11 de junho de 2012 às 22:28

@Oneshot

 

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

ABRASS

SarioYanaS
12 de junho de 2012 às 10:20

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

VildenV
12 de junho de 2012 às 10:22

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

OneshotO
12 de junho de 2012 às 11:08

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

SarioYanaS
12 de junho de 2012 às 13:10

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

OneshotO
12 de junho de 2012 às 13:50

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

SarioYanaS
12 de junho de 2012 às 16:06

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??

Editado Junho 12 por sarioyana

jhon992J
12 de junho de 2012 às 16:23

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.

Editado Junho 12 por Jhon992

SarioYanaS
12 de junho de 2012 às 17:34

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

jhon992J
12 de junho de 2012 às 17:44

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.

SarioYanaS
12 de junho de 2012 às 21:10

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

Editado Junho 12 por sarioyana

jhon992J
13 de junho de 2012 às 12:55
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

Editado Junho 13 por Jhon992

SarioYanaS
13 de junho de 2012 às 20:16

vlw deu certo