Log in

View Full Version : Magic trainer



oruxtozz
03-05-2016, 07:57 AM
I have a magic trainer, that I think doesnt work as good as I would wanted..

I will copy in the script below.

What I would want is an magic trainer that casts spells and drink manas from open bps on the ground.
Perfect if I could have 9 containers open and he drinks from that.
And spamm as much spells as possible, I'd assume utana vid, exura vita utani gran hur would work.



I have no idea who made this script I'm using but it wasnt me so I'm not taking credits.
Anyway if I open more then 3 backpacks it bugs, and just drink mana without casting spell.
If I add utani gran hur, it still will only cast utana vid and exura vita.

This is what I have:

local manatype = "great mana potion" -- name of potion
local manapercent = 70 -- mana percent to stop using potions
local listspells = -- list of spells to cast
{
"exura vita",
"utana vid",
}

--[[ DO NOT EDIT ANYTHING BELOW THIS LINE ]]--
function ManaPercent()
return math.abs(Self.Mana() * 100 / Self.MaxMana())
end
local manaid = Item.GetID(manatype)
Module('ManaFromContainers', function(mod)
if ManaPercent() < manapercent then
for indexContainer=0, #Container.GetAll()-1 do
local container = Container.New(indexContainer)
for spot=0, container:ItemCount()-1 do
if container:GetItemData(spot).id == manaid then
container:UseItemWithCreature(spot, Self.ID())
end
end
end
end
mod:Delay(600)
end)

Module("BurnMana", function(mod)
for _, spell in ipairs(listspells) do
Self.Cast(spell)
end
mod:Delay(200)
end)

The Black Boss
03-05-2016, 08:39 PM
Try it:

local manaPotionName = "great mana potion" -- name of potion
local manapercent = 70 -- mana percent to stop using potions
local listspells = { -- list of spells to cast
"exura vita",
"utana vid",
}

--[[ LALALALALA ]]--
function ManaPercent()
return math.abs(Self.Mana() * 100 / Self.MaxMana())
end

local manaPotionID = Item.GetItemIDFromDualInput(manaPotionName)

function MainModule(Mod)
if(ManaPercent() < manapercent) then
local containers = Container.GetAll();
local success = false;
for i=0,#containers do
local container = Container.New(containers[i])
if(container:isOpen()) then
for spot=0,container:ItemCount()-1 do
if(container:GetItemData(spot).id == manaPotionID)then
container:UseItemWithCreature(spot, Self.ID())
success = true;
break;
end
end
end
if(success) then break; end
end
end
Mod:Delay(1020,1080)
end

function BurnMana(Mod)
for _, spell in ipairs(listspells) do
Self.Cast(spell)
end
Mod:Delay(500,600)
end


Module('ManaFromContainers', MainModule, true)
Module("BurnMana", burnMana, true)