Question Radius Question

McNukkah

Member
Joined
Oct 30, 2007
Messages
209
Reaction score
23
Points
18
Location
The Forest
I've been using a personal, custom macro for...since I can remember and today I encountered a problem I've never really experienced.

The breakdown is as follows:

I set up variables that are declared when I start the macro that handle what mobs get pulled in terms of how far away they are in distance based off of radius, and zradius, and finally level range.


So eventually it shows up like this:

/varset nmob ${Me.NearestSpawn[npc radius ${pullradius} zradius ${mobzrad} range ${levelone} ${leveltwo} noalert].ID}


I was in a location where my pull radius was very low (about 70, but my zradius was large, about 200). For whatever reason, I could not see mobs that were either above, or below me (and it seemed to go no higher than 70, as far as I can tell.) So, are they linked? Have I answered my own question? Was I only able to see a distance of 70? Am I losing my mind?

After all these years I've never used this in a setting where my pulling radius was lower than the zradius check...that's the only thing I can think of that is different...


I'm probably missing something stupid.

Appreciate any help, suggestions, etc.
 
I've been using a personal, custom macro for...since I can remember and today I encountered a problem I've never really experienced.

The breakdown is as follows:

I set up variables that are declared when I start the macro that handle what mobs get pulled in terms of how far away they are in distance based off of radius, and zradius, and finally level range.


So eventually it shows up like this:

/varset nmob ${Me.NearestSpawn[npc radius ${pullradius} zradius ${mobzrad} range ${levelone} ${leveltwo} noalert].ID}


I was in a location where my pull radius was very low (about 70, but my zradius was large, about 200). For whatever reason, I could not see mobs that were either above, or below me (and it seemed to go no higher than 70, as far as I can tell.) So, are they linked? Have I answered my own question? Was I only able to see a distance of 70? Am I losing my mind?

After all these years I've never used this in a setting where my pulling radius was lower than the zradius check...that's the only thing I can think of that is different...


I'm probably missing something stupid.

Appreciate any help, suggestions, etc.

To properly troubleshoot something like this we would certainly need more than one line of code. Z radius is not linked to radius. If no Zradius is provided for example, then the Zradius is infinite. It could also have something to do with limited level ranges or the alert list. It could be some complication of the declaration of the mobzrad or a varset which is causing it to take on the properties of pullradius. It could be the mobs outside of the radius that you are expecting it to pull are on an alert list.

