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

sry but need help


  • Please log in to reply
15 replies to this topic

#1
pussykate

pussykate

    Advanced Member

  • Banned
  • PipPipPip
  • 1,477 posts
  • LocationGermany
I can not finish my script. I always fail at a thing.
I do not get an error message. It does not work though.
Here is the code, then you should know what I want.
 
 
function FindThePartner()
	if Partnership then return end
	for i = 1, Game.HeroCount() do
		local hero = Game.Hero(i)
		if not hero.isMe and hero.isAlly and HasBuff(hero,"kalistacoopstrikeally") and hero.charName == "Blitzcrank" then
			--print("Blitzcrank found")
			Partnership = hero
		end
	end	
end

 


  • 0

#2
DamnedNooB

DamnedNooB

    Advanced Member

  • Scripts Developer
  • 929 posts

hard to tell without full code. where did you declare the "Partnership" field? (since you are not returning anything)


  • 0

#3
pussykate

pussykate

    Advanced Member

  • Banned
  • PipPipPip
  • 1,477 posts
  • LocationGermany

DamnedNooB, on 01 Sept 2018 - 05:09 AM, said:

hard to tell without full code. where did you declare the "Partnership" field? (since you are not returning anything)

here is my full code. please do not laugh.. :)
I'm not a pro .....
 
if myHero.charName ~= "Kalista" then return end
--print("Have Fun Guys")
--print("by Pussykate")



-- Spell Data
local R = {Range = 1100}
local Partnership = nil










-- Menu
local Kalista = MenuElement({type = MENU, id = "Kalista", name = "Kalista"})

--[[Combo]]
Kalista:MenuElement({type = MENU, id = "WomboCombo", name = "WomboCombo Settings"})
Kalista.WomboCombo/Blitz:MenuElement({id = "R", name = "UseR/Blitzcrank Grab", value = true})





function isReady(slot)
	return Game.CanUseSpell(slot) == 0
end

function isValidTarget(obj,range)
	range = range and range or math.huge
	return obj ~= nil and obj.valid and obj.visible and not obj.dead and obj.isTargetable and obj.distance <= range
end

function HasBuff(unit, buffname)
  for i = 0, unit.buffCount do
    local buff = unit:GetBuff(i)
    if buff and buff.count > 0 and buff.name:lower() == buffname:lower() and buff.expireTime >= Game.Timer() then 
      return true
    end
  end
  return false
end

function GetBuff(unit, buffname)
  for i = 0, unit.buffCount do
    local buff = unit:GetBuff(i)
    if buff and buff.count > 0 and buff.name:lower() == buffname:lower() and buff.expireTime >= Game.Timer() then 
      return true
    end
  end
  return false
end




function CountEnemy(pos,range)
	local N = 0
	for i = 1,Game.HeroCount()  do
		local hero = Game.Hero(i)	
		if isValidTarget(hero,range) and hero.isEnemy then
			N = N + 1
		end
	end
	return N	
end

local function VectorPointProjectionOnLineSegment(v1, v2, v)
    local cx, cy, ax, ay, bx, by = v.x, (v.z or v.y), v1.x, (v1.z or v1.y), v2.x, (v2.z or v2.y)
    local rL = ((cx - ax) * (bx - ax) + (cy - ay) * (by - ay)) / ((bx - ax) ^ 2 + (by - ay) ^ 2)
    local pointLine = { x = ax + rL * (bx - ax), y = ay + rL * (by - ay) }
    local rS = rL < 0 and 0 or (rL > 1 and 1 or rL)
    local isOnSegment = rS == rL
    local pointSegment = isOnSegment and pointLine or { x = ax + rS * (bx - ax), y = ay + rS * (by - ay) }
    return pointSegment, pointLine, isOnSegment
end


function FindThePartner()
	if Partnership then return end
	for i = 1, Game.HeroCount() do
		local hero = Game.Hero(i)
		if not hero.isMe and hero.isAlly and HasBuff(hero,"kalistacoopstrikeally") and hero.charName == "Blitzcrank" then
			--print("Blitzcrank found")
			Partnership = hero
		end
	end	
end


function Gethookbuff(hero)
	if not unit then return 0 end
	for i = 0, unit.buffCount do
		local buff = unit:GetBuff(i)
		if buff.name and buff.name:lower() == "rocketgrab2" and buff.count > 0 and buff.expireTime >= Game.Timer() then
			return buff.count
		end
	end
	return 0
end



function AutoR()
	for i = 1, Game.HeroCount() do
		local hero = Game.Hero(i)
		if hero.isEnemy then
			local hook = Gethookbuff(hero)
			if hook > 0 and Kalista.WomboCombo/Blitz.R:Value() and Ready(_R) and myHero.pos:DistanceTo(Partnership.pos) < 1100 then
				Control.CastSpell(HK_R)
				return
			end
		end
	end	
end








  • 0

#4
DamnedNooB

DamnedNooB

    Advanced Member

  • Scripts Developer
  • 929 posts

Made sure your HasBuff function returns the correct result?


  • 0

