AI-induced migraines ahoy!
Posted: Tue May 29, 2007 10:58 pm
Ohhhh....my head hurts. The last 2 days have been spent trying to get an apparently straightforward AI to work:
It should be simple - the ship scans for a "shipwreck" and flies towards it until it reaches a range of 350m and then explodes (for testing purposes). So how come the ship explodes immediately even tho its 10km away from the destination????
I know its picking up the "shipwreck" and will fly towards it correctly without the "DESIRED_RANGE_ACHIEVED" line.
I've also tried using the checkCourseToDestination method as used in other AIs but it seems the desired range achieved message is always received immediately, regardless of the actual range to destination. Having played around with every combination of methods I can think of I'm now kinda stumped
Code: Select all
ENTER = ("scanForNearestShipWithRole: shipwreck");
"TARGET_FOUND" = (setTargetToFoundTarget, setDestinationToTarget, "setSpeedFactorTo: 0.3", "setDesiredRangeTo: 350.0", performFlyToRangeFromDestination);
"NOTHING_FOUND" = ("setStateTo: WANDER");
"DESIRED_RANGE_ACHIEVED" = (becomeExplosion, "setStateTo: SCHOOL");
I know its picking up the "shipwreck" and will fly towards it correctly without the "DESIRED_RANGE_ACHIEVED" line.
I've also tried using the checkCourseToDestination method as used in other AIs but it seems the desired range achieved message is always received immediately, regardless of the actual range to destination. Having played around with every combination of methods I can think of I'm now kinda stumped