Understanding "pauseAI:"
Posted: Wed Feb 13, 2008 10:18 am
Request to the code wizards: Would one of you have the kindness to explain to me (once more, as parts of it have been explained in various contexts), how pauseAI: is exactly working?
As far as I have understood so far, it is like this: pauseAI: is only executed in the UPDATE-part of every AI-state. Therefore, if inserted into any other part, it won't behave as expected.
What I haven't yet understood is this:
As far as I have understood so far, it is like this: pauseAI: is only executed in the UPDATE-part of every AI-state. Therefore, if inserted into any other part, it won't behave as expected.
What I haven't yet understood is this:
- If there are other appearences of pauseAI: in other parts of an AI-state, will the engine remember them? And execute them as soon as it reaches the UPDATE-part?
- Will this be done cumulative? If e.g. the AI searches for the closest ship in range, and there is a pauseAI: 5.0 in the TARGET_FOUND-part, then tests for the found ship's legal status, and there is another pauseAI: 5.0 in the TARGET_OFFENDER-part, will the AI pause 10 seconds during the next UPDATE?
- What if the TARGET_OFFENDER-part sets the AI to another state, like ("pauseAI: 5.0", "setAITo: ATTACK_SHIP"). Will the 10-seconds-pause be transferred and executed in the UPDATE-part of the ATTACK_SHIP-state?
- What exactly does "pause" mean? Does the AI really pause, i.e. don't do anything, don't react to messages during that time? So what happens if I attack a NPC that just has entered into a pauseAI: 20.0-method? Will it defend itself only after 20 seconds?
- If this is not the case, and I assume it to be not the case, or else most of the NPCs would be lame ducks most of the time: which AI-messages do reach the AI during a pauseAI: and will therefore trigger an immediate response? Which AI-messages will not?
- In case of triggering an immediate response and therefore "waking up" the AI from its current pausing: What happens to the pausing time that is left at this very moment? Is it reset? Or is it somehow stored, so that (in the example above) the AI will pause for the remaining 18 or so seconds as soon as it reaches another UPDATE (or at any later time)?