PDA

View Full Version : Spells in Lua



jorgeriva1
08-17-2016, 03:40 PM
Hi,

I've been trying to sort this out for a couple of days now. I'm new to Xenobot and lua but I've been trying with it.

Basically I use 3 spells, spellA, spellB and SpellC. SpellA has a 12s CD, spellB has a 8s CD and spellC has a 2s CD. I want spellA and spellB to be used 6 seconds apart, so I would need the script to cast spellA, then spam spellC until the 6 seconds has passed and it's time to cast spellB, then spam spellC again until it's time to cast spellA again.

Any help at all would be much appreciated. Thanks in advance.

Jorge

EDIT:
I've been playing around some more and I've got it to use spellA, wait 6s, use spellB then spam spellC until spellA is ready again. Another problem I've encountered is that it will often use spellA before I am in AoE range for it, is there an if condition which I can add in to correct this?


local spella = "exevo vis hur"
local spellb = "utori kor"
local spellc = "exori"

Module.New('spella', function()
if Self.GetSpellCooldown(spella) == 0 then
if Self.Mana() > 274 then
if Self.TargetID() > 0 then
Self.Cast('Final Showdown')
wait(6000)
spellatime = 1
end
end
end
end)

Module.New('spellb', function()
if spellatime == 1 then
if Self.GetSpellCooldown(spellb) == 0 then
if Self.Mana() > 374 then
if Self.TargetID() > 0 then
Self.Cast('Strong Spinning Blades')
spellatime = 0
end
end
end
end
end)

Module.New('spellc', function()
if Self.GetSpellCooldown(spella) > 0 and Self.GetSpellCooldown(spellb) > 0 then
if Self.Mana() > 114 then
if Self.TargetID() > 0 then
Self.Cast('Exori')
end
end
end
end)

jorgeriva1
08-19-2016, 08:36 PM
Bump! Not too fussed about the script now, but does anyone know how to only cast spells if your target is adjacent to you? Thanks