LU

Colocar Exausted Em Somente Uma Magia?

Por lukervis, 29 de fev. de 2012 em Scripts

11
1.8k
lukervisL
29 de fevereiro de 2012 às 04:28

Eu vi em alguns lugares que tem como colocar exausted em uma só magia, pois bem, não estou conseguindo, gostaria que só desse para soltar a magia depois de 50 segundos:

 

 

 

local conf = {

summon = {"Headcaptor", "Headcaptor", "Headcaptor", "Headcaptor"}, -- nome dos 4 monstros que irão aparecer.

min = 350, -- dano minimo de cada SD

max = 450, -- dano maximo de cada SD

hits = 1 -- qntos hits cada summon vai dar

}

 

local summon = {

monster = function (cid, tab)

for _, mid in pairs(tab) do

s = doSummonCreature(mid, getThingPos(cid))

doSendMagicEffect(getThingPos(s), 10)

doConvinceCreature(cid, s)

end

end,

attack = function (cid, target, min, max)

for _, summon in pairs(getCreatureSummons(cid)) do

if isCreature(target) and isCreature(summon) then

doSendDistanceShoot(getThingPos(summon), getThingPos(target), CONST_ANI_SUDDENDEATH)

doAreaCombatHealth(summon, COMBAT_DEATHDAMAGE, getThingPos(target), 0, -min, -max, CONST_ME_MORTAREA)

end

end

end,

remove = function (cid)

for _, summon in pairs(getCreatureSummons(cid)) do

if isCreature(summon) then

doRemoveCreature(summon)

end

end

end,

}

 

function onCastSpell(cid, var)

local target = getCreatureTarget(cid)

if target then

summon.monster(cid, conf.summon)

for i = 1, conf.hits do

addEvent(summon.attack, 1000 * i, cid, target, conf.min, conf.max)

end

addEvent(summon.remove, conf.hits * 1000 + 1000, cid)

end

return true

end

 

 

Essa aqui somente depois de 20 segudos

 

 

 

function onCastSpell(cid, var)

local jogadorpos = getCreaturePosition(cid)

local target = getCreatureTarget(cid)

local monsterpos = getCreaturePosition(target)

if target == isMonster or isCreature then

doTeleportThing(cid,monsterpos)

doTeleportThing(target,jogadorpos)

doSendMagicEffect(jogadorpos, 10)

doSendMagicEffect(monsterpos, 10)

doCreatureSay(cid, "UTEVO WARP!!", TALKTYPE_ORANGE_1)

else

doPlayerSendTextMessage(cid,20,'You can only use it on creatures')

end

return true

end

 

 

 

Essa aqui somente a cada 40 segundos

 

 

 

local combat1 = createCombatObject()

setCombatParam(combat1, COMBAT_PARAM_DISTANCEEFFECT, CONST_ANI_ENERGY)

setCombatParam(combat1, COMBAT_PARAM_CREATEITEM, 1499)

 

local arr1 = {

{0, 1, 0, 0, 0, 0, 1, 0, 1},

{0, 0, 1, 0, 1, 1, 0, 1, 1},

{1, 0, 1, 1, 0, 0, 0, 0, 0},

{0, 1, 0, 0, 0, 1, 1, 0, 1},

{1, 1, 0, 1, 2, 0, 0, 1, 0},

{0, 0, 0, 0, 0, 1, 0, 0, 1},

{1, 0, 1, 0, 1, 0, 1, 0, 1},

{0, 0, 0, 0, 0, 0, 0, 1, 0},

{0, 1, 0, 1, 1, 0, 1, 0, 1}

}

 

 

local area1 = createCombatArea(arr1)

 

 

setCombatArea(combat1, area1)

 

 

local function onCastSpell1(parameters)

doCombat(parameters.cid, parameters.combat1, parameters.var)

end

 

 

function onCastSpell(cid, var)

 

local parameters = { cid = cid, var = var, combat1 = combat1 }

 

addEvent(onCastSpell1, 100, parameters)

 

