ME
action

Evil Spirit

Por meubk, 31 de out. de 2012 em Actions e Talkactions

script
otserv
11
1.8k
meubkM
31 de outubro de 2012 às 22:45

Evil Spirit

 

 

Olá, venho trazer esta spell Evil Spirit, que fiz baseada na magia do MuOnline.

 

-- SPELL EVIL SPIRIT BY: XOTSERVX --

local min, max = 100, 200 -- dano

function isWalkable(pos, creature, proj, pz)-- by Nord
if getTileThingByPos({x = pos.x, y = pos.y, z = pos.z, stackpos = 0}).itemid == 0 then return false end
if getTopCreature(pos).uid > 0 and creature then return false end
if getTileInfo(pos).protection and pz then return false, true 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 getPosDirs(p, dir)
return dir == 1 and {x=p.x-1, y=p.y, z=p.z} or dir == 2 and {x=p.x-1, y=p.y+1, z=p.z} or dir == 3 and {x=p.x, y=p.y+1, z=p.z} or dir == 4 and {x=p.x+1, y=p.y+1, z=p.z} or dir == 5 and {x=p.x+1, y=p.y, z=p.z} or dir == 6 and {x=p.x+1, y=p.y-1, z=p.z} or dir == 7 and {x=p.x, y=p.y-1, z=p.z} or dir == 8 and {x=p.x-1, y=p.y-1, z=p.z}
end

function posIgual(pos1, pos2)
return pos1.x == pos2.x and pos1.y == pos2.y and pos1.z == pos2.z and true or false
end

effect = 62
distance = 31
damage = COMBAT_DEATHDAMAGE

