• 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 --->

Question - Nav between two objects (1 Viewer)

Myysterio

Myysterio
Joined
Jun 13, 2020
RedCents
1,751¢
trying to figure out the easiest way to make something which will nav between two objects, specifically to whatever one of the two is farther away. Either by button command or event. I still haven't figured out LEM yet.
 
Not sure I really understand the request.

What are these objects? Are they actual spawns? If so, you can just nav to the spawn with something like /nav id ${Spawn[SomeSpawnName].ID}

If it's not a spawn, the MrPatate probably has it best with waypoints.

What I don't understand is the bit about one being farther away.

Are you saying you want them to run back and forth between A and B? If so, you can setup a hotkey to go to each point and hit them as needed.

Or are you saying you want to start at C, and then nav to A or B depending on which one is farther? If that's the case, and it's not obvious which one is farther, you'll need some code to evaluate the distance.

Kind of need more context.
 
Not sure I really understand the request.

What are these objects? Are they actual spawns? If so, you can just nav to the spawn with something like /nav id ${Spawn[SomeSpawnName].ID}

If it's not a spawn, the MrPatate probably has it best with waypoints.

What I don't understand is the bit about one being farther away.

Are you saying you want them to run back and forth between A and B? If so, you can setup a hotkey to go to each point and hit them as needed.

Or are you saying you want to start at C, and then nav to A or B depending on which one is farther? If that's the case, and it's not obvious which one is farther, you'll need some code to evaluate the distance.

Kind of need more context.

I want one command that goes to the farthest away of two nav points. If point A is farther away, then go to A. if B is farther away go to B.

${Navigation.PathLength[${Spawn[${PullMob}].X} ${Spawn[${PullMob}].Y} ${Spawn[${PullMob}].Z}]}

search-foo is your friend.

How do you turn this into a command? Like one you can put on a button or an event? I realize its not correct, just not well versed with conditionals in MQ.

/if (${Navigation.PathLength[id ${campfire/point a/mob a]} < ${banner/point b/mob b]}) then /nav spawn /point a/mob a], else /nav spawn /point a/mob a]
 
Need the location of the two points.

then you can use ${Navigation.PathLength[X Y Z]} to determine your distance between you and the location by travel path. Then you can use it for both points. Then you can determine which of the two paths has a greater distance to decide which one to travel to using an if/else statement, if one is greater than the other, go to that location, else go to the other location.
 
Need the location of the two points.

then you can use ${Navigation.PathLength[X Y Z]} to determine your distance between you and the location by travel path. Then you can use it for both points. Then you can determine which of the two paths has a greater distance to decide which one to travel to using an if/else statement, if one is greater than the other, go to that location, else go to the other location.
You know somewhere i can read up on this ${Navigation.PathLength[X Y Z]}? The mq2nav wiki is light on the directions.

I am assuming you have to do something like

if ${Navigation.PathLength[Object A X Y Z]} > ${Navigation.PathLength[Object B X Y Z]} then nav spawn (a) else nav spawn (B)
 
Last edited:
This is what we have on the PathLength member:


I'm sure there's gotta be something wrong here, I am just starting to play with this language. Like I dont know when to declare the nav distance to keep it refreshing everytime the event is called. I also don't know what the %s and %d mean in the template. I got more looking up to do.


INI:
-- location to run to
local run_away_dist1 = ${Navigation.PathLength[${Spawn[${"Fellowship Campfire"}].X} ${Spawn[${"Fellowship Campfire"}].Y} ${Spawn[${"Fellowship Campfire"}].Z}]}

local run_away_dist2 =${Navigation.PathLength[${Spawn[${"Guild Banner"}].X} ${Spawn[${"Guild Banner"}].Y} ${Spawn[${"Guild Banner"}].Z}]}

-- delay before returning to the group (10 is ~1 second)
local return_delay = 10

local function stopthings()
    mq.cmdf('/%s mode 0', my_class)
    mq.cmd('/mqp on')
    mq.cmd('/twist off')
    mq.cmd('/timed 5 /afollow off')
    mq.cmd('/nav stop')
    mq.cmd('/target clear')
    mq.cmd('/stopcast')
end

local function startthings()
    mq.cmdf('/timed %d /%s mode 3', return_delay, my_class)
    mq.cmd('/timed 30 /mqp off')
    mq.cmd('/timed 30 /twist on')
    mq.cmd('/switchnow')
end

