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