Professional Documents
Culture Documents
3>>
require("libs.Utils")
require("libs.ScriptConfig")
require("libs.Animations2")
require("libs.HeroInfo")
require("libs.AbilityDamage")
--[[
0 1 0 1 0 0 1 1
0 1 1 0 1 1 1 1 ____ __ __
0 1 1 1 0 0 0 0 / __/__ ___ / / __ __/ /__ ___ __
0 1 1 0 1 0 0 0 _\ \/ _ \/ _ \/ _ \/ // / / _ `/\ \ /
0 1 1 1 1 0 0 1 /___/\___/ .__/_//_/\_, /_/\_,_//_\_\
0 1 1 0 1 1 0 0 /_/ /___/
0 1 1 0 0 0 0 1
0 1 1 1 1 0 0 0
Auto Armlet Toggle v1.5.3
This script uses armlet to gain hp when:
Theres a flying projectile which would kill you or
theres a hero which is casting ability which would kill you or
theres a hero which is attacking you and one hit from them would kill
you or
your hero is below a specified health and theres no incoming damage so
you wont die by togglig it off. (Default 200 HP)
When ranged hero shoots on you, any hero is in melee range or you start
to attack an enemy hero, the script will auto toggle Armlet ON.
Changelog:
v1.5.3:
- Updated with AbilityDamage library
- Improved calculation
v1.5.2:
- Armlet will not be now toggle when you are invisible unless
somebody is casting AOE ability on you and you would die from it.
v1.5.1:
- Added AutoActivation when you start to attack an enemy hero.
v1.5:
- Updated Calculation.
v1.4:
- Added calculation of incoming damage (projectiles, abilities,
attacking heroes)
- MinimumHP is now considered only when there is no incoming
damage and there are enemy heroes near
v1.3:
Added Auto toggle on when ranged hero shoots on you or any
hero is in melee range of you.
v1.2:
- Reworked for new version
v1.1:
- Tweaked script for the new armlet mechanics again
- Removed the configurable armlet delay
v1.0c:
- Tweaked script for the new armlet mechanics
- Added key for manual armlet toggling
v1.0b:
- Script now checks armlet cooldown even if it is activated by
the user
v1.0a:
- Script now disables itself if the user is under Ice Blast
effect
- Lowered menu Width
v1.0:
- Release
]]
hotkey = config.Hotkey
minhp = config.MinimumHP
function Key(msg,code)
if msg ~= KEY_UP or code ~= hotkey or client.chat then return end
if not active then
active = true
statusText.text = "Auto armlet toggle: On"
return true
else
active = false
statusText.text = "Auto armlet toggle: Off"
return true
end
end
local me = entityList:GetMyHero()
local player = entityList:GetMyPlayer()
Animations.entities = {}
local anientiCount = 1
Animations.entities[1] = me
for i = 1,#enemies do
anientiCount = anientiCount + 1
Animations.entities[anientiCount] = enemies[i]
end
if me:DoesHaveModifier("modifier_ice_blast") then
if not me:IsStunned() and armState and SleepCheck() and not
me:IsInvisible() then
me:CastItem("item_armlet")
Sleep(ARMLET_DELAY)
end
return
end
local closeEnemies =
entityList:GetEntities
(
function (v)
return
(
(v.hero or v.creep)
and v.alive
and v.team ~= me.team
and GetDistance2D(me,v) <
v.attackRange+100
and (not v:IsRanged() or
GetDistance2D(me,v) < 500)
and not Animations.CanMove(v)
and Animations.isAttacking(v)
and
(math.max(math.abs(FindAngleR(v)
-
math.rad(FindAngleBetween(v, me)))
- 0.20, 0)) == 0
and
(Animations.GetAttackTime(v)*1000
-
Animations.getAttackDuration(v)
- client.latency - ((1 /
Animations.maxCount)
* 3 * (1 + (1 - 1/
Animations.maxCount)))
*1000) < ARMLET_GAIN_TIME/1.5
)
end
)
local closeProjectiles =
entityList:GetProjectiles
(
function (v)
return
(
v.target
and v.target == me
and
(GetDistance2D(v,me)/v.speed)*1000 < ARMLET_GAIN_TIME/2.5
)
end
)
function Load()
if PlayingGame() then
local me = entityList:GetMyHero()
if not me then
script:Disable()
else
incoming_projectiles = {}
incoming_damage = 0
testedIncomingDamage = 0
reg = true
script:RegisterEvent(EVENT_FRAME, Tick)
script:RegisterEvent(EVENT_KEY, Key)
script:UnregisterEvent(Load)
end
end
end
function Close()
if reg then
incoming_projectiles = {}
incoming_damage = 0
testedIncomingDamage = 0
script:UnregisterEvent(Tick)
script:UnregisterEvent(Key)
script:RegisterEvent(EVENT_TICK, Load)
reg = false
end
end
script:RegisterEvent(EVENT_CLOSE, Close)
script:RegisterEvent(EVENT_TICK, Load)