--[[
Script: Pick a Card v1.2
Author: Modified by Keoshin/Taikumi
Credits: This script was largely based on Sumizome's Pick a Card v1.3 mod5, updated by Zynox,
Weee & h0nda, and was modified to use BoL's scripting API.
Thanks to ikita for updating the script to use an alternative method to always pick the first card.
]]--
if GetMyHero().charName == "TwistedFate" then
-- Config:
local HotkeyRed = 90 --Z
local HotkeyYellow = 88 --X
local HotkeyBlue = 67 --C
-- Globals:
local cards = {}
cards[HotkeyYellow] = "Card_Yellow"
cards[HotkeyBlue] = "Card_Blue"
cards[HotkeyRed] = "Card_Red"
local selected = HotkeyYellow
local lastUse = 0
local spellUsed = nil
local player = GetMyHero()
local function msgHandler(msg, key)
if
msg ~= KEY_UP or
player:CanUseSpell(_W) ~= READY or
GetTickCount() - lastUse <= 2500 or
player.dead or
cards[key] == nil or
spellUsed ~= nil
then
return
end
lastUse = GetTickCount()
selected = key
spellUsed = true
CastSpell(_W)
end
local function tickHandler() -- modified to be able to pick the first card
if not spellUsed or player:CanUseSpell(_W) ~= READY then return end
for k = 1, objManager.maxObjects do
local object = objManager:GetObject(k)
if object ~= nil and player:GetDistance(object) < 80 and object.name:find(cards[selected]) then
CastSpell(_W) -- If we detect the card, cast W again to capture it
spellUsed = nil
break
end
end
end
BoL:addTickHandler(tickHandler, 50)
BoL:addMsgHandler(msgHandler)
end