Jump to content

Welcome to Gaming On Steroids Forums
Register now to gain access to all of our features. Once registered and logged in, you will be able to create topics, post replies to existing threads, give reputation to your fellow members, get your own private messenger, post status updates, manage your profile and so much more. This message will be removed once you have signed in.
Login to Account Create an Account
Photo

Want to start learning


Best Answer Pazamolam , 29 August 2015 - 07:45

Finally i got the kayle script done. I will love to hear how i can improve it:

local info = "Kayle v1.0.0 By Vegita"
textTable = {info}
PrintChat(textTable[1])

Config = scriptConfig("Kayle", "Kayle:")
Config.addParam("Q", "Use Q", SCRIPT_PARAM_ONOFF, true)
Config.addParam("W", "Use W", SCRIPT_PARAM_ONOFF, true)
Config.addParam("E", "Use E", SCRIPT_PARAM_ONOFF, true)
Config.addParam("R", "Use R", SCRIPT_PARAM_ONOFF, true)
DrawingsConfig = scriptConfig("Drawings", "Drawings:")
DrawingsConfig.addParam("DrawQ", "Draw Q", SCRIPT_PARAM_ONOFF, true)
DrawingsConfig.addParam("DrawW", "Draw W", SCRIPT_PARAM_ONOFF, true)
DrawingsConfig.addParam("DrawE", "Draw E", SCRIPT_PARAM_ONOFF, true)
DrawingsConfig.addParam("DrawR", "Draw R", SCRIPT_PARAM_ONOFF, true)

OnLoop(function(myHero)
Drawings()

        local target = GetCurrentTarget()
        if KeyIsDown (string.byte(" ")) and ValidTarget(target) then
				
					if IsInDistance(target, GetCastRange(myHero,_Q)) and CanUseSpell(myHero, _Q) == READY and Config.Q then     
							CastTargetSpell(target, _Q)
					end	
					
					if IsInDistance(target, 525) and CanUseSpell(myHero, _E) == READY and Config.E then 
							CastTargetSpell(myHero, _E) 
					end
		
					for _, ally in pairs(GetAllyHeroes()) do
						if Config.W then
							if (GetCurrentHP(ally)/GetMaxHP(ally))<0.5 and
								CanUseSpell(myHero, _W) == READY and IsInDistance(ally, 600) then
								CastTargetSpell(ally, _W)		
							end
						end
					end
							if Config.W then
								if (GetCurrentHP(myHero)/GetMaxHP(myHero))<0.6 and
									CanUseSpell(myHero, _W) == READY then
									CastTargetSpell(myHero, _W)
								end
							end			
										if Config.R then
											if (GetCurrentHP(myHero)/GetMaxHP(myHero))<0.3 and
												CanUseSpell(myHero, _R) == READY then
												CastTargetSpell(myHero, _R)
											end
										end
									
										for _, ally in pairs(GetAllyHeroes()) do
											if Config.R then
												if (GetCurrentHP(ally)/GetMaxHP(ally))<0.3 and
													CanUseSpell(myHero, _R) == READY and IsInDistance(ally, 900) then
													CastTargetSpell(ally, _R)			
												end
											end
										end						
			end								
end)				

function Drawings()

	local myHero = GetMyHero()
	local target = GetCurrentTarget()
	local myHeroPos = GetOrigin(myHero)
	if "Kayle" == GetObjectName(myHero) then
			
	myHeroPos = GetOrigin(myHero)
		if DrawingsConfig.DrawQ then
			DrawCircle(myHeroPos.x,myHeroPos.y,myHeroPos.z,GetCastRange(myHero,_Q),3,100,0xff00ff00)
		end
		
		if DrawingsConfig.DrawW then	
			DrawCircle(myHeroPos.x,myHeroPos.y,myHeroPos.z,GetCastRange(myHero,_W),3,100,0xff00ff00)
		end
			
		if DrawingsConfig.DrawE then	
			DrawCircle(myHeroPos.x,myHeroPos.y,myHeroPos.z,GetCastRange(myHero,525),3,100,0xff00ff000)
		end
		
		if DrawingsConfig.DrawR then	
					DrawCircle(myHeroPos.x,myHeroPos.y,myHeroPos.z,GetCastRange(myHero,_R),3,100,0xff00ff00)
		end		
	end		
end
Go to the full post »


  • This topic is locked This topic is locked
45 replies to this topic

#41
Pazamolam

Pazamolam

    Advanced Member

  • Members
  • 35 posts

as I said, plz learn walk first.

 

if you really understand that 16 lines code, you won't make the mistake like now.

 

 

and don't copy any code you don't understand.

As I told you before, I'm just trying to make a script first and improve from there. So far I have learned a lot just from this Kayle script, and then I will go over all the basic stuff again when I understand more of all the coding stuff.


  • 0

#42
ilovesona

ilovesona

    Sona's wife

  • Contributor
  • 1,096 posts

As I told you before, I'm just trying to make a script first and improve from there. So far I have learned a lot just from this Kayle script, and then I will go over all the basic stuff again when I understand more of all the coding stuff.

no, you didn't....

 

do you know the answer is in that 16 lines code?

 

plz go back and read it line by line, and find out what every function is doing.


  • 0

#43
Pazamolam

Pazamolam

    Advanced Member

  • Members
  • 35 posts

no, you didn't....

 

