A little workaround for off the grid errors with MQ2Nav. If, for instance, you are standing in a non-mapped region, or the NPC or target is off the grid, this tries to move you back onto the mesh or find a position CLOSE to the target that is on the mesh.
It's not perfect, but just giving some ideas I've been working on. I basically replaced all "/nav id" or "/nav target" calls by the puller to the target in kissassist with:
/call MQ2NavFix X Y Z
XYZ is the location or NPC you want to Nav to. The snippets will try to get you back on the mesh, and/or find a position closer to the NPC that is on the mesh. Can be more sophisticated for the Target than I've coded right now, but it's a start...
Joojoobee (JJB)
ps-- I was looking at MQ2Nav code last couple of days and I think I can add a couple of calls (.TargetOnMesh or .MeOnMesh) that might make this easier than the code I am using here. We'll see if I understand Brainiacs code well enough to mess with that.
It's not perfect, but just giving some ideas I've been working on. I basically replaced all "/nav id" or "/nav target" calls by the puller to the target in kissassist with:
/call MQ2NavFix X Y Z
XYZ is the location or NPC you want to Nav to. The snippets will try to get you back on the mesh, and/or find a position closer to the NPC that is on the mesh. Can be more sophisticated for the Target than I've coded right now, but it's a start...
Joojoobee (JJB)
ps-- I was looking at MQ2Nav code last couple of days and I think I can add a couple of calls (.TargetOnMesh or .MeOnMesh) that might make this easier than the code I am using here. We'll see if I understand Brainiacs code well enough to mess with that.
Rich (BB code):
|: --------------------------------------------------------------------------------------------
|: SUB: MQ2NavFix
|: --------------------------------------------------------------------------------------------
Sub MQ2NavFix(float Xcheck, float Ycheck, float Zcheck)
|: Check to see if can move
|: Is it destination or starting problem?
|: if starting position is wrong, try to /circle out of it (I found MoveTo to be problematic, but /circle worked great. Could me made more sophisticated...
|: Need a version that if close to
/echo Entering NavFix
|: Checks if my start position is off the grid. Do do this, looks 0.5 in every direction and sees if it can move there.
|: If off grid, try to move until on the grid. Use ${Navigation.PathExists[target]} as the boolean for getting to the grid.
/call checkMeMQ2Nav
|: Look for places NEAR the target that are on grid. Need eventually a check for whether that position is on the other side of a wall or something, but for now this is a start.
/call checkMQ2Nav ${Xcheck} ${Ycheck} ${Zcheck}
/return
|: --------------------------------------------------------------------------------------------
|: SUB: checkMeMQ2Nav
|: --------------------------------------------------------------------------------------------
sub checkMeMQ2Nav
/declare circleTimer timer local 0
/declare moveDist int local 0.5
/
/varset circleTimer 3s
/if (${Navigation.PathExists[locxyz ${Math.Calc[${Me.X}+${moveDist}]} ${Me.Y} ${Me.Z}]} && ${Navigation.PathExists[locxyz ${Math.Calc[${Me.X}-${moveDist}]} ${Me.Y} ${Me.Z}]} && ${Navigation.PathExists[locxyz ${Me.X} ${Math.Calc[${Me.Y}+${moveDist}]} ${Me.Z}]} && ${Navigation.PathExists[locxyz ${Me.X} ${Math.Calc[${Me.Y}-${moveDist}]} ${Me.Z}]}) {
/return
} else {
/circle on 6
/echo circling
/while (!${Navigation.PathExists[target]}) {
/delay 5
/if (${circleTimer}==0) {
/echo backwards
/circle backward
/varset circleTimer 3s
}
}
/circle off
}
/return
|: --------------------------------------------------------------------------------------------
|: SUB: checkMQ2Nav
|: --------------------------------------------------------------------------------------------
sub checkMQ2Nav(float Xcheck, float Ycheck, float Zcheck)
/declare xNew float local ${Xcheck}
/declare yNew float local ${Ycheck}
/declare moveDist int local 2
/declare moveLess float local ${Math.Calc[${moveDist}+0.5]}
/if (!${Navigation.PathExists[locxyz ${Xcheck} ${Ycheck} ${Zcheck}]}) {
/if (${Navigation.PathExists[locxyz ${Math.Calc[${Xcheck}+${moveDist}]} ${Ycheck} ${Zcheck}]}) {
/varset xNew ${Math.Calc[${Xcheck}+${moveDist}]}
/echo xNew + ${moveDist}
} else /if (${Navigation.PathExists[locxyz ${Math.Calc[${Xcheck}-${moveDist}]} ${Ycheck} ${Zcheck}]} ) {
/varset xNew ${Math.Calc[${Xcheck}-${moveDist}]}
/echo xNew - ${moveDist}
} else /if (${Navigation.PathExists[locxyz ${Xcheck} ${Math.Calc[${Ycheck}+${moveDist}]} ${Zcheck}]} ) {
/varset yNew ${Math.Calc[${Ycheck}+${moveDist}]}
/echo yNew + ${moveDist}
} else /if (${Navigation.PathExists[locxyz ${Xcheck} ${Math.Calc[${Ycheck}-${moveDist}]} ${Zcheck}]} ) {
/varset yNew ${Math.Calc[${Ycheck}-${moveDist}]}
/echo yNew - ${moveDist}
}
}
/squelch /nav locxyz ${xNew} ${yNew} ${Zcheck}
/return
Last edited:


