Advertisement
Kevinkev

Fiora.lua

Jan 6th, 2013
2,425
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 3.11 KB | None | 0 0
  1. --[[
  2.  
  3. Fiora
  4. by Kevinkev
  5.  
  6.  
  7. No puns ;(
  8.  
  9.  
  10. ]]--
  11.  
  12.  
  13. if myHero.charName == "Fiora" then
  14.  
  15. function OnLoad()
  16.     comboHK     = 32 --Spacebar
  17.     runTsTarget = string.byte("X")
  18.     WalkToCursor = string.byte("C")
  19.     --Do not touch
  20.     swingDelay  = 0.8
  21.     Qrange      = 600
  22.     Rrange      = 400
  23.     ScanRange   = 700
  24.     bAttack = false
  25.     lastBasicAttack = 0    
  26.    
  27.     ts = TargetSelector(TARGET_LOW_HP,700,DAMAGE_PHYSICAL,false)
  28.    
  29.     --Menu
  30.     FConfig = scriptConfig("Fiora Combo", "FioraCombo")
  31.     FConfig:addParam("combo", "Combo", SCRIPT_PARAM_ONKEYDOWN, false, comboHK)
  32.     FConfig:addParam("r2t", "Run to target during combo", SCRIPT_PARAM_ONKEYTOGGLE, false, runTsTarget)
  33.     FConfig:addParam("w2c", "Walk to cursor", SCRIPT_PARAM_ONKEYTOGGLE, false, WalkToCursor)
  34.     FConfig:addParam("useult", "Use Ultimate", SCRIPT_PARAM_ONOFF, true)
  35.     FConfig:permaShow("combo")
  36.     FConfig:permaShow("r2t")
  37.     FConfig:permaShow("w2c")
  38.     ts.name = "Fiora"
  39.     FConfig:addTS(ts)
  40.     PrintChat(">> Fiora Loaded!")
  41.  
  42. end
  43. function OnProcessSpell(unit, spell)
  44.     if unit.isMe and (spell.name:find("BasicAttack" or "CritAttack") ~= nil) then
  45.        
  46.         swing = 1
  47.         bAttack = true
  48.         lastBasicAttack = os.clock()
  49.  
  50.     end
  51.    
  52.    
  53.    
  54.    
  55. end
  56.  
  57. function moveToCursor()
  58.     local moveX = mousePos.x
  59.     local moveZ = mousePos.z
  60.  
  61.     myHero:MoveTo(moveX, moveZ)
  62.  
  63. end
  64.  
  65. function OnTick()
  66.     ts:update()
  67.    
  68.     QReady = (myHero:CanUseSpell(_Q) == READY)
  69.     WReady = (myHero:CanUseSpell(_W) == READY)
  70.     EReady = (myHero:CanUseSpell(_E) == READY)
  71.     RReady = (myHero:CanUseSpell(_R) == READY)
  72.    
  73.     if os.clock() > lastBasicAttack + 0.5 then
  74.         swing = 0
  75.         bAttack = false
  76.     end
  77.    
  78.     if FConfig.combo and FConfig.w2c then
  79.         moveToCursor()
  80.     end
  81.    
  82.     if ts.target ~= nil and FConfig.combo then
  83.         --Walks to target when script active
  84.         if FConfig.r2t then
  85.         myHero:Attack(ts.target)
  86.         end
  87.         --Q at target, auto attack then Q again.
  88.         if QReady then
  89.  
  90.             CastSpell(_Q,ts.target)
  91.            
  92.             myHero:Attack(ts.target)
  93.             CastSpell(_E,ts.target)
  94.             if QReady and os.clock() - lastBasicAttack > swingDelay and bAttack then
  95.             CastSpell(_Q,ts.target)
  96.             end
  97.            
  98.  
  99.  
  100.         end
  101.         --Calculates enemies near target
  102.         if moreThanOne() then
  103.             RDamage =  getDmg("R",ts.target,myHero,1)
  104.         else
  105.             RDamage =  getDmg("R",ts.target,myHero,3)
  106.         end
  107.            
  108.         if RReady and FConfig.useult and RDamage >= ts.target.health then
  109.             CastSpell(_R,ts.target)
  110.         end
  111.    
  112.     end
  113. end
  114. function moreThanOne()
  115.     local boolean = false
  116.     for j = 1, heroManager.iCount, 1 do
  117.         local enemyhero = heroManager:getHero(j)
  118.             if myHero.team ~= enemyhero.team and ValidTarget(enemyhero) then
  119.                 if ValidTargetNear(enemyhero,400,ts.target) then
  120.                 boolean = true
  121.                 else
  122.                 boolean = (false or boolean)
  123.                 end
  124.             end
  125.     end    
  126.     return boolean
  127. end
  128.  
  129. function OnDraw()
  130.     SC__OnDraw()
  131.    
  132.     DrawCircle(myHero.x, myHero.y, myHero.z, ScanRange, 0xFF0000)
  133.    
  134. end
  135.    
  136. function OnWndMsg(msg,key)
  137.     SC__OnWndMsg(msg,key)
  138. end
  139.    
  140. function OnSendChat(msg)
  141.     TargetSelector__OnSendChat(msg)
  142.     ts:OnSendChat(msg, "pri")
  143. end
  144.  
  145.  
  146. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement