Unfortunately it is imperative that I get some sort of path finding working in this project. To that end, it looks like I am going to have to write my own...
Not real sure that is something that I am up to. We'll see how it goes.
Right now, I have the goat actor all set up in a region script. So for now, I plan to build my pathfinding into that script which handles all of the goats code. I have done some preliminary tests to try and gather some useful information while I walk around with my goat in tow. I am using the avoid script's variables where I can to see what it is that they tell me. Some of them don't seem to tell me anything.
(local
theMover // not real sure what this gives me, doesn't seem useful by itself
moverX // based off of theMover.. seems to reflect the target x
moverY// base off of theMover... seems to reflect the target y
theStatus // tells me if goat can be where it is
theStatus2 // tells me if goat can be where ego is
currentCtl // the current control color the goat is on
angle // the angle between where the goat is and the ego
)
Then in the handleEvent method so I can see my values.
= theMover (goat:mover)
= moverX (send theMover:x)
= moverY (send theMover:y)
= theStatus (goat:canBeHere((goat:x) (goat:y)))
= theStatus2 (goat:canBeHere(moverX moverY))
FormatPrint("The Mover: %d,\nmoverX: %d y: %d\nGoatX: %d y: %d\ncanBeHere: %d\ncanBeThere: %d" theMover moverX moverY (goat:x) (goat:y) theStatus theStatus2)
= currentCtl (goat:onControl())
= angle (ClampAngle(GetAngle((goat:x) (goat:y) moverX moverY) 360))
FormatPrint("Control: %d\nStopped: %d\nAngle: %d" currentCtl (goat:isStopped) angle)
and at the end of the script, a clampAngle procedure, copied straight from avoid
(procedure (ClampAngle param1 param2)
(= param1 (- param1 (* param2 (/ param1 param2))))
(if (< param1 0)
return (+ param1 param2)
)
return (param1)
)
Some things I have noticed so far. For 1, if the goat is hung up and still trying to walk, isStopped returns FALSE. As long as the goat is trying to move, it is not stopped. I need to figure out a way to check all points between where the goat is and where ego is because both of those values for canBeHere return true which makes sense because I'm checking where they are and they are in good spots or the game wouldn't let them be there. So those values tell me nothing.
I am thinking that in the end, I will probably drop the use follow from this script, and instead try to determine a path to the ego. Then I will set up a doit method with a setMotion dPath that leads to the ego around obstacles.
What I think the logic needs to be...
1. Get ego Posn.
2. Get goat Posn.
3. Determine angle between Posns.
4. Check path along angle
5. If can be here all along path, setmotion.
... this is where I am still pondering.
either get posn of first false and guess different directions to try and get there
try going a different direction left then down or whatever until I find a way through
but basicly I want to find a path before I setMotion.
15. if ego posn change, go to 1.