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

How do i get champion's attack range?

get attack range

  • Please log in to reply
3 replies to this topic

#1
shunz19

shunz19

    Newbie

  • Members
  • 1 posts

I was wondering if there is getHeroAttackRange() function like that


  • 0

#2
Deftsu

Deftsu

    donthackourgames

  • Ex-Core Dev
  • PipPipPip
  • 4,812 posts
GetRange(unit) / unit.range
  • 0

#3
Krystra

Krystra

    Sexy Developer

  • Contributor
  • 417 posts

GetRange(unit) / unit.range

fast reply :)


  • 0

#4
jouzuna

jouzuna

    Advanced Member

  • Contributor
  • 73 posts

to follow up on Deftsu's reply:

basic attack range works differently to spell ranges

spell range is calculated from center to center of both units' model whereas attack range is from the edge of each unit's hitbox

 

so your basic attack range in GoS would be calculated like:

local attackRange = GetHitBox(source) + GetRange(source)

then you would need to check if the distance to the unit minus their hitbox radius is within that range:

if GetDistance(source, target) - GetHitBox(target) < attackRange then
    -- Do something

  • 1





Also tagged with one or more of these keywords: get, attack, range

1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users