Req: simple HUD "tracking" indicator

Forum for posting custom UIs, portions of UIs, and HUD stuff using MQ's enhancements.

Moderator: MacroQuest Developers

User avatar
Cr4zyb4rd
Plugins Czar
Posts: 1449
Joined: Tue Jul 20, 2004 11:46 am

Req: simple HUD "tracking" indicator

Post by Cr4zyb4rd » Tue Jul 20, 2004 4:12 pm

I currently have code like this in my MQ2HUD.ini to do simple spawn tracking.

Code: Select all

;Track nearest named spawns with heading/name
Spawn1=3,8,220,255,255,0,${If[${NearestSpawn[1,npc named].Name.NotEqual["NULL"]},${NearestSpawn[1,npc named].HeadingTo} - ${NearestSpawn[1,npc named].CleanName},No Named]}
Spawn2=3,8,234,255,255,0,${If[${NearestSpawn[2,npc named].Name.NotEqual["NULL"]},${NearestSpawn[2,npc named].HeadingTo} - ${NearestSpawn[2,npc named].CleanName},No Named]}
This works fine, but I'd like to have an arrow giving the direction of the mob (<-- and --> would be fine) to replace or augment the compass heading.

I did some forum searching, and it seems that HeadingTo used to be numeric but was "dumbed down" a bit to its current state. I could compute the angle manually but I'd rather not have that much math in what's supposed to be a simple .ini file. :) Anybody have an easier suggestion, or perhaps a dev could add a HeadingToLR or somesuch data type (the tracking plugin already has the code) in a future release?

Sparr
a hill giant
a hill giant
Posts: 159
Joined: Mon Jun 24, 2002 5:41 am

Post by Sparr » Tue Jul 20, 2004 6:25 pm

writing this on the fly, so forgive any syntax errors...

${If[$Math.Calc[${NearestSpawn[1,npc named].HeadingTo.Degrees}+15]<30,^^^,If[$Math.Calc[${NearestSpawn[1,npc named].HeadingTo.Degrees}]<180,-->,<--]]}

User avatar
Cr4zyb4rd
Plugins Czar
Posts: 1449
Joined: Tue Jul 20, 2004 11:46 am

Post by Cr4zyb4rd » Tue Jul 20, 2004 9:02 pm

Thanks, cleaned up the syntax to

Code: Select all

${If[${Math.Calc[${NearestSpawn[1,npc named].HeadingTo.Degrees}+15<30]},^^^,${If[${Math.Calc[${NearestSpawn[1,npc named].HeadingTo.Degrees}<180]},-->,<--]}]}
This is close, but doesn't quite do it. HeadingTo.Degrees gives the direction to the mob, but doesn't take the way I'm facing into account...Need to do something with ${Me.Heading.Degrees}-${Target.HeadingTo.Degrees} in here I think , but the math loses me. :(

Sparr
a hill giant
a hill giant
Posts: 159
Joined: Mon Jun 24, 2002 5:41 am

Post by Sparr » Tue Jul 20, 2004 10:34 pm

(${Me.Heading.Degrees}-${Target.HeadingTo.Degrees}+360)%360

that will normalize it 0-360. then do the -15 and comparisons i suggested, that gives you ^^^ for -15 to +15, and <-- or --> for sides. its just a matter of nesting a few more ifs in there to make it cooler with > then -> then --> for farther turns

User avatar
Cr4zyb4rd
Plugins Czar
Posts: 1449
Joined: Tue Jul 20, 2004 11:46 am

Post by Cr4zyb4rd » Wed Jul 21, 2004 2:45 am

Doh! Turns out in my brilliance I was doing Target-Me instead of Me-Target somehow without realizing it. At any rate, finished tracker looks like this

Code: Select all

;Track nearest named spawns with heading/name
Spawn1=3,8,220,255,255,0,${If[${NearestSpawn[1,npc named].Name.NotEqual["NULL"]},${If[${Math.Calc[(${Me.Heading.Degrees}-${NearestSpawn[1,npc named].HeadingTo.Degrees}+375)%360]}<30,^^^,${If[${Math.Calc[(${Me.Heading.Degrees}-${NearestSpawn[1,npc named].HeadingTo.Degrees}+360)%360]}<180,<--,-->]}]} ${NearestSpawn[1,npc named].CleanName},No Named]}
Tempted to add > -> --> like you mentioned, but it's already huge enough, methinks.

Thanks a ton.