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

Script for Developers 0.1 [get easy SpellNames, BuffNames, UnknownObjects, OnProcessSpell datas & much more]


  • Please log in to reply
21 replies to this topic

#1
Feretorix

Feretorix

    Administrator

  • Administrators
  • 3,159 posts
Today i spent some of my time to actually code a LUA script, but this script is not for the average player. This script is aimed for LUA Developers, or at least people who want to code scripts for GoS. But enough for the talk, let's list the features of that script:
 
 
 
 
Detect unknown Objects in 200 range of your mouse position:
 
detect_objects.gif








Same thing applies with a little tweaking for skillshots, though the information could be incomplete:

detect_objects_skillshots.png






You can collect all your (and your enemies btw) active buffs and spellnames:

testbuff.gif






And not last (well it is last) detect OnProcessSpell by champions (but it could be changed to your liking):

onprocessspell_detection.gif







And now the script code itself:

 
function GetDistanceX(p1,p2) --thanks Inspired!
    p1 = GetOrigin(p1) or p1
    p2 = GetOrigin(p2) or p2
    return math.sqrt(GetDistanceSqrX(p1,p2))
end

function GetDistanceSqrX(p1,p2) --thanks Inspired!
    p2 = p2 or GetMyHeroPos()
    local dx = p1.x - p2.x
    local dz = (p1.z or p1.y) - (p2.z or p2.y)
    return dx*dx + dz*dz
end



OnObjectLoop(function(Object,myHero)
local Obj_Type = GetObjectType(Object);
if Obj_Type == Obj_AI_Hero then
	if IsVisible(Object) then
		if IsObjectAlive(Object) then  --you can remove this check if you wish...
			local origin = GetOrigin(Object);
			local myscreenpos = WorldToScreen(1,origin.x,origin.y,origin.z);
			if myscreenpos.flag then --after they're visible, alive and in our screen i will get the rest of the data to save some FPS
				DrawText(string.format("ChampName  = %s", GetObjectName(Object)),12,myscreenpos.x,myscreenpos.y,0xffffffff);
				DrawText(string.format("NetworkID     = 0x%X", GetNetworkID(Object)),12,myscreenpos.x,myscreenpos.y+10,0xffffffff);
				DrawText(string.format("Q________   = %s", GetCastName(Object,_Q)),12,myscreenpos.x,myscreenpos.y+20,0xffffffff);
				DrawText(string.format("W________  = %s", GetCastName(Object,_W)),12,myscreenpos.x,myscreenpos.y+30,0xffffffff);
				DrawText(string.format("E________    = %s", GetCastName(Object,_E)),12,myscreenpos.x,myscreenpos.y+40,0xffffffff);
				DrawText(string.format("R________    = %s", GetCastName(Object,_R)),12,myscreenpos.x,myscreenpos.y+50,0xffffffff);
				DrawText(string.format("SUMONER_1  = %s", GetCastName(Object,SUMMONER_1)),12,myscreenpos.x,myscreenpos.y+60,0xffffffff);
				DrawText(string.format("SUMONER_2  = %s", GetCastName(Object,SUMMONER_2)),12,myscreenpos.x,myscreenpos.y+70,0xffffffff);
				
				local yadder = 0;
				
				for i = 0,63 do
					if GetBuffCount(Object,i) > 0 then
						currbufname = GetBuffName(Object,i);
						currbufcount = GetBuffCount(Object,i);
						yadder = yadder + 10;
						DrawText(string.format("Buffstacks: %d for %s", currbufcount,currbufname),12,myscreenpos.x,myscreenpos.y+80+yadder,0xff00ff00);
						end
					end
				end
			end
		end
	--end
	else --it's not a champion, it's a different object type
	local origin = GetOrigin(Object);
	local mousepoz = GetMousePos();
	if (GetDistanceX(origin,mousepoz) < 200) then  --and (GetNetworkID(Object) > 0) then --add this network ID check for checking skillshots maybe?
		local myscreenpos = WorldToScreen(1,origin.x,origin.y,origin.z);
		if myscreenpos.flag then
			--you can port those to printchat if you wish; but since it's happening each game frame, it might not be the best idea.
			DrawCircle(origin.x,origin.y,origin.z,30,0,10000,0xffffffff); --specify some really bad circle quality like "10000" for best FPS
			DrawText(string.format("NetworkID = 0x%X", GetNetworkID(Object)),12,myscreenpos.x,myscreenpos.y,0xffffffff);
			DrawText(string.format("ObjType  = %s", GetObjectType(Object)),12,myscreenpos.x,myscreenpos.y+10,0xffffffff);
			DrawText(string.format("BaseName  = %s", GetObjectBaseName(Object)),12,myscreenpos.x,myscreenpos.y+20,0xffffffff);
			DrawText(string.format("Name  = %s", GetObjectName(Object)),12,myscreenpos.x,myscreenpos.y+30,0xffffffff);
			--add any other info you wish here ... but don't forget myscreenpos.y+XX
			end
		end
	end
end)