#5
pussykate

pussykate

    Advanced Member

  • Banned
  • PipPipPip
  • 1,477 posts
  • LocationGermany

I do not understand right now. is the hasbuff function wrong?


  • 0

#6
DamnedNooB

DamnedNooB

    Advanced Member

  • Scripts Developer
  • 929 posts

pussykate, on 01 Sept 2018 - 07:55 AM, said:

I do not understand right now. is the hasbuff function wrong?


I dont know, didnt look into it more. I was asking if you made sure that the buff properties you are using are returning correct values. (Buff.Name, buff.count, buff.expiry) and so on. Print out each of those and you should see if there is a Problem with them. If not, move on to the next function. You cant use functions if you dont know if they are returning the values you are looking for or not. You dont know if the hasbuff function works properly but you are asking why a function you copied somewhere, using 2-3 other functions you did not test, isnt working. Go back one step before trying to jump over canyons


  • 0

#7
TheOneRU

TheOneRU

    Advanced Member

  • Members
  • 43 posts

I'm pretty sure GoS api still not updated this is why it might not work. I created a thread asking if buffCount and GetBuff are working or not a couple of days ago...


  • 0

#8
DamnedNooB

DamnedNooB

    Advanced Member

  • Scripts Developer
  • 929 posts

TheOneRU, on 01 Sept 2018 - 3:51 PM, said:

I'm pretty sure GoS api still not updated this is why it might not work. I created a thread asking if buffCount and GetBuff are working or not a couple of days ago...

and the result of you testing those API calls is...?
  • 0

#9
TheOneRU

TheOneRU

    Advanced Member

  • Members
  • 43 posts

DamnedNooB, on 01 Sept 2018 - 3:54 PM, said:

and the result of you testing those API calls is...?

 

is not returning buff name or type when tested on yassuo in bot game - this is why auro R on knocked enemies is not working for all yas scripts atm


  • 0

#10
iSaga

iSaga

    Advanced Member

  • Trial Developer
  • 559 posts
Buff.type wont work but GotBuff semi works

Function is

GotBuff(name, person)

Returns 0 or 1

0 means none 1 means yes
  • 0

#11
RMAN

RMAN

    Advanced Member

  • Contributor
  • 523 posts

pussykate, on 01 Sept 2018 - 05:46 AM, said:

...

 

If that is indeed your full code, the problem is that you didnt subscribe to OnTick or any other event and you never called those functions.

The code you posted only runs until Menu is created, everything else isnt executed even once.


  • 0

#12
pussykate

pussykate

    Advanced Member

  • Banned
  • PipPipPip
  • 1,477 posts
  • LocationGermany

RMAN, on 04 Sept 2018 - 02:58 AM, said:

If that is indeed your full code, the problem is that you didnt subscribe to OnTick or any other event and you never called those functions.

The code you posted only runs until Menu is created, everything else isnt executed even once.

 

ok, thanks i will write new.


  • 0

#13
iSaga

iSaga

    Advanced Member

  • Trial Developer
  • 559 posts

RMAN, on 04 Sept 2018 - 02:58 AM, said:

If that is indeed your full code, the problem is that you didnt subscribe to OnTick or any other event and you never called those functions.
The code you posted only runs until Menu is created, everything else isnt executed even once.


Lol I didnt realize that was his full code. Good catch.
  • 0

#14
RMAN

RMAN

    Advanced Member

  • Contributor
  • 523 posts

I've coded the concept for you HERE. But try to understand what the code does, its much easier than simply using it like a black box.
 
Some few notes on your code:

  • Dont keep searching for blitz if an oathsworn ally has already been found
  • Dont check for general conditions inside a loop, checking if Menu is enabled and Skill is ready should be done before the loop start!
  • Use local functions, they're faster and this practice helps keeping _G clean
  • Localize the functions you need at the top, local functions run much faster as said before.
  • Dont add code that you're not gonna use. Keep your coding environment as clean and organized as possible.

With only those in mind, I'd like to congratulate you! You're doing very well so please dont give up.
Remember that we all have to start at some point and the only way is through. :)
 

Spoiler


  • 2

#15
pussykate

pussykate

    Advanced Member

  • Banned
  • PipPipPip
  • 1,477 posts
  • LocationGermany

ohh , this is verry nice, How can I thank you for that? that's really nice of you ,,,,,,

Thanks alot
 
The goal I've set myself is: not just Kalista-Blitzcrank ... but it should be a bigger aio with different womboCombos.
Your help helped me a lot.

  • 0

#16
RMAN

RMAN

    Advanced Member

  • Contributor
  • 523 posts

pussykate, on 04 Sept 2018 - 07:30 AM, said:

 

ohh , this is verry nice, How can I thank you for that? that's really nice of you ,,,,,,

Thanks alot
 
The goal I've set myself is: not just Kalista-Blitzcrank ... but it should be a bigger aio with different womboCombos.
Your help helped me a lot.

 

Well, for starters you could upvote me  :kek:

If youre planning something bigger I highly recommend using classes


  • 0




1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users