Ajuda nessa spell aqui =X

rohfagundes
em Scripts

rohfagundes

avatar
Visconde
Visconde

INFOS

Grupo: ViscondeRegistrado: 10/02/11Posts: 377

eu estou tendo dificuldade em fazer a spell só gastar mana longe dos ids

 

eu n sei direito como funciona o else

nesse caso só q ele só gasta mana nesse caso \/

 

function onCastSpell(cid, var)

local pos = getPlayerPosition(cid)

doSendMagicEffect({x = pos.x+1, y = pos.y+1, z = pos.z}, 87)

local position, match = getCreaturePosition(cid)

for x = (position.x - 3), (position.x + 3) do

for y = (position.y - 3), (position.y + 3) do

local tmp = {x = x, y = y, z = position.z}

if isInArray(WATER_TILES, getThingFromPos(tmp).itemid) then

doCreatureAddMana(cid, 1)

else

doCreatureAddMana(cid, -1)

return doCombat(cid, combat, var)

end

end

return doCombat(cid, combat, var)

end

 

 

acho melhor colocar pra gastar mana por aqui

em vez de gastar pelo xml

Lostzera

Lost
avatar
Campones
Campones

INFOS

Grupo: CamponesRegistrado: 21/01/13Posts: 20

não intendi uq vc quer

 

Abraço

rohfagundes

avatar
Visconde
Visconde

INFOS

Grupo: ViscondeRegistrado: 10/02/11Posts: 377

não intendi uq vc quer

 

Abraço

 

seguinte

 

if isInArray(WATER_TILES, getThingFromPos(tmp).itemid) then

doCreatureAddMana(cid, 1)

else

doCreatureAddMana(cid, -1)

 

queria q se ele estivese perto dos ids ele ganha 1 de mana

se n ele perde 1 de mana

 

o problema é q n sei muito bem como fazer isso

e ele só ta perdendo

Artigo

avatar
Campones
Campones

INFOS

Grupo: CamponesRegistrado: 24/07/12Posts: 69Char no Tibia: ADM Aritgo

cara o seu script estava necessitando de um 'end' simplesmente o adicionei veja se vai funcionar

 

function onCastSpell(cid, var)
local pos = getPlayerPosition(cid)
doSendMagicEffect({x = pos.x+1, y = pos.y+1, z = pos.z}, 87)
local position, match = getCreaturePosition(cid)
for x = (position.x - 3), (position.x + 3) do
for y = (position.y - 3), (position.y + 3) do
local tmp = {x = x, y = y, z = position.z}
if isInArray(WATER_TILES, getThingFromPos(tmp).itemid) then
doCreatureAddMana(cid, 1)
else
doCreatureAddMana(cid, -1)
return doCombat(cid, combat, var)
end
end
return doCombat(cid, combat, var)
end
end

<<Sings Feitas , By : Me>>

Anyur | Overpower | Tonynh | Anyur |

 

untitl31.png

Gears

avatar
Banidos
Banidos

INFOS

Grupo: BanidosRegistrado: 11/01/13Posts: 576Char no Tibia: Darashia del Shee

cara o seu script estava necessitando de um 'end' simplesmente o adicionei veja se vai funcionar

 

function onCastSpell(cid, var)
local pos = getPlayerPosition(cid)
doSendMagicEffect({x = pos.x+1, y = pos.y+1, z = pos.z}, 87)
local position, match = getCreaturePosition(cid)
for x = (position.x - 3), (position.x + 3) do
for y = (position.y - 3), (position.y + 3) do
local tmp = {x = x, y = y, z = position.z}
if isInArray(WATER_TILES, getThingFromPos(tmp).itemid) then
doCreatureAddMana(cid, 1)
else
doCreatureAddMana(cid, -1)
return doCombat(cid, combat, var)
end
end
return doCombat(cid, combat, var)
end
end

 

Sim faltava um end, mas tambem falta a variaval

if isInArray(WATER_TILES, getThingFromPos(tmp).itemid) then

essa parte precisaria de uma variavel que se chame local WATER_TILES.

 

 

Nao testei mas testa ai =o

 

 

 

 