evilspirit = {
walk = function (cid, min, max, pos, rounds, ultimapos)
if rounds == 0 then return true end
if not isCreature(cid) then return true end
posdisp = {}
for _, dir in pairs({1, 5, 7, 3}) do
if isWalkable(getPosDirs(pos, dir)) and not posIgual(getPosDirs(pos, dir), getThingPos(cid)) and not posIgual(getPosDirs(pos, dir), ultimapos) then
table.insert(posdisp, getPosDirs(pos, dir))
end
end
if #posdisp < 1 then return true end
posesc = posdisp[math.random(1, #posdisp)]
ultimapos = pos
doSendDistanceShoot(pos, posesc, distance)
doAreaCombatHealth(cid, damage, posesc, 0, -min, -max, effect)
addEvent(evilspirit.walk, 140, cid, -min, -max, posesc, rounds - 1, ultimapos)
end
}

function onUse(cid,item,item2,frompos,pos,topos)
evilspirit.walk(cid, 10, 20, getThingPos(cid), 40, {x=1, y=1, z=1})
for i = 1, 13 do
addEvent(evilspirit.walk, i * math.random(300, 500), cid, min, max, getThingPos(cid), 40, {x=1, y=1, z=1})
end
return true
end

 

 

As configurações está no script, vcs montam a tag agora. Ai vai um video paraver como tá:

 

Editado Outubro 31 por xotservx

1 mês depois...
fokus090F
25 de novembro de 2012 às 13:07

[Warning - Event::loadScript] Event onCastSpell not found

PmcdP
25 de novembro de 2012 às 20:27

Legal , voce pode me passar o server e o client ? REP + !

 

@EDIT

 

Qual a tag que coloco na Spell.xml ???

Editado Novembro 25 por Pmcd

IGORFSI
28 de novembro de 2012 às 16:08

Achei,legal so que tinha que diminuir o Tempo Dela :)

SkymagnumS
28 de novembro de 2012 às 16:11

Isso não é uma spell e sim uma action estarei reportando para moverem.

Editado Novembro 28 por Skymagnum

StigalS
28 de novembro de 2012 às 17:14

Topico Movido!

4 meses depois...
BananaFightB
31 de março de 2013 às 20:21

Adaptei para talkaction e arrumei alguns bugs, adicionei para remover mana, e só com vocation poder usar :

 

local min, max = 100, 200

function isWalkable(pos, creature, proj, pz)-- by Nord
if getTileThingByPos({x = pos.x, y = pos.y, z = pos.z, stackpos = 0}).itemid == 0 then return false end
if getTopCreature(pos).uid > 0 and creature then return false end
if getTileInfo(pos).protection and pz then return false, true 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 getPosDirs(p, dir)
return dir == 1 and {x=p.x-1, y=p.y, z=p.z} or dir == 2 and {x=p.x-1, y=p.y+1, z=p.z} or dir == 3 and {x=p.x, y=p.y+1, z=p.z} or dir == 4 and {x=p.x+1, y=p.y+1, z=p.z} or dir == 5 and {x=p.x+1, y=p.y, z=p.z} or dir == 6 and {x=p.x+1, y=p.y-1, z=p.z} or dir == 7 and {x=p.x, y=p.y-1, z=p.z} or dir == 8 and {x=p.x-1, y=p.y-1, z=p.z}
end

function posIgual(pos1, pos2)
return pos1.x == pos2.x and pos1.y == pos2.y and pos1.z == pos2.z and true or false
end

effect = 62
distance = 31
damage = COMBAT_DEATHDAMAGE

evilspirit = {
walk = function (cid, min, max, pos, rounds, ultimapos)
if rounds == 0 then return true end
if not isCreature(cid) then return true end
posdisp = {}
for _, dir in pairs({1, 5, 7, 3}) do
if isWalkable(getPosDirs(pos, dir)) and not posIgual(getPosDirs(pos, dir), getThingPos(cid)) and not posIgual(getPosDirs(pos, dir), ultimapos) then
table.insert(posdisp, getPosDirs(pos, dir))
end
end
if #posdisp < 1 then return true end
posesc = posdisp[math.random(1, #posdisp)]
ultimapos = pos
doSendDistanceShoot(pos, posesc, distance)
doAreaCombatHealth(cid, damage, posesc, 0, -1000, -2000, effect)
addEvent(evilspirit.walk, 140, cid, -min, -max, posesc, rounds - 1, ultimapos)
end
}

function onSay(cid,item,item2,frompos,pos,topos)
local config = {
s = 11548,
exhau = 60
}

if (getPlayerStorageValue(cid, config.s) <= os.time()) then
doPlayerSendCancel(cid, "Você tem que esperar " .. config.exhau .. " segundos para usar novamente.")
setPlayerStorageValue(cid,config.s,os.time()+config.exhau)
return true
end

if getPlayerVocation(cid) == 2 or getPlayerVocation(cid) == 6 or getPlayerVocation(cid) == 1 or getPlayerVocation(cid) == 5 then
evilspirit.walk(cid, 10, 20, getThingPos(cid), 40, {x=1, y=1, z=1})
for i = 1, 13 do
addEvent(evilspirit.walk, i * math.random(300, 500), cid, min, max, getThingPos(cid), 40, {x=1, y=1, z=1})
end
setPlayerStorageValue(cid,config.s,os.time()+config.exhau)
doCreatureAddMana(cid, -1300)
else
doPlayerSendCancel(cid, "FK YOU NOOB, THIS SPELL IS NOT FOR YOU")
end
return true
end

 

Editando :

doAreaCombatHealth(cid, damage, posesc, 0, -1000, -2000, effect)

 

-1000 = Minimo, -2000 = Maximo

 

Vocações que podem usar

 

if getPlayerVocation(cid) == 2 or getPlayerVocation(cid) == 6 or getPlayerVocation(cid) == 1 or getPlayerVocation(cid) == 5 then

 

Quanto de mana vai remover

 

doCreatureAddMana(cid, -1300)

 

mensagem que vai enviar quando tiver exausted

 

doPlayerSendCancel(cid, "Você tem que esperar " .. config.exhau .. " segundos para usar novamente."

 

Tempo da exausted

 

exhau = 60

 

Acho que é isso, qualquer duvida só perguntar.

Editado Abril 20 por BananaFight

JeanCristianJ
05 de abril de 2013 às 20:44

nossa obrigado ^^ tem exausted tambem? e sobre o level tem level para usar a magia?

ah ja vi a exaust '-'

Editado Abril 5 por JeanCristian

BananaFightB
06 de abril de 2013 às 05:29

sobre o level você faz o seguinte :

 

Adiciona isso :

 

if getPlayerLevel(cid) < 100 then
doPlayerSendCancel(cid, "You dont have level for this spell")
end

 

Embaixo disso :

 

if (getPlayerStorageValue(cid, config.s) <= os.time()) then
doPlayerSendCancel(cid, "Você tem que esperar " .. config.exhau .. " segundos para usar novamente.")
setPlayerStorageValue(cid,config.s,os.time()+config.exhau)
return true
end

 

O 100 é o level minimo pra usar, ai se o level do player for menor que 100, ele n consegue usar.

Editado Abril 20 por BananaFight

VincV
06 de abril de 2013 às 10:01

sobre o level você faz o seguinte :

 

Adiciona isso :

 

if getPlayerLevel(cid) < 100 then
doPlayerSendCancel(cid, "You dont have level for this spell")
end

 

Embaixo disso :

 

if (getPlayerStorageValue(cid, config.s) <= os.time()) then
doPlayerSendCancel(cid, "Você tem que esperar " .. config.exhau .. " segundos para usar novamente.")
setPlayerStorageValue(cid,config.s,os.time()+config.exhau) return
end

 

O 100 é o level minimo pra usar, ai se o level do player for menor que 100, ele n consegue usar.

...

sei n se tu é melhor que o skydangerous,apesar de tudo ele n cometeria erros com os return

se n coloca o return,vai só manda a mesagem mas vai usa a spell

 

onSay(cid,item,item2,frompos,pos,topos)

pó cara ta com preguisa de muda nome das varivel,as em vermelho nem vai te valor em talk.

 

 

e porque n fez em spell

2 semanas depois...
BananaFightB
20 de abril de 2013 às 09:05

Lord, errar é humano, não cheguei a testar e por isso não pude ver esses erros, arrumei bugs na hora de adaptar para talkactions que eu ja sabia que aconteceriam, e mais cara, achei que as alfinetadas ja deviam ter parado, para que vim aqui no tópico ficar alfinetando, Cresça e evolua...