How does setDesiredRangeTo work?
Posted: Thu Jan 18, 2007 5:32 pm
Range in...?
Inches?
Parsecs?
Whatever the game did it's last thing in?
Consider this
The ship is spawned close to the player (for testing purposes). It goes straight from GLOBAL to WAIT_FOR_PLAYER1 where it sends it's message straight away (being at the edge of the radar) and moves on to HEAD_FOR_CHECK_POINT_1 goes to the waypoint where it changes AI state to WAIT_FOR_PLAYER2, stops and waits for the player to get really close, before sending it's message (here for test purposes) and starting it's engines up again.
Why does it find the player at the edge of the radar in the first wait state but needs him to be very close in the second when the range is set to the same value in those two states?
Inches?
Parsecs?
Whatever the game did it's last thing in?
Consider this
Code: Select all
"WAIT_FOR_PLAYER2" = {
ENTER = ("setDesiredRangeTo: 250.0", "scanForNearestShipWithRole: player");
"TARGET_FOUND" = (setTargetToFoundTarget, "commsMessage: [oohaulheyho]", "setStateTo: HEAD_FOR_CHECK_POINT_2" );
"INCOMING_MISSILE" = (fireECM);
"NOTHING_FOUND" = ("setSpeedFactorTo: 0");
UPDATE = ("scanForNearestShipWithRole: player", "pauseAI: 10.0");
EXIT = ();
};
"HEAD_FOR_CHECK_POINT_1" = {
ENTER = ("setCoordinates: pwu 0 0 0.85", setDestinationFromCoordinates, "setDesiredRangeTo: 100.0", "setSpeedFactorTo: 5.0", checkCourseToDestination);
"COURSE_OK" = ("setSpeedFactorTo: 5.0", performFlyToRangeFromDestination);
"WAYPOINT_SET" = ("setAITo: gotoWaypointAI.plist");
"DESIRED_RANGE_ACHIEVED" = ("setStateTo: WAIT_FOR_PLAYER2");
"ATTACKED" = (performTumble);
"INCOMING_MISSILE" = (fireECM);
UPDATE = ("pauseAI: 10.0");
EXIT = ();
};
"WAIT_FOR_PLAYER1" = {
ENTER = ("setDesiredRangeTo: 250.0", "scanForNearestShipWithRole: player");
"TARGET_FOUND" = (setTargetToFoundTarget, "commsMessage: [oohaulheyho]", "setStateTo: HEAD_FOR_CHECK_POINT_1" );
"INCOMING_MISSILE" = (fireECM);
"NOTHING_FOUND" = ("setSpeedFactorTo: 0");
UPDATE = ("scanForNearestShipWithRole: player", "pauseAI: 10.0");
EXIT = ();
};
GLOBAL = {ENTER = ("setStateTo: WAIT_FOR_PLAYER1"); EXIT = (); UPDATE = (); };
}
Why does it find the player at the edge of the radar in the first wait state but needs him to be very close in the second when the range is set to the same value in those two states?