return TRUE

end

 

 

E por fim, essa aqui só poderia usar novamente depois de 15 segundos

 

 

 

local combat1 = createCombatObject()

setCombatParam(combat1, COMBAT_PARAM_TYPE, COMBAT_PHYSICALDAMAGE)

setCombatParam(combat1, COMBAT_PARAM_EFFECT, 39)

setCombatParam(combat1, COMBAT_PARAM_DISTANCEEFFECT, CONST_ANI_HOLY)

setCombatParam(combat1, COMBAT_PARAM_CREATEITEM, 8387)

 

local combat2 = createCombatObject()

setCombatParam(combat2, COMBAT_PARAM_TYPE, COMBAT_PHYSICALDAMAGE)

setCombatParam(combat2, COMBAT_PARAM_EFFECT, 39)

setCombatParam(combat2, COMBAT_PARAM_DISTANCEEFFECT, CONST_ANI_HOLY)

setCombatParam(combat2, COMBAT_PARAM_CREATEITEM, 8386)

 

local combat3 = createCombatObject()

setCombatParam(combat3, COMBAT_PARAM_TYPE, COMBAT_PHYSICALDAMAGE)

setC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 1, 0, 0, 0, 0, 0,},

{0, 0, 0, 0, 1, 0, 1, 0, 1, 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,},

}

local area1 = createCombatArea(arr1)

local area2 = createCombatArea(arr2)

local area3 = createCombatArea(arr3)

 

setCombatArea(combat1, area1)

setCombatArea(combat2, area2)

setCombatArea(combat3, area3)

 

local function onCastSpell1(parameters)

doCombat(parameters.cid, parameters.combat1, parameters.var)

end

 

local function onCastSpell2(parameters)

doCombat(parameters.cid, parameters.combat2, parameters.var)

end

 

 

local function onCastSpell3(parameters)

doCombat(parameters.cid, parameters.combat3, parameters.var)

end

 

function onCastSpell(cid, var)

local parameters = { cid = cid, var = var, combat1 = combat1, combat2 = combat2, combat3 = combat3 }

addEvent(onCastSpell1, 100, parameters)

addEvent(onCastSpell2, 100, parameters)

addEvent(onCastSpell3, 300, parameters)

 

return TRUE

end

 

 

Editado Fevereiro 29 por luakao

jhon992J
29 de fevereiro de 2012 às 10:04

Primeira:

 

 

 

 

local conf = {

summon = {"Headcaptor", "Headcaptor", "Headcaptor", "Headcaptor"}, -- nome dos 4 monstros que irão aparecer.

min = 350, -- dano minimo de cada SD

max = 450, -- dano maximo de cada SD

hits = 1, -- qntos hits cada summon vai dar

exhaustionInSeconds = 50, -- segundos de exausted

storage = 34534 -- storage(não mexa)

}

 

local summon = {

monster = function (cid, tab)

for _, mid in pairs(tab) do

s = doSummonCreature(mid, getThingPos(cid))

doSendMagicEffect(getThingPos(s), 10)

doConvinceCreature(cid, s)

end

end,

attack = function (cid, target, min, max)

for _, summon in pairs(getCreatureSummons(cid)) do

if isCreature(target) and isCreature(summon) then

doSendDistanceShoot(getThingPos(summon), getThingPos(target), CONST_ANI_SUDDENDEATH)

doAreaCombatHealth(summon, COMBAT_DEATHDAMAGE, getThingPos(target), 0, -min, -max, CONST_ME_MORTAREA)

end

end

end,

remove = function (cid)

for _, summon in pairs(getCreatureSummons(cid)) do

if isCreature(summon) then

doRemoveCreature(summon)

end

end

end,

}

 

function onCastSpell(cid, var)

 

if(exhaustion.check(cid, conf.storage) == TRUE) then

doPlayerSendCancel(cid, "You can only use after [" .. exhaustion.get(cid, 34534).."] seconds.")

return false

end

 

