--[[Auto RavenousHydra/Tiamat v1.0b fix2 by ArthasDK (with help of minionArray from Sida's Auto Carry)]]
local enemyMinions=0 --range =400
local enemyChampCount=0
local minChamps = 1
local minCreeps = 4
-- #################################### Minion Array ###################################
minionArray = { team_ally ="##", team_ennemy ="##" }
function minionArray.OnLoad()
map = GetMap()
minionArray.jungleCreeps = {}
minionArray.ennemyMinion = {}
minionArray.allyMinion = {}
for i = 1, objManager.maxObjects do
local object = objManager:getObject(i)
minionArray.OnCreateObj(object)
end
if map.index ~= 4 then
minionArray.team_ally = "Minion_T"..player.team
minionArray.team_ennemy = "Minion_T"..(player.team == TEAM_BLUE and TEAM_RED or TEAM_BLUE)
else
minionArray.team_ally = (player.team == TEAM_BLUE and "Blue" or "Red")
minionArray.team_ennemy = (player.team == TEAM_BLUE and "Red" or "Blue")
end
end
function minionArray.OnCreateObj(object)
if object ~= nil and object.type == "obj_AI_Minion" and not object.dead then
if minionArray.allyMinion[object.name] ~= nil or minionArray.ennemyMinion[object.name] ~= nil or minionArray.allyMinion[object.name] ~= nil then return end
if string.find(object.name,minionArray.team_ally) then minionArray.allyMinion[object.name] = object
elseif string.find(object.name,minionArray.team_ennemy) then minionArray.ennemyMinion[object.name] = object
else minionArray.jungleCreeps[object.name] = object
end
end
end
function minionArray.OnDeleteObj(object)
if object ~= nil and object.type == "obj_AI_Minion" and object.name ~= nil then
if minionArray.jungleCreeps[object.name] ~= nil then minionArray.jungleCreeps[object.name] = nil
elseif minionArray.ennemyMinion[object.name] ~= nil then minionArray.ennemyMinion[object.name] = nil
elseif minionArray.allyMinion[object.name] ~= nil then minionArray.allyMinion[object.name] = nil
end
end
end
function minionArray.objectInRange(objectTable, fromPos, range)
local objectRanged = {}
for name,objectTableObject in pairs(minionArray[objectTable]) do
if objectTableObject ~= nil and objectTableObject.dead == false and objectTableObject.visible and GetDistance2D(fromPos,objectTableObject) <= range then
table.insert(objectRanged, objectTableObject)
end
end
return #objectRanged, objectRanged
end
function minionArray.jungleCreepsInRange(fromPos, range)
return minionArray.objectInRange("jungleCreeps", fromPos, range)
end
function minionArray.ennemyMinionInRange(fromPos, range)
return minionArray.objectInRange("ennemyMinion", fromPos, range)
end
function minionArray.allyMinionInRange(fromPos, range)
return minionArray.objectInRange("allyMinion", fromPos, range)
end
-- #################################### Minion Array ends here ###################################
function OnCreateObj(obj)
if myHero.dead then return end
minionArray.OnCreateObj(obj)
end
function OnDeleteObj(obj)
minionArray.OnDeleteObj(obj)
end
function GetEnemyChampsCount(range)
local count=0
for i=1, heroManager.iCount do
local target = heroManager:GetHero(i)
if target ~= nil and target.dead == false and target.team ~= player.team and target.visible == true and player:GetDistance(target) < range then--385 then
count=count+1
end
end
return count
end
function OnTick()
if myHero.dead then return end
enemyMinions = minionArray.ennemyMinionInRange(myHero, 400)
enemyChampCount = GetEnemyChampsCount(400)
TiamatSlot = GetInventorySlotItem(3077)
RavenousHydraSlot = GetInventorySlotItem(3074)
if TiamatSlot then
if enemyChampCount >= minChamps then
if myHero:CanUseSpell(TiamatSlot) == READY then
CastSpell(TiamatSlot)
end
end
if enemyMinions>=minCreeps then
if myHero:CanUseSpell(TiamatSlot) == READY then
CastSpell(TiamatSlot)
end
end
end
if RavenousHydraSlot then
if enemyChampCount >= minChamps then
if myHero:CanUseSpell(RavenousHydraSlot) == READY then
CastSpell(RavenousHydraSlot)
end
end
if enemyMinions>=minCreeps then
if myHero:CanUseSpell(RavenousHydraSlot) == READY then
CastSpell(RavenousHydraSlot)
end
end
end
end
function OnLoad()
minionArray.OnLoad()
PrintChat("AutoTiamat/Revenous Hydra by ArthasDK (help Sida, Anonymous) Loaded!")
PrintChat("Current Minimum Champs/Minions need for AutoCast ["..tostring(minChamps).."/"..tostring(minCreeps).."] to change this type .minion# (minions 1-10) or .champ# (champs 1-5)")
end
function OnSendChat(text)
for i=1,10,1 do
local str=".minion"..tostring(i)
if text == str then
BlockChat()
minCreeps=i
PrintChat("Minimum Number of Creeps Present for Ravenous Hydra/Tiamat :"..tostring(minCreeps))
end
end
for i=1,5,1 do
local str=".champ"..tostring(i)
if text == str then
BlockChat()
minChamps=i
PrintChat("Minimum Number of Champs Present for Ravenous Hydra/Tiamat :"..tostring(minChamps))
end
end
end
Comments