OnDraw(function(myHero)  -- in here we get all needed info for our champ
origin = GetOrigin(myHero);
myscreenpos = WorldToScreen(1,origin.x,origin.y,origin.z);
if myscreenpos.flag then
	DrawText(string.format("ChampName  = %s", GetObjectName(myHero)),12,myscreenpos.x,myscreenpos.y,0xffffffff);
	DrawText(string.format("NetworkID     = 0x%X", GetNetworkID(myHero)),12,myscreenpos.x,myscreenpos.y+10,0xffffffff);
	DrawText(string.format("Q________   = %s", GetCastName(myHero,_Q)),12,myscreenpos.x,myscreenpos.y+20,0xffffffff);
	DrawText(string.format("W________  = %s", GetCastName(myHero,_W)),12,myscreenpos.x,myscreenpos.y+30,0xffffffff);
	DrawText(string.format("E________    = %s", GetCastName(myHero,_E)),12,myscreenpos.x,myscreenpos.y+40,0xffffffff);
	DrawText(string.format("R________    = %s", GetCastName(myHero,_R)),12,myscreenpos.x,myscreenpos.y+50,0xffffffff);
	DrawText(string.format("SUMONER_1  = %s", GetCastName(myHero,SUMMONER_1)),12,myscreenpos.x,myscreenpos.y+60,0xffffffff);
	DrawText(string.format("SUMONER_2  = %s", GetCastName(myHero,SUMMONER_2)),12,myscreenpos.x,myscreenpos.y+70,0xffffffff);	
	local yadder = 0;
	for i = 0,63 do
		if GetBuffCount(myHero,i) > 0 then
			currbufname = GetBuffName(myHero,i);
			currbufcount = GetBuffCount(myHero,i);
			yadder = yadder + 10;
			DrawText(string.format("Buffstacks: %d for %s", currbufcount,currbufname),12,myscreenpos.x,myscreenpos.y+80+yadder,0xff00ff00);
			end
		end
	end
end)


OnProcessSpell(function(Object,spellProc)
local Obj_Type = GetObjectType(Object);
if Obj_Type == Obj_AI_Hero then --check only champions?
	PrintChat(string.format("'%s' casts '%s'; Windup: %.3f Animation: %.3f", GetObjectName(Object), spellProc.name, spellProc.windUpTime, spellProc.animationTime))
	end
end)


  • 15

#2
Archer

Archer

    Advanced Member

  • Members
  • 148 posts
  • LocationHungary

Nice! :D


  • 0

#3
Deftsu

Deftsu

    donthackourgames

  • Ex-Core Dev
  • PipPipPip
  • 4,812 posts

Awesome :D


  • 0

#4
Prometheus

Prometheus

    Advanced Member

  • Ex-Staff
  • PipPipPip
  • 211 posts
  • LocationUK

Good job, bud.


  • 0

#5
leaderking355

leaderking355

    Newbie

  • Members
  • 8 posts

w0w nice


  • 0

#6
ilovesona

ilovesona

    Sona's wife

  • Contributor
  • 1,096 posts

thx, save many time for typing :wub: 


  • 0

#7
iglor713

iglor713

    Advanced Member

  • Members
  • 92 posts
Lucian info:

~ spell.animationTime = 1.493 - ((GetAttackSpeed(myHero) - 0.67 / 0.01) * x) x ~ 15 to 22
~ spell.windUpTime = 0.224 - ((GetAttackSpeed(myHero) - 0.67 / 0.01) * y) y ~ 3 to 5
 
lucianpassivebuff

LucianQ: Windup:0.350 Animation: 2.000
LucianW: Windup:0.300 Animation: 2.000
LucianE: Windup:0.150 Animation: 0.600
LucianR: Windup:0.010 Animation: 2.000