local target = getCreatureTarget(cid)

if target then

summon.monster(cid, conf.summon)

for i = 1, conf.hits do

addEvent(summon.attack, 1000 * i, cid, target, conf.min, conf.max)

end

addEvent(summon.remove, conf.hits * 1000 + 1000, cid)

end

exhaustion.set(cid, conf.storage, conf.exhaustionInSeconds)

return true

end

 

 

 

 

Segunda:

 

 

 

 

function onCastSpell(cid, var)

 

if(exhaustion.check(cid, storage) == TRUE) then

doPlayerSendCancel(cid, "You can only use after [" .. exhaustion.get(cid, 34535).."] seconds.")

return false

end

 

local jogadorpos = getCreaturePosition(cid)

local target = getCreatureTarget(cid)

local monsterpos = getCreaturePosition(target)

local exhaustionInSeconds = 20 -- segundos de exausted

local storage = 34535 -- storage(não mexa)

if target == isMonster or isCreature then

doTeleportThing(cid,monsterpos)

doTeleportThing(target,jogadorpos)

doSendMagicEffect(jogadorpos, 10)

doSendMagicEffect(monsterpos, 10)

doCreatureSay(cid, "UTEVO WARP!!", TALKTYPE_ORANGE_1)

exhaustion.set(cid, storage, exhaustionInSeconds)

else

doPlayerSendTextMessage(cid,20,'You can only use it on creatures')

end

return true

end

 

 

 

 

Terceira:

 

 

 

 

local combat1 = createCombatObject()

setCombatParam(combat1, COMBAT_PARAM_DISTANCEEFFECT, CONST_ANI_ENERGY)

setCombatParam(combat1, COMBAT_PARAM_CREATEITEM, 1499)

 

local arr1 = {

{0, 1, 0, 0, 0, 0, 1, 0, 1},

{0, 0, 1, 0, 1, 1, 0, 1, 1},

{1, 0, 1, 1, 0, 0, 0, 0, 0},

{0, 1, 0, 0, 0, 1, 1, 0, 1},

{1, 1, 0, 1, 2, 0, 0, 1, 0},

{0, 0, 0, 0, 0, 1, 0, 0, 1},

{1, 0, 1, 0, 1, 0, 1, 0, 1},

{0, 0, 0, 0, 0, 0, 0, 1, 0},

{0, 1, 0, 1, 1, 0, 1, 0, 1}

}

 

 

local area1 = createCombatArea(arr1)

 

 

setCombatArea(combat1, area1)

 

 

local function onCastSpell1(parameters)

doCombat(parameters.cid, parameters.combat1, parameters.var)

end

 

 

function onCastSpell(cid, var)

 

local exhaustionInSeconds = 40 -- segundos de exausted

local storage = 34536 -- storage(não mexa)

 

if(exhaustion.check(cid, storage) == TRUE) then

doPlayerSendCancel(cid, "You can only use after [" .. exhaustion.get(cid, 34536).."] seconds.")

return false

end

 

local parameters = { cid = cid, var = var, combat1 = combat1 }

 

addEvent(onCastSpell1, 100, parameters)

exhaustion.set(cid, storage, exhaustionInSeconds)

 

return TRUE

end

 

 

 

 

Quarta:

 

 

 

 

local combat1 = createCombatObject()

setCombatParam(combat1, COMBAT_PARAM_TYPE, COMBAT_PHYSICALDAMAGE)

setCombatParam(combat1, COMBAT_PARAM_EFFECT, 39)

setCombatParam(combat1, COMBAT_PARAM_DISTANCEEFFECT, CONST_ANI_HOLY)

setCombatParam(combat1, COMBAT_PARAM_CREATEITEM, 8387)

 

local combat2 = createCombatObject()

setCombatParam(combat2, COMBAT_PARAM_TYPE, COMBAT_PHYSICALDAMAGE)

setCombatParam(combat2, COMBAT_PARAM_EFFECT, 39)

