Log in

View Full Version : Third healing spell



280202
01-10-2012, 12:13 PM
I think that xenobot could have a third healing spell,

for mages:
exura, exura gran, exura vita


Thanks

Jetta
01-10-2012, 12:31 PM
it should be possible to decied how much you want.

Spectrus
01-10-2012, 07:53 PM
Just use a script like this one...



if (Self.Health < 200 and Self.Mana > 20) then
Self.Say("exura")
sleep(math.random(200,600))
end

akro
01-15-2012, 10:18 AM
How to attach that script? When I am trying to execute that script by scripter, in my server log appears that message:
"11:10 [XenoScript] heal.lua: attempt to compare number with function".
What's wrong? I've found 2 similar scripts for healing on that forum, and situation is the same...

Gabriel
01-15-2012, 11:32 AM
Try this



local life = 200
local mana = 20
local spell = 'exura'

local function healer()
if ( (Self.Health() <= life) and (Self.Mana() >= mana) ) then
Self.Say(spell)
end
sleep(math.random(200,450))
healer()
end
healer()


U can change the value of the variables Life and Mana to whatever u want. Below the life value, it will heal. The mana, is the minimum required to use


@Edit: Heres a tutorial that teachs how to use scripts: http://forums.xenobot.net/showthread.php?970-Tutorial-How-to-use-the-Scripter

Hendy
01-15-2012, 02:25 PM
while (true) do
if ((Self.Health() > 325) and (Self.Health() < 400) and (Self.Mana() > 20)) then
Self.Say("exura")
sleep(math.random(200, 600))

elseif ((Self.Health() > 250) and (Self.Health() < 324) and (Self.Mana() > 40)) then
Self.Say("exura gran")
sleep(math.random(200, 600))

elseif ((Self.Health() > 1) and (Self.Health() < 249) and (Self.Mana() > 120)) then
Self.Say("exura vita")
sleep(math.random(200, 600))
end
end

If you want all of your healing spells on one lua file instead of using its healer xd.

Should work, but test it before hand.

akro
01-15-2012, 03:15 PM
Both scripts works perfect, thank you guys very much ;)
All lua scripts which I have found here wants the exact numerical value to heal, for example exura vita from 1 to 500hp. Is it possible to use percent value? Like exura vita from 0 to 50%, gran 51-80% and exura from 81-90%?

Hendy
01-15-2012, 03:40 PM
Nope, I don't think its possible, but I could be wrong. When trying to use % it says unexpected symbol.

soul4soul
01-15-2012, 03:56 PM
It is possible.

Hendy
01-15-2012, 04:09 PM
Could you elaborate and post a script using %?

Thanks.

blakw
01-15-2012, 06:59 PM
Edited Hendy's one with % thing, didn't tested.



while (true) do
if ((Self.Health() > 325) and (Self.HealthPercent() <= 85) and (Self.Mana() > 20)) then
Self.Say("exura")
sleep(math.random(200, 600))

elseif ((Self.Health() > 250) and (Self.HealthPercent() <= 65) and (Self.Mana() > 40)) then
Self.Say("exura gran")
sleep(math.random(200, 600))

elseif ((Self.Health() > 1) and (Self.HealthPercent() <= 30) and (Self.Mana() > 120)) then
Self.Say("exura vita")
sleep(math.random(200, 600))
end
end

Hendy
01-15-2012, 07:16 PM
Ah, thats how you do percent, thanks.

Freedow
01-15-2012, 11:22 PM
What about a second attack spell?

Hendy
01-15-2012, 11:29 PM
blakw yours doesn't work but this one should, needs tested though.


local function Healer()
local creature = Creature.isSelf()
if ((creature:HealthPercent() >= 81) and (creature:HealthPercent() <= 85) and (Self.Mana() > 20)) then
Self.Say("exura")
sleep(math.random(200, 600))

elseif ((creature:HealthPercent() >= 50) and (creature:HealthPercent() <= 80) and (Self.Mana() > 40)) then
Self.Say("exura gran")
sleep(math.random(200, 600))

elseif ((creature:HealthPercent() >= 1) and (creature:HealthPercent() <= 49) and (Self.Mana() > 120)) then
Self.Say("exura vita")
sleep(math.random(200, 600))
end
end

soul4soul
01-15-2012, 11:42 PM
blakw yours doesn't work but this one should, needs tested though.


local function Healer()
local creature = Creature.isSelf()
if ((creature:HealthPercent() >= 81) and (creature:HealthPercent() <= 85) and (Self.Mana() > 20)) then
Self.Say("exura")
sleep(math.random(200, 600))

elseif ((creature:HealthPercent() >= 50) and (creature:HealthPercent() <= 80) and (Self.Mana() > 40)) then
Self.Say("exura gran")
sleep(math.random(200, 600))

elseif ((creature:HealthPercent() >= 1) and (creature:HealthPercent() <= 49) and (Self.Mana() > 120)) then
Self.Say("exura vita")
sleep(math.random(200, 600))
end
end

oh sorry i should of posted an example before. local creature = Creature.isSelf() should be local creature = Creature.GetByID(Self.ID()). remove the function and put it all in a while loop and you should be good to go.

Hendy
01-15-2012, 11:49 PM
Ah, should be it now then.


while (true) do
local creature = Creature.GetByID(Self.ID())
if ((creature:HealthPercent() >= 81) and (creature:HealthPercent() <= 85) and (Self.Mana() > 20)) then
Self.Say("exura")
sleep(math.random(200, 600))

elseif ((creature:HealthPercent() >= 50) and (creature:HealthPercent() <= 80) and (Self.Mana() > 40)) then
Self.Say("exura gran")
sleep(math.random(200, 600))

elseif ((creature:HealthPercent() >= 1) and (creature:HealthPercent() <= 49) and (Self.Mana() > 120)) then
Self.Say("exura vita")
sleep(math.random(200, 600))
end
end

Gabriel
01-16-2012, 02:13 PM
Using percentage, just change

creature:Health() to creature:HealthPercent()

Like that ( Using the script I've wrote as Example )



local life = 70
local mana = 20
local spell = 'exura'

local function healer()
if ( (Self.HealthPercent() <= life) and (Self.Mana() >= mana) ) then
Self.Say(spell)
end
sleep(math.random(200,450))
healer()
end
healer()

I've changed the line 5,

if ( (Self.Health() <= life) and (Self.Mana() >= mana) ) then

to


if ( (Self.HealthPercent() <= life) and (Self.Mana() >= mana) ) then

Hendy
01-16-2012, 02:23 PM
14:22 [XenoScript] Healer - Copy.lua: attempt to call field 'HealthPercent' (a nil value)

You cant call it because there is no self.healthpercent class as of yet, which is why I had to use call Creature