Basic Lua script to move your character(s) out of Line of Sight of the target. I was working to implement this into Lua BARF and figured if it can be of use to others, then just load it up for everyone to access and butchered as desired.
To run this just type /lua run losafe
The script will do its thing based upon the target. I've only tested this with stationary NPC targets, so you may need to make adaptations to suit your specific use case. Right now it is set at a range of +/- 60 on the x/y, and +/- 20 on the z axis.
If you want to change the x/y and z axis, start the script with your command line arguments via, for example, /lua run losafe 100 10 to expand the search to +/- 100 x/y and reduce to +/- 10 z.
This script will determine Target.X, Target.Y, and Target.Z to establish the baseline, then generate potential offset coordinates in increments of 7.5 (so as not to melt your performance... Adjust this directly within the Lua if you need further refinement). Once it has that table established, it will first prune it down based upon which locations EverQuest determines are valid locations, then it will further reduce the list based upon which of those coordinates are NOT in Line of Sight of the target. Finally, it will run one more check of the remaining coordinates and remove any that MQ2Nav deems are not navigable.
Once the pruned table is constructed, it will rank coordinates by shortest to longest path length (from the character's current /loc) and attempt to navigate your character to the nearest identified safe location. If, at any time, the character travels through an area that does not have Line of Sight of the target, it will immediately stop the character there and consider the mission accomplished.
Enjoy... Maybe.
To run this just type /lua run losafe
The script will do its thing based upon the target. I've only tested this with stationary NPC targets, so you may need to make adaptations to suit your specific use case. Right now it is set at a range of +/- 60 on the x/y, and +/- 20 on the z axis.
If you want to change the x/y and z axis, start the script with your command line arguments via, for example, /lua run losafe 100 10 to expand the search to +/- 100 x/y and reduce to +/- 10 z.
This script will determine Target.X, Target.Y, and Target.Z to establish the baseline, then generate potential offset coordinates in increments of 7.5 (so as not to melt your performance... Adjust this directly within the Lua if you need further refinement). Once it has that table established, it will first prune it down based upon which locations EverQuest determines are valid locations, then it will further reduce the list based upon which of those coordinates are NOT in Line of Sight of the target. Finally, it will run one more check of the remaining coordinates and remove any that MQ2Nav deems are not navigable.
Once the pruned table is constructed, it will rank coordinates by shortest to longest path length (from the character's current /loc) and attempt to navigate your character to the nearest identified safe location. If, at any time, the character travels through an area that does not have Line of Sight of the target, it will immediately stop the character there and consider the mission accomplished.
Enjoy... Maybe.