[size=4]local agua = {1111, 2222, 3333}-- configure o id dos tiles de water[/size]
function onCastSpell(cid, var)
local pos = getPlayerPosition(cid)
doSendMagicEffect({x = pos.x+1, y = pos.y+1, z = pos.z}, 87)
local position, match = getCreaturePosition(cid)
for x = (position.x - 3), (position.x + 3) do
for y = (position.y - 3), (position.y + 3) do
local tmp = {x = x, y = y, z = position.z}
if isInArray(agua, getThingFromPos(tmp).itemid) then
doCreatureAddMana(cid, 1)
else
doCreatureAddMana(cid, -1)
return doCombat(cid, combat, var)
end
end
return doCombat(cid, combat, var)
end
end

Estagiário 24/01/2013

pedido para sair : 23/02/2013

Volta como estagiário: 11/04/2013

Pedido para sair: 10/05/2013

rohfagundes

avatar
Visconde
Visconde

INFOS

Grupo: ViscondeRegistrado: 10/02/11Posts: 377

cara o seu script estava necessitando de um 'end' simplesmente o adicionei veja se vai funcionar

 

function onCastSpell(cid, var)
local pos = getPlayerPosition(cid)
doSendMagicEffect({x = pos.x+1, y = pos.y+1, z = pos.z}, 87)
local position, match = getCreaturePosition(cid)
for x = (position.x - 3), (position.x + 3) do
for y = (position.y - 3), (position.y + 3) do
local tmp = {x = x, y = y, z = position.z}
if isInArray(WATER_TILES, getThingFromPos(tmp).itemid) then
doCreatureAddMana(cid, 1)
else
doCreatureAddMana(cid, -1)
return doCombat(cid, combat, var)
end
end
return doCombat(cid, combat, var)
end
end

 

n é por causa disso

eu ja tinha tentado antes

 

 

pera vou postar o script inteiro '-'

 

 

 

 

edit: ta ai o script da spell inteiro

 

local combat = createCombatObject()

setCombatParam(combat, COMBAT_PARAM_TYPE, COMBAT_ICEDAMAGE)

setCombatFormula(combat, COMBAT_FORMULA_LEVELMAGIC, 0, -35, 0, -55)

local area = createCombatArea({

{0, 0, 0},

{1, 1, 1},

{1, 2, 1},

{1, 1, 1},

{0, 0, 0}

})

setCombatArea(combat, area)

 

local WATER_TILES = {1370,1371,1372,1773,9466,1378, 4718, 6628, 6630, 4664, 5739, 4614, 4615, 4616, 4617, 4618, 4619, 4608, 4609, 4610, 4611, 4612, 4613, 7236, 4614, 4615, 4616, 4617, 4618, 4619, 4620, 4621, 4622, 4623, 4624, 4625, 4665, 4666, 4820, 4821, 4822, 4823, 4824, 4825}

 

function onCastSpell(cid, var)

local pos = getPlayerPosition(cid)

doSendMagicEffect({x = pos.x+1, y = pos.y+1, z = pos.z}, 87)

local position, match = getCreaturePosition(cid)

for x = (position.x - 3), (position.x + 3) do

for y = (position.y - 3), (position.y + 3) do

local tmp = {x = x, y = y, z = position.z}

if isInArray(WATER_TILES, getThingFromPos(tmp).itemid) then

doCreatureAddMana(cid, 1)

else

doCreatureAddMana(cid, -1)

return doCombat(cid, combat, var)

end

end

return doCombat(cid, combat, var)

end

end

 

Gears

avatar
Banidos
Banidos

INFOS

Grupo: BanidosRegistrado: 11/01/13Posts: 576Char no Tibia: Darashia del Shee

@Rohfagundes, testa ai :)

 

 

local WATER_TILES = {1370,1371,1372,1773,9466,1378, 4718, 6628, 6630, 4664, 5739, 4614, 4615, 4616, 4617, 4618, 4619, 4608, 4609, 4610, 4611, 4612, 4613, 7236, 4614, 4615, 4616, 4617, 4618, 4619, 4620, 4621, 4622, 4623, 4624, 4625, 4665, 4666, 4820, 4821, 4822, 4823, 4824, 4825}
local combat = createCombatObject()
setCombatParam(combat, COMBAT_PARAM_TYPE, COMBAT_ICEDAMAGE)
setCombatFormula(combat, COMBAT_FORMULA_LEVELMAGIC, 0, -35, 0, -55)
local area = createCombatArea({
{0, 0, 0},
{1, 1, 1},
{1, 2, 1},
{1, 1, 1},
{0, 0, 0}
})
setCombatArea(combat, area)
function onCastSpell(cid, var)
local pos = getPlayerPosition(cid)
doSendMagicEffect({x = pos.x+1, y = pos.y+1, z = pos.z}, 87)
local position, match = getCreaturePosition(cid)
for x = (position.x - 3), (position.x + 3) do
for y = (position.y - 3), (position.y + 3) do
local tmp = {x = x, y = y, z = position.z}
if isInArray(WATER_TILES, getThingFromPos(tmp).itemid) then
doCreatureAddMana(cid, 1)
else
doCreatureAddMana(cid, -1)
return doCombat(cid, combat, var)
end
end
return doCombat(cid, combat, var)
end
end

