OgreNav_Lib Question

user01

Member
I've been banging my head against this all day, but haven't been able to get it to work. I've tried looking for similar implementations, or other methods that may be more appropriate. Am I missing something?

Goal: During auto-hunt, regularly check that no groupmembers have fallen behind. If any have fallen behind, go back to their current position so that they will continue following me.

Steps:
1) Regularly check that no groupmembers have fallen behind (Achieved, see code snippet below)
2) Re-route to that member's current location (Mixed results)
-when I use OgrePath the tank will clearly change his pathing behavior (bot changes direction, but seems to just run in one direction (does not seem to be facing towards the member in question) - No errors thrown.
-when I use MoveToLoc, I can't tell for sure but it seems like the bot changes it's destination to the first location in the loop and then continues pathing as normal - No errors thrown.

Also, I know the hard-coded index is cringe-worthy. It bothers me too.
Code:
if ${NoManLeftBehindInvoked}
{
    ;//Already going back.
    if ${Me.Group[1].ToActor.Distance} < 15 &&${Me.Group[2].ToActor.Distance} < 15 &&${Me.Group[3].ToActor.Distance} < 15 &&${Me.Group[4].ToActor.Distance} < 15 &&${Me.Group[5].ToActor.Distance} < 15
    {
         ;// successfully returned.  may need to set new loc? Or maybe itll do it automatically?
        NoManLeftBehindInvoked:Set[FALSE]
        echo arrived!
    }
}
elseif ${Me.Group[1].ToActor.Distance} > 40
{
    echo moving back to catch ${Me.Group[1].Name}
    ;Nav:OgrePath[${Me.Group[1].ToActor.X},${Me.Group[1].ToActor.Y},${Me.Group[1].ToActor.Z}]
    Nav:MoveToLoc[${Me.Group[1].ToActor.X},${Me.Group[1].ToActor.Y},${Me.Group[1].ToActor.Z}]
    NoManLeftBehindInvoked:Set[TRUE]
}
elseif ${Me.Group[2].ToActor.Distance} > 40
{
    echo moving back to catch ${Me.Group[2].Name}
    ;Nav:OgrePath[${Me.Group[2].ToActor.X},${Me.Group[2].ToActor.Y},${Me.Group[2].ToActor.Z}]
    Nav:MoveToLoc[${Me.Group[2].ToActor.X},${Me.Group[2].ToActor.Y},${Me.Group[2].ToActor.Z}]
    NoManLeftBehindInvoked:Set[TRUE]
}
elseif ${Me.Group[3].ToActor.Distance} > 40
{
    echo moving back to catch ${Me.Group[3].Name}
    ;Nav:OgrePath[${Me.Group[3].ToActor.X},${Me.Group[3].ToActor.Y},${Me.Group[3].ToActor.Z}]
    Nav:MoveToLoc[${Me.Group[3].ToActor.X},${Me.Group[3].ToActor.Y},${Me.Group[3].ToActor.Z}]
    NoManLeftBehindInvoked:Set[TRUE]
}
elseif ${Me.Group[4].ToActor.Distance} > 40
{
    echo moving back to catch ${Me.Group[4].Name}
    ;Nav:OgrePath[${Me.Group[4].ToActor.X},${Me.Group[4].ToActor.Y},${Me.Group[4].ToActor.Z}]
    Nav:MoveToLoc[${Me.Group[4].ToActor.X},${Me.Group[4].ToActor.Y},${Me.Group[4].ToActor.Z}]
    NoManLeftBehindInvoked:Set[TRUE]
}
elseif ${Me.Group[5].ToActor.Distance} > 40
{
    echo moving back to catch ${Me.Group[5].Name}
    ;Nav:OgrePath[${Me.Group[5].ToActor.X},${Me.Group[5].ToActor.Y},${Me.Group[5].ToActor.Z}]
    Nav:MoveToLoc[${Me.Group[5].ToActor.X},${Me.Group[5].ToActor.Y},${Me.Group[5].ToActor.Z}]
    NoManLeftBehindInvoked:Set[TRUE]
}
 
Top Bottom