Distance meter

Kannkor

Ogre
What are you wanting to do..?

You basically have 2 options if you want to do with HUD.

Put both target and implied target on screen.

Write a script to handle target vs implied.
 

pr517

Active Member
Bob, your target's target is, wait for it, ${Target.Target}! For when you really need to stand riiight there...

tdistance.iss:
Code:
;
; HUD element for the distance between you and your target/implied target.
;
; If hudFriendly is TRUE, a valid target/implied target is the PC target type. (useful for healers)
; If hudFriendly is FALSE, a valid target/implied target is either the NamedNPC or NPC target types. (useful for DPS)

variable    int hudX        = 594
variable    int hudY        = 100
variable    int hudSize     = 26
variable string hudColor    = "00FF00"
variable    int updateSpeed = 1

function main(bool hudFriendly = FALSE)
{
   variable float fDist     = 0.00
   variable float fLastDist = 0.00

   echo off
   hud -remove tdistance
   hud -add tdistance ${hudX},${hudY} ""
   hudset tdistance -s ${hudSize} -c ${hudColor}
   echo on
   echo "tdistance ON (${If[${hudFriendly},"Friendly","Hostile"]} mode)"

   while 1
   {
      ; Determine distance
      if ${hudFriendly}
      {
         if ${Target.Type.Equal[PC]}
         {
            fDist:Set[${Target.Distance}]
         }
         elseif ${Target.Target.Type.Equal[PC]}
         {
            fDist:Set[${Target.Target.Distance}]
         }
         else
         {
            fDist:Set[0.00]
         }
      }
      else
      {
         if ( ${Target.Type.Equal[NamedNPC]} || ${Target.Type.Equal[NPC]} )
         {
            fDist:Set[${Target.Distance}]
         }
         elseif ( ${Target.Target.Type.Equal[NamedNPC]} || ${Target.Target.Type.Equal[NPC]} )
         {
            fDist:Set[${Target.Target.Distance}]
         }
         else
         {
            fDist:Set[0.00]
         }
      }

      ; Show distance
      if ( ${fLastDist} != ${fDist} )
      {
         if ( ${fDist} > 0 )
         {
            hudset tdistance -t ${fDist.Centi}
         }
         else
         {
            hudset tdistance -t ""
         }
         fLastDist:Set[${fDist}]
      }

      ; Higher updateSpeed means higher FPS
      if ( ${updateSpeed} > 0 )
         wait ${updateSpeed}
      else
         waitframe
   }
}

function atexit()
{
   echo off
   hud -remove tdistance
   echo on
   echo "tdistance OFF"
}
 
Top Bottom