local function run_campfire()
    local my_class = mq.TLO.Me.Class.ShortName()
    
    -- pause all the things
   stopthings()

    -- run away
    mq.cmd('/timed 10 /nav spawn "Fellowship Campfire"|dist=15)

    -- resume all the things
   startthings()

end

local function run_banner()
    local my_class = mq.TLO.Me.Class.ShortName()
    
    -- pause all the things
    stopthings()

    -- run away
    mq.cmd('/timed 10 /nav spawn "Guild Banner"|dist=15)
  
     -- resume all the things
    stopthings()

end

local function event_handler(line, target)
    
    if not ${Navigation.MeshLoaded} then
          mq.cmd('/rs No Mesh Loaded')
    End

    if  run_away_dist1() > run_away_dist2()
          run_campfire()
    Else
          run_banner()
    End

end

return {eventfunc=event_handler}
 
> ${Navigation.PathLength[${Spawn[${"Fellowship Campfire"}].X} ${Spawn[${"Fellowship Campfire"}].Y} ${Spawn[${"Fellowship Campfire"}].Z}]}

If you have a spawn, then just check the spawn.

${Navigation.PathLength[spawn id ${Spawn.ID}]}
 
> ${Navigation.PathLength[${Spawn[${"Fellowship Campfire"}].X} ${Spawn[${"Fellowship Campfire"}].Y} ${Spawn[${"Fellowship Campfire"}].Z}]}

If you have a spawn, then just check the spawn.

${Navigation.PathLength[spawn id ${Spawn.ID}]}
How do you pull the spawn.ID of the campfire or banner? They change if they're replanted. Just spent 50 minutes looking for an example and didn't see one.
 
Based on what you're doing I would think you were trying to use the ${Spawn} TLO to search for the fellowship campfire by name, which would appear on the map using MQ2Map, so you'd possibly be able to search for it that way.

Alternately you could also use one of the below fellowship members to gather the information desired. Such as using the X Y Z location of the campfire in the manner I mentioned. I've highlighted what I think might be relevant to your situation in the code block at the bottom.

I don't see a fellowship member for the campfire that gets the spawn's info directly. There is one for Fellowship.Campfire that appears to be a bool type, so only returns true if the spawn exists. So you could use something like /if (${Fellowship.Campfire}) to determine if there is already a campfire, and if there is, use a block to determine what to do once you've verified it exists. Such as calculating distance.

I'm unsure regarding the guild banner. /*0x2d8*/ GuildBanner Banner; There is a Banner member of the GuildBanner type in the GuildBase object. But, doing a "Find all references" results in nothing found but the initial entry. Perhaps I'm searching it wrong. That said, it's plausible there's never been a need to look for that directly. You could try searching for the guild banner with a spawn search, using Banner as the race. Then using that to get the ID, or again using the location to get the distance.

With all that said I don't speak Lua, but I also think you're currently mixing macro code with Lua and the two aren't interchangeable.

Fellowship Members:
    switch (static_cast<FellowshipTypeMembers>(pMember->ID))
    {
    case FellowshipTypeMembers::ID:
        Dest.DWord = pFellowship->FellowshipID;
        Dest.Type = pIntType;
        return true;

    case FellowshipTypeMembers::Leader:
        strcpy_s(DataTypeTemp, pFellowship->Leader);
        Dest.Ptr = &DataTypeTemp[0];
        Dest.Type = pStringType;
        return true;

    case FellowshipTypeMembers::MotD:
        strcpy_s(DataTypeTemp, pFellowship->MotD);
        Dest.Ptr = &DataTypeTemp[0];
        Dest.Type = pStringType;
        return true;

    case FellowshipTypeMembers::Members:
        Dest.DWord = pFellowship->Members;
        Dest.Type = pIntType;
        return true;

    case FellowshipTypeMembers::Member:
        Dest.Type = pFellowshipMemberType;
        if (Index[0])
        {
            if (IsNumber(Index))
            {
                int i = GetIntFromString(Index, 0) - 1;
                if (i < 0 || i >= pFellowship->Members)
                    return false;

                Dest.Ptr = &pFellowship->FellowshipMember[i];
                return true;
            }
            else
            {
                for (int i = 0; i < pFellowship->Members; i++)
                {
                    if (ci_equals(pFellowship->FellowshipMember[i].Name, Index))
                    {
                        Dest.Ptr = &pFellowship->FellowshipMember[i];
                        return true;
                    }
                }
            }
        }
        return false;

    case FellowshipTypeMembers::CampfireDuration:
        Dest.DWord = 0;
        Dest.Type = pTicksType;
        if (pMySpawn->CampfireTimestamp)
        {
            Dest.DWord = (pMySpawn->CampfireTimestamp - GetFastTime()) / 6;
            return true;
        }
        return false;

    case FellowshipTypeMembers::CampfireY:
        Dest.Float = pMySpawn->CampfireY;
        Dest.Type = pFloatType;
        return true;
    case FellowshipTypeMembers::CampfireX:
        Dest.Float = pMySpawn->CampfireX;
        Dest.Type = pFloatType;
        return true;

    case FellowshipTypeMembers::CampfireZ:
        Dest.Float = pMySpawn->CampfireZ;
        Dest.Type = pFloatType;
        return true;

    case FellowshipTypeMembers::CampfireZone:
        Dest.Type = pZoneType;
        if (int zoneID = (pMySpawn->CampfireZoneID & 0x7FFF))
        {
            if (zoneID < MAX_ZONES && pWorldData)
            {
                Dest.Ptr = pWorldData->ZoneArray[zoneID];
                return true;
            }
        }
        return false;

    case FellowshipTypeMembers::Campfire:
        Dest.Set(pMySpawn->Campfire);
        Dest.Type = pBoolType;
        return true;

    case FellowshipTypeMembers::Sharing:
        if (Index[0] && IsNumber(Index))
        {
            int nMember = GetIntFromString(Index, 0) - 1;
            if (nMember < 0) nMember = 0;

            if (nMember > pFellowship->Members)
                return false;

            Dest.Set(pFellowship->bExpSharingEnabled[nMember]);
            Dest.Type = pBoolType;
            return true;
        }
        return false;

    default: break;
    }

    return false;
}
 
Question - Nav between two objects

Users who are viewing this thread

Back
Top