LucianPassiveAttack, LucianBasicAttack, LucianBasicAttack2, LucianCritAttack, LucianCritAttack2
attack speed level:
0.67 1lvl:
LucianBasicAttack, ...: Windup:0.224  Animation: 1.493

0.68 2lvl:
LucianBasicAttack, ...: Windup:0.219  Animation: 1.460

0.70 3lvl:
LucianBasicAttack, ...: Windup:0.214  Animation: 1.427

0.72 4lvl:
LucianBasicAttack, ...: Windup:0.209  Animation: 1.394

0.73 5lvl:
LucianBasicAttack, ...: Windup:0.204  Animation: 1.361

0.75 6lvl:
LucianBasicAttack, ...: Windup:0.199  Animation: 1.328

0.77 7lvl:
LucianBasicAttack, ...: Windup:0.194  Animation: 1.296

0.79 8lvl:
LucianBasicAttack, ...: Windup:0.190  Animation: 1.264

0.81 9lvl:
LucianBasicAttack, ...: Windup:0.190  Animation: 1.232

0.83 10lvl:
LucianBasicAttack, ...: Windup:0.180  Animation: 1.201

0.85 11lvl:
LucianBasicAttack, ...: Windup:0.176  Animation: 1.171

0.88 12lvl:
LucianBasicAttack, ...: Windup:0.171  Animation: 1.140

0.90 13lvl:
LucianBasicAttack, ...: Windup:0.167  Animation: 1.111

0.92 14lvl:
LucianBasicAttack, ...: Windup:0.162  Animation: 1.082

0.95 15lvl:
LucianBasicAttack, ...: Windup:0.158  Animation: 1.054

0.97 16lvl:
LucianBasicAttack, ...: Windup:0.154  Animation: 1.026

1.00 17lvl:
LucianBasicAttack, ...: Windup:0.150  Animation: 1.000

1.03 18lvl:
LucianBasicAttack, ...: Windup:0.146  Animation: 0.973

1.28 18lvl:
LucianBasicAttack, ...: Windup:0.117  Animation: 0.780

  • 0

#8
Asserio

Asserio

    Advanced Member

  • Members
  • 254 posts
  • LocationPortugal

Nice :D


  • 0

#9
Requizm

Requizm

    Advanced Member

  • Members
  • 66 posts

wow thank you


  • 0

#10
incimage

incimage

    Advanced Member

  • Members
  • 94 posts
  • LocationAnkara,Turkey

wow thank you

gos forumunda tayyip ne arıyo amk :D


  • 0

#11
Amnesia

Amnesia

    Member

  • Members
  • 15 posts

good


  • 0

#12
Wolfram

Wolfram

    Member

  • Members
  • 22 posts

This is a god send, thank you so much. 1YQy4.gif


  • 0

#13
JohanLiebert

JohanLiebert

    Advanced Member

  • Members
  • 62 posts

Lucian info:

~ spell.animationTime = 1.493 - ((GetAttackSpeed(myHero) - 0.67 / 0.01) * x) x ~ 15 to 22
~ spell.windUpTime = 0.224 - ((GetAttackSpeed(myHero) - 0.67 / 0.01) * y) y ~ 3 to 5
 

lucianpassivebuff

LucianQ: Windup:0.350 Animation: 2.000
LucianW: Windup:0.300 Animation: 2.000
LucianE: Windup:0.150 Animation: 0.600
LucianR: Windup:0.010 Animation: 2.000


LucianPassiveAttack, LucianBasicAttack, LucianBasicAttack2, LucianCritAttack, LucianCritAttack2
attack speed level:
0.67 1lvl:
LucianBasicAttack, ...: Windup:0.224  Animation: 1.493

0.68 2lvl:
LucianBasicAttack, ...: Windup:0.219  Animation: 1.460

0.70 3lvl:
LucianBasicAttack, ...: Windup:0.214  Animation: 1.427

0.72 4lvl:
LucianBasicAttack, ...: Windup:0.209  Animation: 1.394

0.73 5lvl:
LucianBasicAttack, ...: Windup:0.204  Animation: 1.361

0.75 6lvl:
LucianBasicAttack, ...: Windup:0.199  Animation: 1.328

0.77 7lvl:
LucianBasicAttack, ...: Windup:0.194  Animation: 1.296

0.79 8lvl:
LucianBasicAttack, ...: Windup:0.190  Animation: 1.264

0.81 9lvl:
LucianBasicAttack, ...: Windup:0.190  Animation: 1.232

