Slayer2k91
06-26-2013, 08:20 PM
Hey guys, I'm trying to learn lua and I made this function to heal with mas res/exura sio, but for some reason it only works when there are no monsters on screen, and it sometimes doesn't randomize the hp correctly.
could someone that knows what they're doing take a look?
-----Pacman's sio/mas res script
local playerstoheal = {"Bubble"} --name of the players to heal
local hppct = 75 --target hp percent to heal him/mas res
local hpself = 80 --self hp percent to heal others (if below this and the nigga is close it'll mas res)
local manapcself = 40 --self mp percent to do shit
----only touch below this line if you know what the fuck you are doing----
math.randomseed(os.time())
local hppctr = hppct + math.random(-5, 5)
function checkheal ()
local specs = Self.GetSpectators(false)
for i = 1, #specs do
local healtarget = specs[i]
if healtarget:isPlayer() then
for z = 1, #playerstoheal do
if healtarget:Name() == playerstoheal[i] then
local hppctr = hppct + math.random(-5, 5)
if healtarget:HealthPercent() <= hppctr then
print("healed at "..hppctr.."% expected")
local smppc = math.floor(Self.Mana() / Self.MaxMana()*100)
if smppc >= manapcself then
local shppc = math.floor(Self.Health() / Self.MaxHealth()*100)
if shppc <= hpself then
local htpos = healtarget:Position()
local difx = math.abs(Self.Position().x - htpos.x)
local dify = math.abs(Self.Position().y - htpos.y)
local mrarea = (dify + difx)
if mrarea <= 4 and (difx <= 3) and (dify <= 3) then
if Self.CanCastSpell("exura gran mas res") then
Self.Cast("exura gran mas res", 300)
end
end
else
Self.Say("Exura sio \""..healtarget:Name())
wait(200,400)
end
end
end
end
end
end
end
end
--i dunno how to do modules with delay inside of them yet :(
while true do
checkheal()
wait(400, 800)
end
could someone that knows what they're doing take a look?
-----Pacman's sio/mas res script
local playerstoheal = {"Bubble"} --name of the players to heal
local hppct = 75 --target hp percent to heal him/mas res
local hpself = 80 --self hp percent to heal others (if below this and the nigga is close it'll mas res)
local manapcself = 40 --self mp percent to do shit
----only touch below this line if you know what the fuck you are doing----
math.randomseed(os.time())
local hppctr = hppct + math.random(-5, 5)
function checkheal ()
local specs = Self.GetSpectators(false)
for i = 1, #specs do
local healtarget = specs[i]
if healtarget:isPlayer() then
for z = 1, #playerstoheal do
if healtarget:Name() == playerstoheal[i] then
local hppctr = hppct + math.random(-5, 5)
if healtarget:HealthPercent() <= hppctr then
print("healed at "..hppctr.."% expected")
local smppc = math.floor(Self.Mana() / Self.MaxMana()*100)
if smppc >= manapcself then
local shppc = math.floor(Self.Health() / Self.MaxHealth()*100)
if shppc <= hpself then
local htpos = healtarget:Position()
local difx = math.abs(Self.Position().x - htpos.x)
local dify = math.abs(Self.Position().y - htpos.y)
local mrarea = (dify + difx)
if mrarea <= 4 and (difx <= 3) and (dify <= 3) then
if Self.CanCastSpell("exura gran mas res") then
Self.Cast("exura gran mas res", 300)
end
end
else
Self.Say("Exura sio \""..healtarget:Name())
wait(200,400)
end
end
end
end
end
end
end
end
--i dunno how to do modules with delay inside of them yet :(
while true do
checkheal()
wait(400, 800)
end