Zed automated combo (League Of Legends)

Post gaming related scripts
User avatar
17kimv
Posts: 37
Joined: 21 Dec 2015, 20:15

Zed automated combo (League Of Legends)

30 Mar 2016, 05:52

Hello, before I start I want to say that my English is not that good so please point out all grammatical mistakes I make, thank you.

Alright! So this is my script for a champion Zed in game "league of legends", all it does is that it finds enemy's health bar and then moves down and to the right, then it sends out the shadow (w ability), then it does the slash (e ability), and then finds the enemy position again, then throws the shurikens (q ability). It will only do so if it finds the enemy. It is bind to forward button on the mouse. Also it needs to have 1920x1080 resolution, so all people with square monitors, I am sorry but I am not sure if it will work (to be honest if you are here you can probably change it).

Code: Select all

XButton2::
ImageSearch, X, Y, 0, 0, 1920, 1080, health.png

if ErrorLevel = 0
{
xa := x+42
ya := y+100
mousemove, %xa%, %ya%, 0
send, {w down}
sleep 100
send, {w up}
send, {e down}
sleep 50
send, {e up}
sleep, 30
ImageSearch, X, Y, 0, 0, 1920, 1080, health.png
xa := x+42
ya := y+100
mousemove, %xa%, %ya%, 0
send, {q down}
sleep 10
send, {q up}
}
link to the health image(just place in the same folder as the code) :
https://www.dropbox.com/s/j0041hgkf8syu ... h.png?dl=0
Look MA! I am a programmer! :superhappy:
_3D_
Posts: 189
Joined: 29 Jan 2014, 14:40

Re: Zed automated combo (League Of Legends)

01 May 2016, 08:11

Hi 17kimv
Your post became starting point for learning script language with my students. (There no faster way to take focus of yang brain like game.)
I never play League of Legend - so my comments possibly will be curios.
Comment 1:

Code: Select all

ImageSearch, x, y, 0, 0, 1920, 1080, health.png
;1920, 1080 throw script to be used in only this resolution
ImageSearch, x, y, 0, 0, A_ScreenWidth, A_ScreenHeight, health.png
;Any resolution is possible
Comment 2: In second ImageSearch

Code: Select all

ImageSearch, X, Y, 0, 0, 1920, 1080, health.png
;Here no IF ErrorLevel check that make ImageSearch nonsense
;The code below will be executed no matter of ImageSearch result and if FAIL x and y became ""
;I think that code must depends from ErrorLevel
xa := x+42
ya := y+100
mousemove, %xa%, %ya%, 0
Comment 3: It is known like DRY (Don`t Repeat Yourself) principle.

Code: Select all

send, {w down}
sleep 100
send, {w up}
;Here 3 times used this construction
It is better to be made function that will repeat the same code with low mistakes.

Code: Select all

slowSend(key, wait) {
	send {%key% down}
	sleep %wait%
	send {%key% up}
}
The result in my opinion:

Code: Select all

#SingleInstance force
;autor   : 17kimv 
;original: https://autohotkey.com/boards/viewtopic.php?f=19&t=15425

XButton2::
	ImageSearch, x, y, 0, 0, %A_ScreenWidth%, %A_ScreenHeight%, health.png
	if !ErrorLevel { ;if not ErrorLevel
		mousemove, %x%+42, %y%+100, 0 ;xa and xb omited
		slowSend("w", 100) ;avoid writing the same code
		slowSend("e",  50)
		sleep 30
		ImageSearch, x, y, 0, 0, %A_ScreenWidth%, %A_ScreenHeight%, health.png
		if !ErrorLevel { ;if not ErrorLevel
			mousemove, %x%+42, %y%+100, 0
			slowSend("q",  10)
	}	}
return
#!Q::ExitApp

slowSend(key, wait) {
	send {%key% down}
	sleep %wait%
	send {%key% up}
}
Please test the code and comment it.
Thanks in advance.
Edit:
In connection of https://autohotkey.com/board/topic/9324 ... ntry587806

Code: Select all

#SingleInstance force
;autor   : 17kimv 
;original: https://autohotkey.com/boards/viewtopic.php?f=19&t=15425
SendMode Event      ;AHKv2.0 needed for SetKeyDelay
SetKeyDelay, 30, 80 ;{down} sleep 80 {up} sleep 30

#Z::  ;for easy test
	ImageSearch, x, y, 0, 0, %A_ScreenWidth%, %A_ScreenHeight%, health.png
	if !ErrorLevel { ;if not ErrorLevel
		mousemove, %x%+42, %y%+100, 0 ;xa and xb omited
		send we
		ImageSearch, x, y, 0, 0, %A_ScreenWidth%, %A_ScreenHeight%, health.png
		if !ErrorLevel { ;if not ErrorLevel
			mousemove, %x%+42, %y%+100, 0
			send q
	}	}
return
#!Q::ExitApp
AHKv2.0 use the future now.
akumetsu
Posts: 5
Joined: 25 May 2016, 13:13
GitHub: devakumetsu

Re: Zed automated combo (League Of Legends)

23 Feb 2017, 13:52

@_3d_ really a good script, but failed in the execution to the target.
NPDropshot
Posts: 6
Joined: 10 Apr 2017, 13:17

Re: Zed automated combo (League Of Legends)

10 Apr 2017, 16:11

So question , would like to try this out , but i dont know what "forward" button on the mouse is. it shows if i'm not mistaken x button 2 , but idk what that is. tried to change it to t but no luck.
wombatt

Re: Zed automated combo (League Of Legends)

20 Oct 2017, 15:33

I tried the 3d script but it doesnt seem to work do I have to use autohotkey v2?
_3D_
Posts: 189
Joined: 29 Jan 2014, 14:40

Re: Zed automated combo (League Of Legends)

21 Oct 2017, 01:19

AutoHotkey_2.0-a081-cad307c syntax:

Code: Select all

#SingleInstance force
;autor   : 17kimv 
;original: https://autohotkey.com/boards/viewtopic.php?f=19&t=15425
;AHKv2.0
SendMode("Event")   ;AHKv2.0 needed for SetKeyDelay
SetKeyDelay(30, 80) ;{down} sleep 80 {up} sleep 30

#Z::  ;for easy test
	ImageSearch(x, y, 0, 0, A_ScreenWidth, A_ScreenHeight, "health.png")
	if !ErrorLevel { ;if not ErrorLevel
		mousemove(x+42, y+100, 0) ;xa and xb omited
		send("we")
		ImageSearch(x, y, 0, 0, A_ScreenWidth, A_ScreenHeight, "health.png")
		if !ErrorLevel { ;if not ErrorLevel
			mousemove(x+42, y+100, 0)
			send("q")
	}	}
return
#!Q::ExitApp
I never tested this script in "LOL".
AHKv2.0 use the future now.

Return to “Gaming”

Who is online

Users browsing this forum: No registered users and 7 guests