setCombatParam(combat2, COMBAT_PARAM_DISTANCEEFFECT, CONST_ANI_HOLY)

setCombatParam(combat2, COMBAT_PARAM_CREATEITEM, 8386)

 

local combat3 = createCombatObject()

setCombatParam(combat3, COMBAT_PARAM_TYPE, COMBAT_PHYSICALDAMAGE)

setCombatParam(combat3, COMBAT_PARAM_EFFECT, 28)

 

local arr1 = {

{0, 0, 0, 0, 0, 0, 1, 1, 1, 0, 0, 0, 0.},

{0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 0, 0.},

{0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1,},

{0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1,},

{0, 0, 0, 0, 0, 0, 2, 0, 0, 0, 0, 0, 1,},

{0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1,},

{0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1,},

{0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 0, 0,},

{0, 0, 0, 0, 0, 0, 1, 1, 1, 0, 0, 0, 0,},

}

local arr2 = {

{0, 0, 0, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0.},

{0, 0, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0.},

{1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,},

{1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,},

{1, 0, 0, 0, 0, 0, 2, 0, 0, 0, 0, 0, 0,},

{1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,},

{1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,},

{0, 0, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0,},

{0, 0, 0, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0,},

}

local arr3 = {

{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, 1, 0, 1, 0, 1, 0, 0, 0, 0,},

{0, 0, 0, 0, 0, 1, 1, 1, 0, 0, 0, 0, 0,},

{0, 1, 1, 1, 1, 1, 2, 1, 1, 1, 1, 1, 0,},

{0, 0, 0, 0, 0, 1, 1, 1, 0, 0, 0, 0, 0,},

{0, 0, 0, 0, 1, 0, 1, 0, 1, 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,},

}

local area1 = createCombatArea(arr1)

local area2 = createCombatArea(arr2)

local area3 = createCombatArea(arr3)

 

setCombatArea(combat1, area1)

setCombatArea(combat2, area2)

setCombatArea(combat3, area3)

 

local function onCastSpell1(parameters)

doCombat(parameters.cid, parameters.combat1, parameters.var)

end

 

local function onCastSpell2(parameters)

doCombat(parameters.cid, parameters.combat2, parameters.var)

end

 

 

local function onCastSpell3(parameters)

doCombat(parameters.cid, parameters.combat3, parameters.var)

end

 

function onCastSpell(cid, var)

 

local exhaustionInSeconds = 15 -- segundos de exausted

local storage = 34537 -- storage(não mexa)

 

if(exhaustion.check(cid, storage) == TRUE) then

doPlayerSendCancel(cid, "You can only use after [" .. exhaustion.get(cid, 34537).."] seconds.")

return false

end

 

local parameters = { cid = cid, var = var, combat1 = combat1, combat2 = combat2, combat3 = combat3 }

addEvent(onCastSpell1, 100, parameters)

addEvent(onCastSpell2, 100, parameters)

addEvent(onCastSpell3, 300, parameters)

exhaustion.set(cid, storage, exhaustionInSeconds)

return TRUE

end

 

 

 

Editado Março 1 por Jhon992

lukervisL
29 de fevereiro de 2012 às 10:31

Opa, a primeira não ficou com exhausted, ficou normal, como antes ..

já a segunda deu esse erro

 

 

 

[29/02/2012 10:31:14] [Error - Spell Interface]

[29/02/2012 10:31:14] data/spells/scripts/pbot/warp.lua:onCastSpell

[29/02/2012 10:31:14] Description:

[29/02/2012 10:31:14] data/spells/scripts/pbot/warp.lua:3: attempt to index global 'conf' (a nil value)

[29/02/2012 10:31:14] stack traceback:

[29/02/2012 10:31:14] data/spells/scripts/pbot/warp.lua:3: in function <data/spells/scripts/pbot/warp.lua:1>

 

 

 

A terceira deu o seguinte erro também

 

 

 

[29/02/2012 10:32:29] [Error - Spell Interface]

[29/02/2012 10:32:29] data/spells/scripts/trap.lua:onCastSpell