0.83 10lvl:
LucianBasicAttack, ...: Windup:0.180  Animation: 1.201

0.85 11lvl:
LucianBasicAttack, ...: Windup:0.176  Animation: 1.171

0.88 12lvl:
LucianBasicAttack, ...: Windup:0.171  Animation: 1.140

0.90 13lvl:
LucianBasicAttack, ...: Windup:0.167  Animation: 1.111

0.92 14lvl:
LucianBasicAttack, ...: Windup:0.162  Animation: 1.082

0.95 15lvl:
LucianBasicAttack, ...: Windup:0.158  Animation: 1.054

0.97 16lvl:
LucianBasicAttack, ...: Windup:0.154  Animation: 1.026

1.00 17lvl:
LucianBasicAttack, ...: Windup:0.150  Animation: 1.000

1.03 18lvl:
LucianBasicAttack, ...: Windup:0.146  Animation: 0.973

1.28 18lvl:
LucianBasicAttack, ...: Windup:0.117  Animation: 0.780

this looks AMAZING.

 - in the gifs I see "buff stacks" etc is that also included?

 

man this will really encourage people :)


  • 0

#14
Vedere

Vedere

    Advanced Member

  • Members
  • 133 posts
  • LocationNull

Cool,now Draven auto pick up axe could be coded now.


  • 0

#15
NitroXenon

NitroXenon

    Newbie

  • Members
  • 9 posts
Nice :)
  • 0

#16
Delshire

Delshire

    Advanced Member

  • Members
  • 75 posts

Very nice, thanks.


  • 0

#17
Zypyzypyzy

Zypyzypyzy

    Advanced Member

  • Members
  • 34 posts
  • LocationPolen

Nice bro thanks


  • 0

#18
iglor713

iglor713

    Advanced Member

  • Members
  • 92 posts

added minion info (name, basename, buffs) and removed all objects:

function GetDistanceX(p1,p2) --thanks Inspired!
    p1 = GetOrigin(p1) or p1
    p2 = GetOrigin(p2) or p2
    return math.sqrt(GetDistanceSqrX(p1,p2))
end

function GetDistanceSqrX(p1,p2) --thanks Inspired!
    p2 = p2 or GetMyHeroPos()
    local dx = p1.x - p2.x
    local dz = (p1.z or p1.y) - (p2.z or p2.y)
    return dx*dx + dz*dz
end



OnObjectLoop(function(Object,myHero)
local Obj_Type = GetObjectType(Object);
if Obj_Type == Obj_AI_Hero then
	if IsVisible(Object) then
		if IsObjectAlive(Object) then  --you can remove this check if you wish...
			local origin = GetOrigin(Object);
			local myscreenpos = WorldToScreen(1,origin.x,origin.y,origin.z);
			if myscreenpos.flag then --after they're visible, alive and in our screen i will get the rest of the data to save some FPS
				DrawText(string.format("ChampName  = %s", GetObjectName(Object)),12,myscreenpos.x,myscreenpos.y,0xffffffff);
				DrawText(string.format("NetworkID     = 0x%X", GetNetworkID(Object)),12,myscreenpos.x,myscreenpos.y+10,0xffffffff);
				DrawText(string.format("Q________   = %s", GetCastName(Object,_Q)),12,myscreenpos.x,myscreenpos.y+20,0xffffffff);
				DrawText(string.format("W________  = %s", GetCastName(Object,_W)),12,myscreenpos.x,myscreenpos.y+30,0xffffffff);
				DrawText(string.format("E________    = %s", GetCastName(Object,_E)),12,myscreenpos.x,myscreenpos.y+40,0xffffffff);
				DrawText(string.format("R________    = %s", GetCastName(Object,_R)),12,myscreenpos.x,myscreenpos.y+50,0xffffffff);
				DrawText(string.format("SUMONER_1  = %s", GetCastName(Object,SUMMONER_1)),12,myscreenpos.x,myscreenpos.y+60,0xffffffff);
				DrawText(string.format("SUMONER_2  = %s", GetCastName(Object,SUMMONER_2)),12,myscreenpos.x,myscreenpos.y+70,0xffffffff);
				
				local yadder = 0;
				
				for i = 0,63 do
					if GetBuffCount(Object,i) > 0 then
						currbufname = GetBuffName(Object,i);
						currbufcount = GetBuffCount(Object,i);
						yadder = yadder + 10;
						DrawText(string.format("Buffstacks: %d for %s", currbufcount,currbufname),12,myscreenpos.x,myscreenpos.y+80+yadder,0xff00ff00);
						end
					end
				end
			end
		end
  end
  if Obj_Type == Obj_AI_Minion then
    if IsVisible(Object) then
			local origin = GetOrigin(Object);
			local myscreenpos = WorldToScreen(1,origin.x,origin.y,origin.z);
			if myscreenpos.flag then
        DrawText(string.format("BaseName  = %s", GetObjectBaseName(Object)),12,myscreenpos.x,myscreenpos.y+20,0xffffffff);
        DrawText(string.format("Name  = %s", GetObjectName(Object)),12,myscreenpos.x,myscreenpos.y+30,0xffffffff);
				local yadder = 0;
				for i = 0,63 do
					if GetBuffCount(Object,i) > 0 then
						currbufname = GetBuffName(Object,i);
						currbufcount = GetBuffCount(Object,i);
						yadder = yadder + 10;
						DrawText(string.format("Buffstacks: %d for %s", currbufcount,currbufname),12,myscreenpos.x,myscreenpos.y+80+yadder,0xff00ff00);
					end
				end
			end
    end
  end
end)



