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

correct way to detect jhin reload


  • Please log in to reply
8 replies to this topic

#1
Kyung

Kyung

    Member

  • Members
  • 18 posts

i know there's the reload buff but that calls even when jhin has more than 0 bullets and is reloading because of not having used an AA/spell in the past 10 seconds (this reload you can cancel with an auto attack).

 

in L$ we had ObjectManager.Player.CanAttack which would be false when Jhin was reloading because he had to.


  • 0

#2
Kyung

Kyung

    Member

  • Members
  • 18 posts

Hey just an update. I was able to hack this together to make it work:

local lastattack = 0

Callback.Add('ProcessSpellComplete',
    function(unit, spell)
         if unit.isMe and spell.name:lower():find('attack') 
            and spell.target ~= nil and spell.target.team ~= myHero.team then
            lastattack = GetGameTimer()
        end
    end)

function isreloading()
    local time = GetGameTimer()
    
    for i = 0, myHero.buffCount do
        if GetBuffName(myHero, i) == 'JhinPassiveReload' then
            if GetBuffExpireTime(myHero, i) > GetGameTimer() then
                return (GetBuffStartTime(myHero, i) - lastattack) <= 2.5
            end
        end
    end
    
    return false
end

  • 0

#3
Deftsu

Deftsu

    donthackourgames

  • Ex-Core Dev
  • PipPipPip
  • 4,812 posts
if GotBuff(myHero, "JhinPassiveReload") > 0 then

  • 0

#4
Kyung

Kyung

    Member

  • Members
  • 18 posts
if GotBuff(myHero, "JhinPassiveReload") > 0 then

The point of this is that there are two situations in which Jhin reloads his weapon:

  1. When he runs out of bullets, in which he has to reload his weapon.
  2. When he has not used a spell or an ability in the past 10 seconds, in which he doesn't not have to reload his weapon.

In scenario #2, you can actually cancel the reloading of the weapon and do not need to wait for it to finish.

If you code it in your way, it can have some very frustrating results in some games (e.g. you flash in to 4th shot someone but it's actually passively reloading so you don't auto attack after your flash).


  • 0

#5
Deftsu

Deftsu

    donthackourgames

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

The point of this is that there are two situations in which Jhin reloads his weapon:

  • When he runs out of bullets, in which he has to reload his weapon.
  • When he has not used a spell or an ability in the past 10 seconds, in which he doesn't not have to reload his weapon.
In scenario #2, you can actually cancel the reloading of the weapon and do not need to wait for it to finish.
If you code it in your way, it can have some very frustrating results in some games (e.g. you flash in to 4th shot someone but it's actually passively reloading so you don't auto attack after your flash).

i see, i could just check for LastAttackTime (if it doesn't exceed 10 seconds) in my CanAttack function.
  • 0

#6
Kyung

Kyung

    Member

  • Members
  • 18 posts

i see, i could just check for LastAttackTime (if it doesn't exceed 10 seconds) in my CanAttack function.

Ah I didn't know of LastAttackTime but my code basically works similarly. 


  • 0

#7
Deftsu

Deftsu

    donthackourgames

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

Ah I didn't know of LastAttackTime but my code basically works similarly.


that's just a var from my orbwalker, there is no such API on GoS.
  • 0

#8
Nevachana

Nevachana

    Advanced Member

  • Members
  • 84 posts

I didnt look into gos api much yet, however, i think that eb and l$ had it.

something to check packets, so if(packet.id == jhin.reload.id) then, jhin will be reloading.

Basically, if you get reloading packet then you can make your boolean or w.e true.

Best way would be adding such check to an even i guess.

Edit: gotbuff should do the job, add that function to a timer and in case is cancelled you can always update your variable, it would be  much better if u posted your idea tho


Edited by Nevachana, 07 February 2017 - 09:21 .

  • 0

#9
InsidiousQuack

InsidiousQuack

    Advanced Member

  • Contributor
  • 138 posts
  • LocationLondon

just use OnAnimation for when the reload starts.


  • 0




1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users