RO
pedido

Ajuda nessa spell aqui =X

Por rohfagundes, 31 de jan. de 2013 em Scripts

14
1.4k
rohfagundesR
31 de janeiro de 2013 às 16:32

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

Editado Janeiro 31 por rohfagundes

LostzeraL
31 de janeiro de 2013 às 20:06

não intendi uq vc quer

 

Abraço

rohfagundesR
31 de janeiro de 2013 às 20:29

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

ArtigoA
31 de janeiro de 2013 às 20:37

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

GearsG
31 de janeiro de 2013 às 20:41

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

Editado Janeiro 31 por Gears

rohfagundesR
31 de janeiro de 2013 às 20:42

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

 

Editado Janeiro 31 por rohfagundes

GearsG
31 de janeiro de 2013 às 20:57

@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

rohfagundesR
31 de janeiro de 2013 às 21:02

@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

SlicerS
31 de janeiro de 2013 às 21:05

como q ta a tag da spell heim? ;x

 

vcs ae emcima colocaram o end no lugar errado ^^

Editado Janeiro 31 por Slicer

rohfagundesR
31 de janeiro de 2013 às 21:07

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

GearsG
31 de janeiro de 2013 às 21:10

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

SlicerS
31 de janeiro de 2013 às 21:10

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

 

rohfagundesR
31 de janeiro de 2013 às 21:13

aeee vlw =D

funciono

+ rep

pode mover ja =D

mto obg

SlicerS
31 de janeiro de 2013 às 21:15

sanado, movido