Running a path around KoS NPCs?

Macro requests from before the user variable changes that broke all macros

Moderator: MacroQuest Developers

Zorg
a lesser mummy
a lesser mummy
Posts: 44
Joined: Fri Oct 18, 2002 7:01 pm

Running a path around KoS NPCs?

Post by Zorg » Sat Dec 14, 2002 9:01 am

Here's the concept: A macro that will run you from point A to point B, while avoiding KoS NPCs.

Getting faction levels is easy enough. Find the NPCs within a half-circle of arbitary radius pointing towards the destination point, and iterate through their ids, checking /con and storing the results to determine if they're KoS.

The problem is, what sort of formula with define a path that threads through them? So how about defining a circle around every KoS NPC of a certain radius, then running a path defined by a tangent line to the circle, then re-facing the point you're running to.

While I think I could code something like this, the problem is that I have to deal with multiple KoS npcs, which may have overlapping aggro zones. Assuming I know the aggro radius of the NPCs, and an I know all the kos NPCs between myself and the destination point, any idea how to create a macro that will run through them?

User avatar
Fippy
a snow griffon
a snow griffon
Posts: 499
Joined: Tue Jul 16, 2002 10:42 am

Post by Fippy » Sat Dec 14, 2002 9:26 am

I played with some area avoidance code in hunter.mac. Just in East Commons with a few areas to avoid it causes pretty bad lag.

Heres the face at a tangent code.

Code: Select all

sub AvoidLoc 
| Pass in 3 numbers first two are the Y and X locs of the point to avoid third one is the distance you want to keep from it. 
| This sub will check if you are within the distance specified and turn you away from the loc and run you until you are the correct 
| distance away. Too many calls to this sub will slow your main loop down badly so keep the areas large and infrequent for best results. 
| i.e. if there are a few huts together set a loc and radius that will cover the whole area rather than each individual hut. 

/if n $distance($p0,$p1)>$p2 /goto :OK 
    /mqlog close to $p0 $p1 
    /if n $calc($heading($p0,$p1)-$char(heading)<0 { 
       /face heading $calc($heading($p0,$p1)-95) 
    } else { 
       /face heading $calc($heading($p0,$p1)+95) 
    } 
    :RunAway 
    /call autorun2 1 
    /delay 1 
    /if n $distance($p0,$p1)<$p2 /goto :RunAway 
:OK 
  
/return 

you only need the mob targeted to /con it and you can target anywhere with MQ so that should not be a problem.

Maybe adding the list of mobs to avoid with a radius to an alert list would be an idea to cut down the mobs your worried about, since if a mobs 500 clicks away then its not a problem.

Lag whilst calculating will be the problem I think but hopefully this is enough to give you and idea.
Fippy

This is my girl. But Rizwank had her first :-)
[img]http://www.btinternet.com/~artanor/images/fairy_bounce09.gif[/img]