These good news also mean you can also do
Code: Select all
shipToTrack=system.addShipsToRoute('trader',1,0,'wp')
Moderators: winston, another_commander
Code: Select all
shipToTrack=system.addShipsToRoute('trader',1,0,'wp')
Code: Select all
"HEAD_FOR_WITCHPOINT" =
{
ENTER = (setCourseToWitchpoint, checkCourseToDestination);
"COURSE_OK" = ("commsMessage: Heading for Witchpoint!", setSpeedToCruiseSpeed, performFlyToRangeFromDestination);
"WAYPOINT_SET" = ("setAITo: gotoWaypointAI.plist");
"DOCKING_REQUESTED" = ("setAITo: receiveDockingAI.plist");
"DESIRED_RANGE_ACHIEVED" = ("commsMessage: Heading to Planet", "setStateTo: HEAD_FOR_PLANET");
"ACCEPT_DISTRESS_CALL" = (setTargetToFoundTarget, deployEscorts, groupAttackTarget);
"OFFENCE_COMMITTED" = (setTargetToFoundTarget, "markTargetForOffence: 7", deployEscorts, groupAttackTarget);
"TARGET_FOUND" = (setTargetToFoundTarget, deployEscorts, groupAttackTarget);
"NOTHING_FOUND" = ("setStateTo: OUTBOUND_LOOT"); // ADDED!
"INCOMING_MISSILE" = (fightOrFleeMissile, setTargetToPrimaryAggressor, deployEscorts, groupAttackTarget);
ATTACKED = (setTargetToPrimaryAggressor, groupAttackTarget);
"GROUP_ATTACK_TARGET" = (setTargetToFoundTarget, "setAITo: interceptAI.plist");
RESTARTED = (checkAegis);
UPDATE = (setCourseToWitchpoint, checkCourseToDestination, scanForOffenders, "pauseAI: 10.0");
};
"OUTBOUND_LOOT" =
{
"GROUP_ATTACK_TARGET" = (setTargetToFoundTarget, "setAITo: interceptAI.plist");
"DOCKING_REQUESTED" = ("setSpeedFactorTo: 0.0", "setAITo: receivingDockingAI.plist");
ATTACKED = (setTargetToPrimaryAggressor, groupAttackTarget);
"INCOMING_MISSILE" = (fightOrFleeMissile, setTargetToPrimaryAggressor, deployEscorts, groupAttackTarget);
"TARGET_FOUND" = ("commsMessage: Scooping Escape pod!", setTargetToFoundTarget, "setAITo: collectLootAI.plist");
"NOTHING_FOUND" = ("setStateTo: HEAD_FOR_WITCHPOINT"); // Changed!
UPDATE = (scanForLoot, "pauseAI: 10.0");
};
Ah...yeah. Seems shipdata.plist confirms that too.Ahruman wrote:Vipers don’t have fuel scoops by default.
I'm probably not the best person to help here...my understanding of AIs is extremely limited. My guess is that in the first one, it's scanning for loot then pausing, and in the second scanning for loot after a pause. I don't know what would happen in the first case if it actually finds any loot, but I do know that often the scanForLoot is nothing to do with loot but acts as a sort of re-set. McLane did explain this to me once, but I still don't really get it.Switeck wrote:What's the difference then between this:
UPDATE = (scanForLoot, "pauseAI: 10.0");
and this:
UPDATE = ("pauseAI: 10.0", scanForLoot);
...I'm a little unsure how the state engine handles pauses, either delaying other actions or repeat of the same action. (Such as 2 instances of UPDATE can be running at once?)
I hope this is some help, or at least gives some insight.That structure is very clever but one only start to understand it when knowing exact how the AI works. Giles added it with 1.65. The reason is that in 1.65 Giles added a second "setAITo: " command to that state. (gotoWayPointAI and interceptAI) However, both need a different reaction when returning. A simple "RESTARTED" was not enough. So, the only function of "setStateTo: OUTBOUND_LOOT" is to force the AI into a different state so it will return there when returning from the interceptAI. groupAttackTarget sets the ship into an interceptAI through the related GROUP_ATTACK_TARGET reactToMessage.
I actually found it strange that it only would scan for loot after a missile attack and not just after a plain attack. Its already hardcoded that scanclass police can only find pods with slaves in it so police will never go for any cargo. And most police have no scoop or cargobay in the first place.
Nothing, unless the NOTHING_FOUND/TARGET_FOUND/HOLD_FULL handlers call pauseAI:. All pauseAI: does is specify when the next UPDATE event is sent (along with any queued events). It doesn’t pause the current handler.Switeck wrote:What's the difference then between this:
UPDATE = (scanForLoot, "pauseAI: 10.0");
and this:
UPDATE = ("pauseAI: 10.0", scanForLoot);
To be fair and give credit where credit is due, the explanation is not from me, but was given to me by Eric. I just copied it wholesale for you.Smivs wrote:McLane did explain this to me once
Eric Walch wrote:That structure is very clever but one only start to understand it when knowing exact how the AI works. Giles added it with 1.65. The reason is that in 1.65 Giles added a second "setAITo: " command to that state. (gotoWayPointAI and interceptAI) However, both need a different reaction when returning. A simple "RESTARTED" was not enough. So, the only function of "setStateTo: OUTBOUND_LOOT" is to force the AI into a different state so it will return there when returning from the interceptAI. groupAttackTarget sets the ship into an interceptAI through the related GROUP_ATTACK_TARGET reactToMessage.
I actually found it strange that it only would scan for loot after a missile attack and not just after a plain attack. Its already hardcoded that scanclass police can only find pods with slaves in it so police will never go for any cargo. And most police have no scoop or cargobay in the first place.