OnLoop(function(myHero)  -- in here we get all needed info for our champ
origin = GetOrigin(myHero);
myscreenpos = WorldToScreen(1,origin.x,origin.y,origin.z);
if myscreenpos.flag then
	DrawText(string.format("ChampName  = %s", GetObjectName(myHero)),12,myscreenpos.x,myscreenpos.y,0xffffffff);
	DrawText(string.format("NetworkID     = 0x%X", GetNetworkID(myHero)),12,myscreenpos.x,myscreenpos.y+10,0xffffffff);
	DrawText(string.format("Q________   = %s", GetCastName(myHero,_Q)),12,myscreenpos.x,myscreenpos.y+20,0xffffffff);
	DrawText(string.format("W________  = %s", GetCastName(myHero,_W)),12,myscreenpos.x,myscreenpos.y+30,0xffffffff);
	DrawText(string.format("E________    = %s", GetCastName(myHero,_E)),12,myscreenpos.x,myscreenpos.y+40,0xffffffff);
	DrawText(string.format("R________    = %s", GetCastName(myHero,_R)),12,myscreenpos.x,myscreenpos.y+50,0xffffffff);
	DrawText(string.format("SUMONER_1  = %s", GetCastName(myHero,SUMMONER_1)),12,myscreenpos.x,myscreenpos.y+60,0xffffffff);
	DrawText(string.format("SUMONER_2  = %s", GetCastName(myHero,SUMMONER_2)),12,myscreenpos.x,myscreenpos.y+70,0xffffffff);	
	local yadder = 0;
	for i = 0,63 do
		if GetBuffCount(myHero,i) > 0 then
			currbufname = GetBuffName(myHero,i);
			currbufcount = GetBuffCount(myHero,i);
			yadder = yadder + 10;
			DrawText(string.format("Buffstacks: %d for %s", currbufcount,currbufname),12,myscreenpos.x,myscreenpos.y+80+yadder,0xff00ff00);
			end
		end
	end
end)


OnProcessSpell(function(Object,spellProc)
local Obj_Type = GetObjectType(Object);
if Obj_Type == Obj_AI_Hero then --check only champions?
	PrintChat(string.format("'%s' casts '%s'; Windup: %.3f Animation: %.3f", GetObjectName(Object), spellProc.name, spellProc.windUpTime, spellProc.animationTime))
	end
end)

  • 0

#19
Crazie

Crazie

    Advanced Member

  • Members
  • 48 posts

[ERROR] \Script for Developers 0.2.lua:16: attempt to call global 'OnObjectLoop' (a nill value).

I named the file "Script for Developers 0.2.lua". This specific error is for the 2nd version posted above by iglor713. It also happens to the first one in the OP.


  • 0

#20
Deftsu

Deftsu

    donthackourgames

  • Ex-Core Dev
  • PipPipPip
  • 4,812 posts

[ERROR] \Script for Developers 0.2.lua:16: attempt to call global 'OnObjectLoop' (a nill value).

I named the file "Script for Developers 0.2.lua". This specific error is for the 2nd version posted above by iglor713. It also happens to the first one in the OP.

 

OnObjectLoop event doesn't exist anymore


  • 0




1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users