Estagiário 24/01/2013

pedido para sair : 23/02/2013

Volta como estagiário: 11/04/2013

Pedido para sair: 10/05/2013

rohfagundes

avatar
Visconde
Visconde

INFOS

Grupo: ViscondeRegistrado: 10/02/11Posts: 377

@Rohfagundes, testa ai :)

 

 

local WATER_TILES = {1370,1371,1372,1773,9466,1378, 4718, 6628, 6630, 4664, 5739, 4614, 4615, 4616, 4617, 4618, 4619, 4608, 4609, 4610, 4611, 4612, 4613, 7236, 4614, 4615, 4616, 4617, 4618, 4619, 4620, 4621, 4622, 4623, 4624, 4625, 4665, 4666, 4820, 4821, 4822, 4823, 4824, 4825}
local combat = createCombatObject()
setCombatParam(combat, COMBAT_PARAM_TYPE, COMBAT_ICEDAMAGE)
setCombatFormula(combat, COMBAT_FORMULA_LEVELMAGIC, 0, -35, 0, -55)
local area = createCombatArea({
{0, 0, 0},
{1, 1, 1},
{1, 2, 1},
{1, 1, 1},
{0, 0, 0}
})
setCombatArea(combat, area)
function onCastSpell(cid, var)
local pos = getPlayerPosition(cid)
doSendMagicEffect({x = pos.x+1, y = pos.y+1, z = pos.z}, 87)
local position, match = getCreaturePosition(cid)
for x = (position.x - 3), (position.x + 3) do
for y = (position.y - 3), (position.y + 3) do
local tmp = {x = x, y = y, z = position.z}
if isInArray(WATER_TILES, getThingFromPos(tmp).itemid) then
doCreatureAddMana(cid, 1)
else
doCreatureAddMana(cid, -1)
return doCombat(cid, combat, var)
end
end
return doCombat(cid, combat, var)
end
end

 

o problema continua

é como se ele ignora-se a posiçao do player em relaçao a agua

ou

o problema ta nessa parte

 

if isInArray(WATER_TILES, getThingFromPos(tmp).itemid) then

doCreatureAddMana(cid, 1)

else

doCreatureAddMana(cid, -1)

 

pq sempre tira 1 de mana perto dos ids ou n

Slicer

Insanity
avatar
Príncipe
Príncipe

INFOS

Grupo: PríncipeRegistrado: 19/08/10Posts: 4014Gênero: Masculino

como q ta a tag da spell heim? ;x

 

vcs ae emcima colocaram o end no lugar errado ^^

"Só a beira do abismo que os seres humanos acham forças para mudar."... E isso me da nojo... ¬¬

"Insanity is doing the exact... same fucking thing... over and over again expecting... shit to change... That. Is. Crazy." -Vass/Einstein

 

rohfagundes

avatar
Visconde
Visconde

INFOS

Grupo: ViscondeRegistrado: 10/02/11Posts: 377

<instant name="Water Circle" words="w-circle" lvl="1" exhaustion="2000" prem="0" range="0" needlearn="0" needtarget="0" blockwalls="1" aggressive="1" event="script" value="water/water circle.lua">

<vocation name="Water"/>

</instant>

Gears

avatar
Banidos
Banidos

INFOS

Grupo: BanidosRegistrado: 11/01/13Posts: 576Char no Tibia: Darashia del Shee

Pode ser também que a speel esteja errada, peguei 1 spell qualquer aqui testa ai :)

 

Nao entendi mt bem essa spell sua então peguei 1 spell e edita pra que ela só seja usada dentro da agua, o resto vc adapta :)

 


