View difference between Paste ID: xXrS46KL and LfRb5QaL
SHOW: | | - or go back to the newest paste.
1
--[[
2
 
3
        Auto Carry Plugin - Ashe 
4
 
5
        Activates Q when attacking enemy hero and disables when attacking minions.
6
        Activates Muramana when attacking enemy hero.
7
 
8
--]]
9
 
10
11
12
local frostOn = false
13
AutoCarry.PluginMenu:addParam("AutoQ", "Activate Q Against Enemy", SCRIPT_PARAM_ONOFF, true)
14
AutoCarry.PluginMenu:addParam("MMana", "Activate Muramana Against Enemy", SCRIPT_PARAM_ONOFF, true) 
15-
AutoCarry.PluginMenu:addParam("ManaCheck", "Do not activate Q if under value", SCRIPT_PARAM_SLICE, 30, 0, 100, 0)     
15+
AutoCarry.PluginMenu:addParam("ManaCheck", "Maximum % for Q activation", SCRIPT_PARAM_SLICE, 30, 0, 100, 0)     
16
17
18
function CustomAttackEnemy(enemy)
19
        if enemy.dead or not enemy.valid or not AutoCarry.CanAttack then return end
20
21
if myHero.mana - GetMana() > (myHero.maxMana / 100) * AutoCarry.PluginMenu.MinMana then
22
23
        if AutoCarry.PluginMenu.AutoQ then
24-
                if ValidTarget(enemy) and enemy.type == "obj_AI_Hero" and not frostOn and (myHero.mana - GetMana() > (myHero.maxMana / 100) * AutoCarry.PluginMenu.ManaCheck) then
24+
                if ValidTarget(enemy) and enemy.type == "obj_AI_Hero" and not frostOn and (myHero.mana > (myHero.maxMana / 100) * AutoCarry.PluginMenu.ManaCheck) then
25
                        CastSpell(_Q)
26
                elseif ValidTarget(enemy) and enemy.type ~= "obj_AI_Hero" and frostOn then
27
                        CastSpell(_Q)
28
                end
29
        end
30
31
        if AutoCarry.PluginMenu.MMana then
32
                if ValidTarget(enemy) and enemy.type == "obj_AI_Hero" and ((AutoCarry.PluginMenu.ManaCheck and myHero.mana > 100) or not AutoCarry.PluginMenu.ManaCheck) and not MuramanaIsActive() then
33
                        MuramanaOn()
34
                elseif ValidTarget(enemy) and enemy.type ~= "obj_AI_Hero" and MuramanaIsActive() then
35
                        MuramanaOff()
36
                end
37
        end
38
39
        myHero:Attack(enemy)
40
        AutoCarry.shotFired = true
41
end
42
43
 
44
function PluginOnCreateObj(obj)
45
        if GetDistance(obj) < 100 and obj.name:lower():find("icesparkle") then
46
                frostOn = true
47
        end
48
end
49
 
50
function PluginOnDeleteObj(obj)
51
        if GetDistance(obj) < 100 and obj.name:lower():find("icesparkle") then
52
                frostOn = false
53
        end
54
end