-
Notifications
You must be signed in to change notification settings - Fork 23
/
Venon.lua
74 lines (64 loc) · 2.32 KB
/
Venon.lua
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
-- Author: paroxysm
-- Version: 3
-- Updated: 05.02.2017
local venom = {}
venom.optionEnable = Menu.AddOption({ "Hero Specific","Venomancer" }, "Enabled", "")
venom.optionKey = Menu.AddKeyOption({ "Hero Specific","Venomancer" }, "Attack Hero", Enum.ButtonCode.KEY_F)
venom.optionUnitKey = Menu.AddKeyOption({ "Hero Specific","Venomancer" }, "Attack Unit", Enum.ButtonCode.KEY_F)
venom.font = Renderer.LoadFont("Tahoma", 50, Enum.FontWeight.EXTRABOLD)
venom.tick = 0
venom.target = nil
function venom.OnUpdate()
if not Menu.IsEnabled(venom.optionEnable) then return end
local myHero = Heroes.GetLocal()
if not myHero or NPC.GetUnitName(myHero) ~= "npc_dota_hero_venomancer" then return end
if Menu.IsKeyDown(venom.optionKey) then
venom.attackHero()
return
end
if Menu.IsKeyDown(venom.optionUnitKey) then
venom.attackUnit()
return
end
end
function venom.attackHero()
if venom.tick > GameRules.GetGameTime() then return end
local myHero = Heroes.GetLocal()
local target = Input.GetNearestHeroToCursor(Entity.GetTeamNum(myHero), Enum.TeamType.TEAM_ENEMY)
venom.target = target
venom.tick = GameRules.GetGameTime() +0.2
for i= 1, NPCs.Count() do
local entity = NPCs.Get(i)
if entity then
local name = NPC.GetUnitName(entity)
if name and target and string.match(name, "npc_dota_venomancer_plague") then
Player.AttackTarget(Players.GetLocal(), entity, target)
end
end
end
end
function venom.attackUnit()
if venom.tick > GameRules.GetGameTime() then return end
local myHero = Heroes.GetLocal()
local target = Input.GetNearestUnitToCursor(Entity.GetTeamNum(myHero), Enum.TeamType.TEAM_BOTH)
venom.target = target
venom.tick = GameRules.GetGameTime() +0.2
for i= 1, NPCs.Count() do
local entity = NPCs.Get(i)
if entity and Entity.IsAlive(entity) then
local name = NPC.GetUnitName(entity)
if name and target and string.match(name, "npc_dota_venomancer_plague") then
Player.AttackTarget(Players.GetLocal(), entity, target)
end
end
end
end
function venom.OnDraw()
if not Menu.IsEnabled(venom.optionEnable) then return end
if not venom.target then return end
if Menu.IsKeyDown(venom.optionUnitKey) or Menu.IsKeyDown(venom.optionKey) then
local x, y, vis = Renderer.WorldToScreen(Entity.GetAbsOrigin(venom.target))
Renderer.DrawTextCentered(venom.font, x, y, "X", 1)
end
end
return venom