I've never used the NearestSpawn the way you did. I've always used ${NearestSpawn[#, conditions].ID} where # is the number of the nearest spawn. IE: nearest spawn npc that meets my conditions is a rat, but the 2nd nearest spawn is a kobold. If I use ${NearestSpawn[2,conditions].ID} then it should return the ID of the kobold and not the rat. Whereas if I replace # with 1 then it should return the rat. I'm not in game to check it, it very well may be that ${Me.NearestSpawn[conditions].ID} works the same way.

Again, without more information this isn't something that can really be addressed.
 
To properly troubleshoot something like this we would certainly need more than one line of code. Z radius is not linked to radius. If no Zradius is provided for example, then the Zradius is infinite. It could also have something to do with limited level ranges or the alert list. It could be some complication of the declaration of the mobzrad or a varset which is causing it to take on the properties of pullradius. It could be the mobs outside of the radius that you are expecting it to pull are on an alert list.

I've never used the NearestSpawn the way you did. I've always used ${NearestSpawn[#, conditions].ID} where # is the number of the nearest spawn. IE: nearest spawn npc that meets my conditions is a rat, but the 2nd nearest spawn is a kobold. If I use ${NearestSpawn[2,conditions].ID} then it should return the ID of the kobold and not the rat. Whereas if I replace # with 1 then it should return the rat. I'm not in game to check it, it very well may be that ${Me.NearestSpawn[conditions].ID} works the same way.

Again, without more information this isn't something that can really be addressed.



Hmm sorry, all right---I messed up and forgot the mention the check that occurs before I even get to the /varset nmob part. The alert list doesn't apply because I haven't added any alerts for this specific zone.
/varset nmob ${Me.NearestSpawn[npc radius ${pullradius} zradius ${mobzrad} range ${levelone} ${leveltwo} noalert].ID}

To start the macro each variable in that line is declared. IE: /mac themacro 700 1 200 200 etc.

There are other variables that I declare to start the macro that deal with PC detection (what radius and zradius to look for pc's), but those have no bearing on this problem.

So, after that line is used, it will then attempt to /target ${nmob} but not before performing a check that there's even a mob up that meets the defined criteria, so it does this:

/if (${SpawnCount[npc radius ${pullradius} zradius ${mobzrad} range ${levelone} ${leveltwo} noalert]}<1) /call othersubs


if it's less than 1 it just goes and waits in a different subroutine, does buff checks, and waits until that returns greater than 1 to get back to pulling...


To experiment...I did this today...

Went to a similar location and defined each variable as follows:

pullradius = 70
mobzrad = 2000
range = 1 to 200
noalert = doesn't apply b/c none are set for this zone.


Went to the tower and did /echo ${SpawnCount[npc radius ${pullradius} zradius ${mobzrad} range ${levelone} ${leveltwo} noalert]}


It returned a value of 6. On my map, there are far more than 6 mobs in this tower. If I set my map low/high filters to 70--there are 6 mobs.

Moved to a different tower, and decided to cut the other shit out of the way:

/echo ${SpawnCount[npc radius 70]}

returns 7 mobs. (there are 10 total)

/echo ${SpawnCount[npc radius 100]}


returns 10 mobs. It added mobs that were below me.


Does spawncount interpret a radius spawn search differently than a nearestspawn?
 
To properly troubleshoot something like this we would certainly need more than one line of code. Z radius is not linked to radius. If no Zradius is provided for example, then the Zradius is infinite. It could also have something to do with limited level ranges or the alert list. It could be some complication of the declaration of the mobzrad or a varset which is causing it to take on the properties of pullradius. It could be the mobs outside of the radius that you are expecting it to pull are on an alert list.

I've never used the NearestSpawn the way you did. I've always used ${NearestSpawn[#, conditions].ID} where # is the number of the nearest spawn. IE: nearest spawn npc that meets my conditions is a rat, but the 2nd nearest spawn is a kobold. If I use ${NearestSpawn[2,conditions].ID} then it should return the ID of the kobold and not the rat. Whereas if I replace # with 1 then it should return the rat. I'm not in game to check it, it very well may be that ${Me.NearestSpawn[conditions].ID} works the same way.

Again, without more information this isn't something that can really be addressed.



Hmm sorry, all right---I messed up and forgot the mention the check that occurs before I even get to the /varset nmob part. The alert list doesn't apply because I haven't added any alerts for this specific zone.
/varset nmob ${Me.NearestSpawn[npc radius ${pullradius} zradius ${mobzrad} range ${levelone} ${leveltwo} noalert].ID}

To start the macro each variable in that line is declared. IE: /mac themacro 700 1 200 200 etc.

There are other variables that I declare to start the macro that deal with PC detection (what radius and zradius to look for pc's), but those have no bearing on this problem.

So, after that line is used, it will then attempt to /target ${nmob} but not before performing a check that there's even a mob up that meets the defined criteria, so it does this:

/if (${SpawnCount[npc radius ${pullradius} zradius ${mobzrad} range ${levelone} ${leveltwo} noalert]}<1) /call othersubs


if it's less than 1 it just goes and waits in a different subroutine, does buff checks, and waits until that returns greater than 1 to get back to pulling...


To experiment...I did this today...

Went to a similar location and defined each variable as follows:

pullradius = 70
mobzrad = 2000
range = 1 to 200
noalert = doesn't apply b/c none are set for this zone.


Went to the tower and did /echo ${SpawnCount[npc radius ${pullradius} zradius ${mobzrad} range ${levelone} ${leveltwo} noalert]}


It returned a value of 6. On my map, there are far more than 6 mobs in this tower. If I set my map low/high filters to 70--there are 6 mobs.

Moved to a different tower, and decided to cut the other shit out of the way:

/echo ${SpawnCount[npc radius 70]}

returns 7 mobs. (there are 10 total)

/echo ${SpawnCount[npc radius 100]}


returns 10 mobs. It added mobs that were below me.


Does spawncount interpret a radius spawn search differently than a nearestspawn?

I don't play the game. So I'm going to assume when you say you went to a tower you mean that you went to an area where there were only mobs above and below you under a certain radius which was verified by using something like /mapfilter castradius ${pullrange} following you manually counting the mobs within the radius of your character provided the assumption of no zradius meaning infinite, that the mobs would be expected to be that value. Followed by the echo with the same radius as provided by the mapfilter to get the results which were not as expected. It is possible that using a radius without a zradius defaults the zradius to that value, creating a sphere around you as based only on radius as opposed to an oblong ellipse created using both the radius and zradius parameters. It sounds like you're on the right track for trouble shooting it to understand the situation and perhaps just testing those conditions verifying results against the expected results will generate the answer you need. I don't really get in game so I couldn't attempt to do all the testing for you. Had I an answer to the question I would provide it.
 
By the way, the mmobugs version of spawncount has some additional search paramters that the main compile does not. I noticed we dont have a wiki for them so here you go:
SpawnCount paramters:
pc
npc
mount
pet
pcpet
npcpet
xtarhater
nopet
familiar
nofamiliar
invis
noradius
force
nomyguild

corpse
npccorpse
pccorpse
trigger
untargetable
trap
chest
timer
aura
object
banner
campfire
mercenary
flyer
any
next
prev
lfg
gm
group
fellowship
nogroup
raid
noguild
trader
named
merchant
tribute
knight
tank
healer
dps
slower
los
targetable
range
loc
id
radius
body
class
race
light
myguild
guild
guildname
alert
noalert
notnearalert
nearalert
zradius
notid
nopcnear
playerstate
 
I also had problems on SpawnCount

For example:

Code:
${SpawnCount[npc loc ${XLoc} ${YLoc} radius 500 zradius 100 targetable noalert 1]}

never return the correct value..

However it do yield correct value if you delete the zradius parameter, like this

Code:
${SpawnCount[npc loc ${XLoc} ${YLoc} radius 500 targetable noalert 1]}

to me it seems SpawnCount had something wrong with Zradius.
 
So here is the actual code for that:
Code:
        else if (!_stricmp(szArg, "loc")) {
            pSearchSpawn->bKnownLocation = TRUE;
            GetArg(szArg, szRest, 1);
            pSearchSpawn->xLoc = (FLOAT)atof(szArg);
            GetArg(szArg, szRest, 2);
            pSearchSpawn->yLoc = (FLOAT)atof(szArg);
            GetArg(szArg, szRest, 3);
          [COLOR=cyan]  pSearchSpawn->zLoc = (FLOAT)atof(szArg);[/COLOR]
            if (pSearchSpawn->zLoc == 0.0) {
               [COLOR=cyan] pSearchSpawn->zLoc = ((PSPAWNINFO)pCharSpawn)->Z[/COLOR];
                szRest = GetNextArg(szRest, 2);
            }
            else {
                szRest = GetNextArg(szRest, 3);
            }
        }
and
Code:
        else if (!_stricmp(szArg, "[COLOR=yellow]zradius[/COLOR]")) {
            GetArg(szArg, szRest, 1);
            [COLOR=yellow]pSearchSpawn->ZRadius = atof(szArg[/COLOR]);
            szRest = GetNextArg(szRest, 1);
        }
${SpawnCount[loc 1 2 3]} sets the following values:
pSearchSpawn->xLoc =1
pSearchSpawn->yLoc =2
pSearchSpawn->zLoc =3

${SpawnCount[zradius 50]} sets the following value:
pSearchSpawn->ZRadius =50

Short version of how it works is there is a special class called pSearchSpawn with a bunch of values. You plug in the values you want via the SpawnCount[parameters] and it sets those values of the class and then runs a search against all spawns in zone for ones that are within the ranges specified. As you can see, the 2 options do actually set a different radius check but here is the no kidding check:
Code:
    if ([COLOR=yellow]pSearchSpawn->ZRadius[/COLOR] < 10000.0f && ([COLOR=lime]pSpawn->Z [/COLOR]> [COLOR=cyan]pSearchSpawn->zLoc[/COLOR] + [COLOR=yellow]pSearchSpawn->ZRadius[/COLOR] || [COLOR=lime]pSpawn->Z [/COLOR]< [COLOR=cyan]pSearchSpawn->zLoc[/COLOR] -[COLOR=yellow] pSearchSpawn->ZRadius[/COLOR]))
        return FALSE;
pSpawn->Z is the current Z of the spawn being checked against.
pSearchSpawn->ZRadius is your zradius 50
pSearchSpawn->zLoc is your 3

So it looks like it checks correctly. You can set the original Z or you only put X and Y and it will set Z to your own value, then subtracts and adds the zradius you put for the range.

It would be interesting to see any situations that it doesnt work correctly because the math says it should.
 
Last edited:
I was in a location where my pull radius was very low (about 70, but my zradius was large, about 200). For whatever reason, I could not see mobs that were either above, or below me (and it seemed to go no higher than 70, as far as I can tell.) So, are they linked? Have I answered my own question? Was I only able to see a distance of 70? Am I losing my mind?

(...)
Appreciate any help, suggestions, etc.

What you describe seems to be working as intended. If something if 200 units above you (exactly above you), then it still has a distance of 200, not a distance of zero as you seem to expect. So if you search using "range 70", you would NOT expect to find something that is 200 units above you.

That's why, if you search within a distance of 70, you can only find things that are at most 70 units above/below you.

If, in addition to searching in a distance of 70, you also search in a zradius of 200, then nothing changes: Anything having a distance of 70 of less must also have a zradius of 200 or less.

Think like this: [radius 70] already uses the third dimension, thus restricting the search to a radius 70 ball around you, not a radius 70 cylinder with infinite height.
Making sense?

(from my experience, I believe that it actually uses a radius 70 cube, as it uses Manhattan Distance instead of Euclidean. But that's a minor difference unrelated to the topic, and I might be wrong on this one. Please correct me if I'm wrong here.)
 
I appreciate the in depth responses and other folks helping to shine a light on what was causing me to experience what I was. Learned quite a bit from this. Thanks!