Follow along with the video below to see how to install our site as a web app on your home screen.
Note: This feature may not be available in some browsers.
/nav id ${Spawn[SomeSpawnName].ID}
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.
${Navigation.PathLength[${Spawn[${PullMob}].X} ${Spawn[${PullMob}].Y} ${Spawn[${PullMob}].Z}]}
search-foo is your friend.
You know somewhere i can read up on this ${Navigation.PathLength[X Y Z]}? The mq2nav wiki is light on the directions.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.
This is what we have on the PathLength member:
DataType:Navigation
Contains information about current mesh, path, velocity, and settings.www.redguides.com
-- 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}
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.> ${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}]}
/*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. 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;
}
Im just plagarizing what I see on other events and on the template, not sure if its right tbh, I'm not a real programmer :PWith 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.