SHOW:
|
|
- or go back to the newest paste.
1 | --[[ | |
2 | ||
3 | AutoMorgana by x7x | |
4 | - | My first script with TS :) |
4 | + | My first script with TS :) Combo: (Q - DFG - (if Q hits and target cant move)W - E - R) |
5 | --Make sure you only use combos when you know it will hit target. Q might hit minion and then combo doesn't work(NO MINION PREDICTION). | |
6 | --In the Harass combo, it should cast everything, but Ult(R). (Q-W-E) | |
7 | --Harass, Ult toggle and Draw Range added by xkjtx (Also he made this script work again with prediction!!!) | |
8 | --Shield, when mouse is hovering over player press hot-key to shield added by xkjtx (3-14-2013) | |
9 | ||
10 | - | if myHero.charName == "Morgana" then |
10 | + | |
11 | ||
12 | - | --require "AllClass" -- not needed |
12 | + | if myHero.charName ~= "Morgana" then return end |
13 | - | --require "spellDmg" -- not needed |
13 | + | |
14 | --require "AllClass" | |
15 | --require "spellDmg" | |
16 | local AArange = 450 | |
17 | local QRange = 1200 | |
18 | local QWidth = 200 | |
19 | local DFGrange = 750 | |
20 | local Wrange = 900 | |
21 | - | local ts = TargetSelector(TARGET_LOW_HP,QRange,DAMAGE_MAGIC,true) -- set to true to select target as option(true is Better for focusing and killing jungle) |
21 | + | |
22 | local Rrange = 600 | |
23 | local ts = TargetSelector(TARGET_LOW_HP,QRange,DAMAGE_MAGIC,true) -- set to true to select target as option(true is Better for focusing) | |
24 | --local tq = TargetPrediction(QRange, 1.2, 0, 300, 50) -- not needed any more | |
25 | local DFGSlot = nil | |
26 | local DFGReady, QREADY, WReady, EReady, RReady = false, false, false, false, false | |
27 | ||
28 | -- more locals | |
29 | local AttackDelay = 0 | |
30 | local travelDuration = nil | |
31 | local predic = nil | |
32 | local startAttackSpeed = 0.579 | |
33 | local lastBasicAttack = 0 | |
34 | local swing = 0 | |
35 | local delay = 200 | |
36 | local speed = 1.195 | |
37 | ||
38 | local MorgCombo = 32 -- Space | |
39 | local MorgHarass = 83 -- letter 'S' | |
40 | local MorgUlt = 88 -- leter 'X' (Can toggle on/off) | |
41 | local MorgShield = string.byte("E") -- letter 'E' (Hold mouse over player and press hotkey) | |
42 | ||
43 | function OnLoad() | |
44 | MorgConfig = scriptConfig("Morgana Combo", "MorganaCombo") | |
45 | MorgConfig:addParam("active", "Combo", SCRIPT_PARAM_ONKEYDOWN, false, MorgCombo) -- Space bar | |
46 | MorgConfig:addParam("harass", "Harass", SCRIPT_PARAM_ONKEYDOWN, false, MorgHarass) -- S | |
47 | MorgConfig:addParam("shield", "Shield Ally/Self", SCRIPT_PARAM_ONKEYDOWN, false, MorgShield) -- E | |
48 | MorgConfig:addParam("drawcircles", "Draw Circles", SCRIPT_PARAM_ONOFF, true) | |
49 | MorgConfig:addParam("useult", "Use Ultimate in Combo", SCRIPT_PARAM_ONKEYTOGGLE, false, MorgUlt) -- X -- Off by default | |
50 | MorgConfig:permaShow("active") | |
51 | MorgConfig:permaShow("harass") | |
52 | MorgConfig:permaShow("shield") | |
53 | MorgConfig:permaShow("useult") | |
54 | ts.name = "Morgana" | |
55 | MorgConfig:addTS(ts) | |
56 | lastBasicAttack = os.clock() | |
57 | --PrintChat(">> AutoMorgana loaded! Press shift to configure.") | |
58 | end | |
59 | - | if ts.target ~= nil and not myHero.dead then |
59 | + | |
60 | function OnTick() | |
61 | ts:update() | |
62 | ||
63 | if myHero.dead then | |
64 | return | |
65 | end | |
66 | ||
67 | if ts.target ~= nil then | |
68 | travelDuration = (delay + GetDistance(myHero, ts.target)/speed) | |
69 | ts:SetPrediction(travelDuration) | |
70 | ||
71 | predic = ts.nextPosition | |
72 | ||
73 | AttackDelay = 1/(myHero.attackSpeed*startAttackSpeed) | |
74 | if swing == 1 and os.clock() > lastBasicAttack + AttackDelay then | |
75 | swing = 0 | |
76 | - | if myHero.dead then return end |
76 | + | |
77 | if MorgConfig.active or MorgConfig.harass then | |
78 | if GetDistance(ts.target)<=AArange+50 and swing == 0 then | |
79 | myHero:Attack(ts.target) | |
80 | end | |
81 | end | |
82 | end | |
83 | ||
84 | DFGSlot = GetInventorySlotItem(3128) | |
85 | DFGReady = (DFGSlot ~= nil and myHero:CanUseSpell(DFGSlot) == READY) | |
86 | QREADY = (myHero:CanUseSpell(_Q) == READY) | |
87 | WReady = (myHero:CanUseSpell(_W) == READY) | |
88 | EReady = (myHero:CanUseSpell(_E) == READY) | |
89 | RReady = (myHero:CanUseSpell(_R) == READY) | |
90 | - | if predic ~= nil then |
90 | + | |
91 | --TargetPrediction__OnTick() -- not needed any more | |
92 | ||
93 | if MorgConfig.active and ts.target ~= nil and QREADY then | |
94 | --qpred = tq:GetPrediction(ts.target) -- not needed any more | |
95 | - | if MorgConfig.active and myHero:CanUseSpell(_Q) == COOLDOWN and ts.target ~= nil and ts.target.canMove == false then |
95 | + | if predic ~= nil and GetDistance(ts.target) < QRange then |
96 | CastSpell(_Q, predic.x, predic.z) | |
97 | end | |
98 | - | if DFGReady then CastSpell(DFGSlot, ts.target) end |
98 | + | |
99 | ||
100 | if MorgConfig.active and myHero:CanUseSpell(_Q) == COOLDOWN and ts.target ~= nil then | |
101 | - | if GetDistance(ts.target) < Wrange then |
101 | + | |
102 | - | if WReady then CastSpell(_W, ts.target.x, ts.target.z) end |
102 | + | if DFGReady then |
103 | CastSpell(DFGSlot, ts.target) | |
104 | end | |
105 | - | if GetDistance(ts.target) < Rrange and MorgConfig.useult then |
105 | + | |
106 | - | if RReady then CastSpell(_R) end |
106 | + | |
107 | if GetDistance(ts.target) < Wrange and ts.target.canMove == false then | |
108 | - | if EReady then CastSpell(_E) end |
108 | + | if WReady then |
109 | CastSpell(_W, ts.target.x, ts.target.z) | |
110 | end | |
111 | end | |
112 | myHero:Attack(ts.target) | |
113 | if GetDistance(ts.target) < AArange then | |
114 | - | if EReady then CastSpell(_E) end |
114 | + | if EReady then |
115 | CastSpell(_E) | |
116 | - | if WReady then CastSpell(_W, predic.x, predic.z) end |
116 | + | |
117 | end | |
118 | myHero:Attack(ts.target) | |
119 | if MorgConfig.useult and GetDistance(ts.target) < Rrange then | |
120 | - | if not player.dead and MorgConfig.shield then |
120 | + | if RReady then |
121 | - | -- added by xkjtx: given to by TRUS: this will cast W on self/ally while holding mouse over |
121 | + | CastSpell(_R) |
122 | end | |
123 | end | |
124 | - | if hero.team == myHero.team and GetDistanceFromMouse(hero)<175 ---here is your value |
124 | + | |
125 | - | then |
125 | + | |
126 | if MorgConfig.harass and ts.target ~= nil then | |
127 | myHero:Attack(ts.target) | |
128 | if predic ~= nil and GetDistance(ts.target) < QRange then | |
129 | CastSpell(_Q, predic.x, predic.z) | |
130 | end | |
131 | if EReady then | |
132 | CastSpell(_E) | |
133 | end | |
134 | if predic ~= nil and GetDistance(predic) < Wrange then | |
135 | if WReady then | |
136 | CastSpell(_W, predic.x, predic.z) | |
137 | end | |
138 | end | |
139 | end | |
140 | ||
141 | if not myHero.dead and MorgConfig.shield then | |
142 | -- added by xkjtx: given to by TRUS: this will cast E on self/ally while holding mouse over | |
143 | for i = 1, heroManager.iCount, 1 do | |
144 | local hero = heroManager:getHero(i) | |
145 | if hero.team == myHero.team and GetDistanceFromMouse(hero)<175 then -- how far mouse need to be from player/ally | |
146 | CastSpell(_E,hero) | |
147 | end | |
148 | end | |
149 | end | |
150 | end | |
151 | ||
152 | function OnDraw() | |
153 | --SC__OnDraw() -- not needed any more | |
154 | if not myHero.dead and MorgConfig.drawcircles then | |
155 | DrawCircle(myHero.x, myHero.y, myHero.z, AArange, 0xFF0000) -- Redish(Attack Range) always on | |
156 | if myHero:CanUseSpell(_Q) == READY then | |
157 | DrawCircle(myHero.x, myHero.y, myHero.z, QRange, 0x000099) -- Blueish(Q Range) only on when off CD | |
158 | end | |
159 | if myHero:CanUseSpell(_W) == READY then | |
160 | DrawCircle(myHero.x, myHero.y, myHero.z, Wrange, 0x009933) -- Greenish(W Range) only on when off CD | |
161 | end | |
162 | if myHero:CanUseSpell(_E) == READY then | |
163 | DrawCircle(myHero.x, myHero.y, myHero.z, Erange, 0xFF9933) -- Orangeish(E range) only on when off CD | |
164 | end | |
165 | if DFGReady then | |
166 | DrawCircle(myHero.x, myHero.y, myHero.z, DFGrange, 0xFFCC00) -- Yellowish(real DFG range) only on when off CD | |
167 | end | |
168 | if ts ~= nil and ts.target ~= nil then | |
169 | for j=0, 10 do | |
170 | DrawCircle(ts.target.x, ts.target.y, ts.target.z, (GetDistance(ts.target.minBBox, ts.target.maxBBox)/2) + j*1.5, 0x660066) | |
171 | --DrawCircle(ts.target.x, ts.target.y, ts.target.z, 40 + j*1.5, 0x660066) -- purpleish -- changed from 0x00FF00 | |
172 | end | |
173 | if predic ~= nil then | |
174 | - | end |
174 | + | |
175 | - | end |
175 | + | |
176 | end | |
177 | end | |
178 | end | |
179 | ||
180 | function OnProcessSpell(unit, spell) | |
181 | if unit.isMe and spell and string.find(string.lower(spell.name),"attack") then | |
182 | swing = 1 | |
183 | lastBasicAttack = os.clock() | |
184 | end | |
185 | end | |
186 | ||
187 | function OnWndMsg(msg,key) | |
188 | --SC__OnWndMsg(msg,key) -- not needed any more | |
189 | end | |
190 | ||
191 | function OnSendChat(msg) | |
192 | --TargetSelector__OnSendChat(msg) -- not needed any more | |
193 | ts:OnSendChat(msg, "pri") | |
194 | end |