CAPX: sugarsync.com/pf/D6025908_4317202_6992586
=== PLEASE SKIP DOWN BELOW TO THE UPDATE ===
Starting at line 3 on the "ES Enemy" event sheet, I'm attempting to set up conditions that tell the Enemy instance to find the nearest PatrolNode within the NodeZone (so that it doesn't try to find a Node outside the proper patrol zone even if that other Node is closer) and then follow the patrol routes I've defined.
The enemy will go through a series of statuses:
1. Normal - within each NodeZone, follow the patrol routes setup by the PatrolNodes within that zone.
2. Chase - the enemy will chase the player...
3. Alert - the enemy will randomly search for the player within a range from the last point it saw the player.
4. Resume - Return the the enemy's assign NodeZone and resume the patrol as defined by the Nodes in that zone.
But at present all I can get to work is the chase, alert, and resume statuses. The enemy will not even select a Node to seek out. Can anyone see what I'm missing?
===========================================================
UPDATE: Related issue but not quite the same as before.
In the "ES Enemy" event sheet, line 12, I'm trying to pick those patrol nodes that are within a particular zone.
The enemy and the nodes are assigned the zone's IID - it's "home base". This way, after a chase, it can return to its original patrol area and not just any patrol path.
So, after a chase...
- Pick all patrol nodes which have an HomeZone instance variable value equal to the HomeZone instance variable value of the enemy.
-- From those patrol nodes that are picked, further pick the nearest one to the enemy.
-- Find path.
Everything works up to event line 12. But for some reason the enemy will not return to the node it's closest to within its own zone.
Also check out the "ES Setup" event sheet, lines 4 and 5. That's where I assigned the IID of each patrol zone to the HomeZone variables.