[29/02/2012 10:32:29] Description:

[29/02/2012 10:32:29] data/spells/scripts/trap.lua:34: attempt to index global 'conf' (a nil value)

[29/02/2012 10:32:29] stack traceback:

[29/02/2012 10:32:29] data/spells/scripts/trap.lua:34: in function <data/spells/scripts/trap.lua:32>

 

 

 

A quarta também deu um erro:

 

[29/02/2012 10:33:01] [Error - Spell Interface]

[29/02/2012 10:33:01] data/spells/scripts/pbot/trapera.lua:onCastSpell

[29/02/2012 10:33:01] Description:

[29/02/2012 10:33:01] data/spells/scripts/pbot/trapera.lua:76: attempt to index global 'conf' (a nil value)

[29/02/2012 10:33:01] stack traceback:

[29/02/2012 10:33:01] data/spells/scripts/pbot/trapera.lua:76: in function <data/spells/scripts/pbot/trapera.lua:74>

 

 

Editado Fevereiro 29 por luakao

jhon992J
29 de fevereiro de 2012 às 11:41

Arrumei la em cima, substitui e vê os erro pra min.

lukervisL
29 de fevereiro de 2012 às 12:26

Só uma pergunta, eu tenho que remover o exhaustion do spells.xml das magias que você editou ?

Porque eu coloquei todas e continua com o mesmo exhausted, de 2 sec, mas não apareceu nenhum erro de script no log do distro..

Editado Fevereiro 29 por luakao

VodkartV
29 de fevereiro de 2012 às 15:07

sim,remova o exhaustion do spells.xml daquelas magias ali em cima

lukervisL
29 de fevereiro de 2012 às 16:51

Ainda continua com os exhausted de 2 sec padrão, gostaria de uma outra dúvida também:

 

como que eu coloco para essa spell sumonar apenas um bixo, caso a pessoa ja tenha um protector sumonado, ela não sumonará ?

 

 

 

function onTargetTile(cid, position)

position.stackpos = 255

doConvinceCreature(cid, doCreateMonster("Protector", position, false))

doSendMagicEffect(position, CONST_ME_MAGIC_BLUE)

return true

end

local arr = {

{0, 0, 0},

{0, 2, 0},

{0, 1, 0},

}

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

setCombatArea(combat, area)

setCombatParam(combat, COMBAT_PARAM_EFFECT, CONST_ME_MAGIC_BLUE)

setCombatCallback(combat, CALLBACK_PARAM_TARGETTILE, "onTargetTile")

function onCastSpell(cid, var)

return doCombat(cid, combat, var)

end

 

Editado Fevereiro 29 por luakao

VodkartV
29 de fevereiro de 2012 às 20:45
function onTargetTile(cid, position)
position.stackpos = 255
doConvinceCreature(cid, doCreateMonster("Protector", position, false))
doSendMagicEffect(position, CONST_ME_MAGIC_BLUE)
return true
end
local arr = {
{0, 0, 0},
{0, 2, 0},
{0, 1, 0},
}
local area, combat = createCombatArea(arr), createCombatObject()
setCombatArea(combat, area)
setCombatParam(combat, COMBAT_PARAM_EFFECT, CONST_ME_MAGIC_BLUE)
setCombatCallback(combat, CALLBACK_PARAM_TARGETTILE, "onTargetTile")
function onCastSpell(cid, var)
if #getCreatureSummons(cid) >= 1 then
return doPlayerSendCancel(cid, "Você já tem um summon.")
else
return doCombat(cid, combat, var)
end
return TRUE
end

lukervisL
01 de março de 2012 às 06:33

Obrigado Vodkart, estou no aguarde da resposta do Jhon992

jhon992J
01 de março de 2012 às 10:17

Arrumei, esta 100% agora, testei aqui!

lukervisL
01 de março de 2012 às 13:03

A terceira, a quarta e a primeira pegou, já a segunda continua sem exhausted...

Editado Março 1 por luakao