local WATER_TILES = {1370,1371,1372,1773,9466,1378, 4718, 6628, 6630, 4664, 5739, 4614, 4615, 4616, 4617, 4618, 4619, 4608, 4609, 4610, 4611, 4612, 4613, 7236, 4614, 4615, 4616, 4617, 4618, 4619, 4620, 4621, 4622, 4623, 4624, 4625, 4665, 4666, 4820, 4821, 4822, 4823, 4824, 4825}
local mana = 1
local combat = createCombatObject()
setCombatParam(combat, COMBAT_PARAM_TYPE, COMBAT_PHYSICALDAMAGE)
setCombatParam(combat, COMBAT_PARAM_EFFECT, CONST_ME_POFF)
setCombatFormula(combat, COMBAT_FORMULA_LEVELMAGIC, 1500, 1500, 1500, 1500)

local arr = {
{0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
{0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
{0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0},
{0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0},
{0, 0, 0, 0, 1, 0, 0, 1, 0, 0, 1, 0, 0, 0, 0},
{0, 0, 0, 0, 0, 1, 1, 2, 1, 1, 0, 0, 0, 0, 0},
{0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0},
{0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0},
{0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0},
{0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
{0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
}

local area = createCombatArea(arr)
setCombatArea(combat, area)

function onCastSpell(cid, var)
return doCombat(cid, combat, var)
end
  if not isInArray(WATER_TILES, getThingfromPos(pos)) then
         return doPlayerSendTextMessage(cid, 20, "Vc não pode usar essa magia fora da agua.")
  end

Estagiário 24/01/2013

pedido para sair : 23/02/2013

Volta como estagiário: 11/04/2013

Pedido para sair: 10/05/2013

Slicer

Insanity
avatar
Príncipe
Príncipe

INFOS

Grupo: PríncipeRegistrado: 19/08/10Posts: 4014Gênero: Masculino

tenta assim..

 

local combat = createCombatObject()
setCombatParam(combat, COMBAT_PARAM_TYPE, COMBAT_ICEDAMAGE)
setCombatFormula(combat, COMBAT_FORMULA_LEVELMAGIC, 0, -35, 0, -55)
local area = createCombatArea({
{0, 0, 0},
{1, 1, 1},
{1, 2, 1},
{1, 1, 1},
{0, 0, 0}
})
setCombatArea(combat, area)

local WATER_TILES = {1370,1371,1372,1773,9466,1378, 4718, 6628, 6630, 4664, 5739, 4614, 4615, 4616, 4617, 4618, 4619, 4608, 4609, 4610, 4611, 4612, 4613, 7236, 4614, 4615, 4616, 4617, 4618, 4619, 4620, 4621, 4622, 4623, 4624, 4625, 4665, 4666, 4820, 4821, 4822, 4823, 4824, 4825}

function onCastSpell(cid, var)
local pos, found = getPlayerPosition(cid), false
doSendMagicEffect({x = pos.x+1, y = pos.y+1, z = pos.z}, 87)

for x = (pos.x - 3), (pos.x + 3) do
   for y = (pos.y - 3), (pos.y + 3) do
    local tmp = {x = x, y = y, z = pos.z, stackpos = 0}
    if isInArray(WATER_TILES, getTileThingByPos(tmp).itemid) then
	   found = true
	   break
    end
   end
end
if found then
  doPlayerAddMana(cid, 1)
else
  doPlayerAddMana(cid, -1)
end
return doCombat(cid, combat, var)
end

 

"Só a beira do abismo que os seres humanos acham forças para mudar."... E isso me da nojo... ¬¬

"Insanity is doing the exact... same fucking thing... over and over again expecting... shit to change... That. Is. Crazy." -Vass/Einstein

 

rohfagundes

avatar
Visconde
Visconde

INFOS

Grupo: ViscondeRegistrado: 10/02/11Posts: 377

aeee vlw =D

funciono

+ rep

pode mover ja =D

mto obg

Slicer

Insanity
avatar
Príncipe
Príncipe

INFOS

Grupo: PríncipeRegistrado: 19/08/10Posts: 4014Gênero: Masculino

sanado, movido

"Só a beira do abismo que os seres humanos acham forças para mudar."... E isso me da nojo... ¬¬

"Insanity is doing the exact... same fucking thing... over and over again expecting... shit to change... That. Is. Crazy." -Vass/Einstein