• You've discovered RedGuides 📕 an EverQuest multi-boxing community 🛡️🧙🗡️. We want you to play several EQ characters at once, come join us and say hello! 👋
  • IS THIS SITE UGLY? Change the look. To dismiss this notice, click the X --->

Checking for Line of sight... (1 Viewer)

FunWithUs

New member
Joined
Aug 21, 2005
RedCents
I have managed to come up with a nice way to make a character aquire a new target each time the one I have selected goes out of range or dies. The problem is that sometimes there are mobs behind walls or beneath/above me, and they get in my target window.

What I would really like to do is to prevent the macro from selecting a target that is not in line of sight, but if I have to settle for clearing the target window after the target is slected, then so be it.

Will this work? If not, am I close?

Rich (BB code):
Sub NewTarget
/target npc next radius 150
/If[${Target.ID} && !${Target.LineOfSight} /keypress esc ]
/return

If you know how to keep it from selecting a target that is not in line of sight to start with, please let me know?

Thanks!
 
It would be possible to do it without targetting, but would require a bit more code.

Such as

Rich (BB code):
Sub NewTarget
/declare potentialTarget int local ${Spawn[npc radius 150].ID}
:targetLoop
/if (${Spawn[id ${potentialTarget}].LineOfSight) {
   /target id ${potentialTarget}
   /return
} else {
   /varset potentialTarget ${Spawn[id ${potentialTarget].NearestSpawn[npc radius 150].ID}
   /goto :targetLoop
}

/return

Untested and written in 3 minutes so quite possibly some errors, but that's the idea. What you have would work except

/If[${Target.ID} && !${Target.LineOfSight} /keypress esc ]

syntax is wrong..

/if (${Target.ID} && !${Target.LineOfSight}) /keypress ESC

edit: Looking back at the code I wrote, there's a sort of caveat; the first line in the else block targets the closest npc to the npc that was just rejected. It's possible to jump around the zone like this, though unlikely. You could also use the line

${Me.NearestSpawn[npc radius 150 notid ${potentialTarget}]}

Or an alternate sub that goes to the closest ith mob that is in LoS

Rich (BB code):
Sub NewTarget
/declare potentialTarget int local ${Spawn[npc radius 150].ID}
/declare i int local 1
:targetLoop
/if (${Spawn[id ${potentialTarget}].LineOfSight) {
   /target id ${potentialTarget}
   /return
} else {
   /varset i ${i} + 1
   /varset potentialTarget ${Me.NearestSpawn[${i}, npc radius 150].ID}
   /goto :targetLoop
}

/return

It's situational really; each of these methods would work better in different places. Hope one of them helps.
 
Last edited:
Nope... It's not working. I think it's got something to do with this line:
Rich (BB code):
/declare potentialTarget int local ${Spawn[npc radius 150].ID}

The message I get is:
Rich (BB code):
Unparsable in calculation: '$'
(NewTarget): /if(${Spawn[id ${potentialTarget}].LineOfSight) (
/call NewTarget
The current macro has ended.
Rich (BB code):
Failed to Parse /if condition '(${Spawn[id 8].LineOfSight)', non-numeric encountered
 
If there are no npcs in range, the macro targets me, and I proceed to kill myself.

Is there a simple way to add something to the sub that will prevent it from targeting me?

Perhaps something like this?

Rich (BB code):
/if (${potentialTarget}=={Me.ID}) {
/return
}

I want to tell it to keep scanning if I am the target.
 
I think I have a better idea on how to accomplish it, but I am having trouble figuring out the syntax. There should only be 1 target with a distance of 0, and that would be me. What I have below doesn't work, but I think I am close.

Rich (BB code):
/if (${Spawn[id ${potentialTarget}].Distance}=0) {
/return
}

Returns an error that reads:
Rich (BB code):
Failed to parse /if condition '(167.75=0)',non-numeric encountered

Any tip on how to make it do (If potentialTarget has a distance of 0, then /return)?
 
Checking for Line of sight...

Users who are viewing this thread

Back
Top