Skip to content
everloot

Lore archive · Warcraft Wiki, 2023 dump

API CheckInteractDistance

Last wiki revision 2023-08-13

Returns true if the player is in range to perform a specific interaction with the unit. inRange = CheckInteractDistance(unit, distIndex)

  • unit: : UnitId - The unit to compare distance to.
  • distIndex: - A value from 1 to 5:
  • 1 = Compare Achievements, 28 yards
  • 2 = Trade, 8 yards
  • 3 = Duel, 7 yards
  • 4 = Follow, 28 yards
  • 5 = Pet-battle Duel, 7 yards
  • inRange: - 1 if you are in range to perform the interaction, nil otherwise.
  • If "unit" is a hostile unit, the return values are the same. But you obviously won't be able to do things like Trade.

if ( CheckInteractDistance("target", 4) ) then FollowUnit("target"); else -- we're too far away to follow the target end

Source

https://warcraft.wiki.gg/wiki/API_CheckInteractDistance · retrieved 2023-11-13 · CC BY-SA 4.0

Converted from wikitext with templates, tables and images removed, so some sentences may be missing values.

This archive predates WoW: Forever. For collected gameplay facts see the Forever database. Search the archive.