do you know the answer is in that 16 lines code?

 

plz go back and read it line by line, and find out what every function is doing.

Okay fine. I went over your script trying and learning it. I think i understood most of it. There is one thing i didn't tho. 

if IsInDistance(target, GetCastRange(myHero,_Q)) and CanUseSpell(myHero, _Q) == READY then     
                        CastTargetSpell(target, _Q)

why after GetCastRange(myHero,Q))  you use 2 columns and not only one?

                                            2 columns  ^


  • 0

#44
Zypppy

Zypppy

    Ex Global Support

  • Contributor
  • 1,817 posts

Because there are 2 ( 
Its 1 column and not  2

1 is is from (myHero,_Q)) 


  • 0

#45
ilovesona

ilovesona

    Sona's wife

  • Contributor
  • 1,096 posts

Okay fine. I went over your script trying and learning it. I think i understood most of it. There is one thing i didn't tho. 

if IsInDistance(target, GetCastRange(myHero,_Q)) and CanUseSpell(myHero, _Q) == READY then     
                        CastTargetSpell(target, _Q)

why after GetCastRange(myHero,Q))  you use 2 columns and not only one?

                                            2 columns  ^

range = GetCastRange(myHero,_Q)
IsInDistance(target, range)

same behavior, if you prefer this one Kappa


  • 0

#46
Pazamolam

Pazamolam

    Advanced Member

  • Members
  • 35 posts
✓  Best Answer

Finally i got the kayle script done. I will love to hear how i can improve it:

local info = "Kayle v1.0.0 By Vegita"
textTable = {info}
PrintChat(textTable[1])

Config = scriptConfig("Kayle", "Kayle:")
Config.addParam("Q", "Use Q", SCRIPT_PARAM_ONOFF, true)
Config.addParam("W", "Use W", SCRIPT_PARAM_ONOFF, true)
Config.addParam("E", "Use E", SCRIPT_PARAM_ONOFF, true)
Config.addParam("R", "Use R", SCRIPT_PARAM_ONOFF, true)
DrawingsConfig = scriptConfig("Drawings", "Drawings:")
DrawingsConfig.addParam("DrawQ", "Draw Q", SCRIPT_PARAM_ONOFF, true)
DrawingsConfig.addParam("DrawW", "Draw W", SCRIPT_PARAM_ONOFF, true)
DrawingsConfig.addParam("DrawE", "Draw E", SCRIPT_PARAM_ONOFF, true)
DrawingsConfig.addParam("DrawR", "Draw R", SCRIPT_PARAM_ONOFF, true)

OnLoop(function(myHero)
Drawings()

        local target = GetCurrentTarget()
        if KeyIsDown (string.byte(" ")) and ValidTarget(target) then
				
					if IsInDistance(target, GetCastRange(myHero,_Q)) and CanUseSpell(myHero, _Q) == READY and Config.Q then     
							CastTargetSpell(target, _Q)
					end	
					
					if IsInDistance(target, 525) and CanUseSpell(myHero, _E) == READY and Config.E then 
							CastTargetSpell(myHero, _E) 
					end
		
					for _, ally in pairs(GetAllyHeroes()) do
						if Config.W then
							if (GetCurrentHP(ally)/GetMaxHP(ally))<0.5 and
								CanUseSpell(myHero, _W) == READY and IsInDistance(ally, 600) then
								CastTargetSpell(ally, _W)		
							end
						end
					end
							if Config.W then
								if (GetCurrentHP(myHero)/GetMaxHP(myHero))<0.6 and
									CanUseSpell(myHero, _W) == READY then
									CastTargetSpell(myHero, _W)
								end
							end			
										if Config.R then
											if (GetCurrentHP(myHero)/GetMaxHP(myHero))<0.3 and
												CanUseSpell(myHero, _R) == READY then
												CastTargetSpell(myHero, _R)
											end
										end
									
										for _, ally in pairs(GetAllyHeroes()) do
											if Config.R then
												if (GetCurrentHP(ally)/GetMaxHP(ally))<0.3 and
													CanUseSpell(myHero, _R) == READY and IsInDistance(ally, 900) then
													CastTargetSpell(ally, _R)			
												end
											end
										end						
			end								
end)				

function Drawings()

	local myHero = GetMyHero()
	local target = GetCurrentTarget()
	local myHeroPos = GetOrigin(myHero)
	if "Kayle" == GetObjectName(myHero) then
			
	myHeroPos = GetOrigin(myHero)
		if DrawingsConfig.DrawQ then
			DrawCircle(myHeroPos.x,myHeroPos.y,myHeroPos.z,GetCastRange(myHero,_Q),3,100,0xff00ff00)
		end
		
		if DrawingsConfig.DrawW then	
			DrawCircle(myHeroPos.x,myHeroPos.y,myHeroPos.z,GetCastRange(myHero,_W),3,100,0xff00ff00)
		end
			
		if DrawingsConfig.DrawE then	
			DrawCircle(myHeroPos.x,myHeroPos.y,myHeroPos.z,GetCastRange(myHero,525),3,100,0xff00ff000)
		end
		
		if DrawingsConfig.DrawR then	
					DrawCircle(myHeroPos.x,myHeroPos.y,myHeroPos.z,GetCastRange(myHero,_R),3,100,0xff00ff00)
		end		
	end		
end

  • 0




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users