Dear all
Thanks for the replies.
I tried spawning two ships with the same command, but it made no difference. So here's the AI - or, rather, the two main AIs.
Code: Select all
// ferdelance3-hunterAI
GLOBAL =
{
ENTER = ("setStateTo: HEAD_FOR_WITCHPOINT");
};
HEAD_FOR_PLANET =
{
ENTER = ();
UPDATE =
(
"sendScriptMessage: scanForTargets",
setCourseToPlanet, "setDesiredRangeTo: 50000.0", checkCourseToDestination,
"pauseAI: 3"
);
COURSE_OK = (setSpeedToCruiseSpeed, performFlyToRangeFromDestination);
WAYPOINT_SET = ("setAITo: gotoWaypointAI.plist");
AEGIS_CLOSE_TO_MAIN_PLANET = ("setStateTo: HEAD_FOR_WITCHPOINT");
DESIRED_RANGE_ACHIEVED = ("setStateTo: DECIDE_AT_WITCHPOINT");
ACCEPT_DISTRESS_CALL =
(
setTargetToFoundTarget,
"dropMessages: COURSE_OK,WAYPOINT_SET,DESIRED_RANGE_ACHIEVED",
"setAITo: ferdelance3-attackAI.plist"
);
OFFENCE_COMMITTED =
(
setTargetToFoundTarget,
"sendScriptMessage: considerAttackingOnOffence"
);
SUITABLE_TARGET_FOUND =
(
"dropMessages: COURSE_OK,WAYPOINT_SET,DESIRED_RANGE_ACHIEVED",
"setAITo: ferdelance3-interceptAI.plist"
);
NO_SUITABLE_TARGET_FOUND =
(
"dropMessages: COURSE_OK,WAYPOINT_SET,DESIRED_RANGE_ACHIEVED",
"setAITo: ferdelance3-checkForLootAI.plist"
);
NORMAL_RESPONSE_TO_MISSILE =
(
"dropMessages: COURSE_OK,WAYPOINT_SET,DESIRED_RANGE_ACHIEVED,SUITABLE_TARGET_FOUND",
fightOrFleeMissile, setTargetToPrimaryAggressor,
"setAITo: ferdelance3-attackAI.plist"
);
HAVE_CLOAKED_V_MISSILE = (performIdle);
ATTACKED =
(
"dropMessages: COURSE_OK,WAYPOINT_SET,DESIRED_RANGE_ACHIEVED,SUITABLE_TARGET_FOUND",
setTargetToPrimaryAggressor,
"setAITo: ferdelance3-attackAI.plist"
);
HOLD_FULL = ("setStateTo: DECIDE_HOLDFULL");
UPDATE = ();
RESTARTED = (checkAegis);
};
HEAD_FOR_WITCHPOINT =
{
ENTER = ();
COURSE_OK = (setSpeedToCruiseSpeed, performFlyToRangeFromDestination);
WAYPOINT_SET = ("setAITo: gotoWaypointAI.plist");
DESIRED_RANGE_ACHIEVED = ("setStateTo: HEAD_FOR_PLANET");
UPDATE =
(
"sendScriptMessage: scanForTargets",
setCourseToWitchpoint, checkCourseToDestination,
"pauseAI: 3"
);
ACCEPT_DISTRESS_CALL =
(
setTargetToFoundTarget,
"dropMessages: COURSE_OK,WAYPOINT_SET,DESIRED_RANGE_ACHIEVED",
"setAITo: ferdelance3-attackAI.plist"
);
OFFENCE_COMMITTED =
(
setTargetToFoundTarget, "sendScriptMessage: considerAttackingOnOffence"
);
SUITABLE_TARGET_FOUND =
(
"dropMessages: COURSE_OK", "dropMessages: WAYPOINT_SET,DESIRED_RANGE_ACHIEVED",
"setAITo: ferdelance3-interceptAI.plist"
);
NO_SUITABLE_TARGET_FOUND =
(
"dropMessages: COURSE_OK", "dropMessages: WAYPOINT_SET,DESIRED_RANGE_ACHIEVED",
"setAITo: ferdelance3-checkForLootAI.plist"
);
NORMAL_RESPONSE_TO_MISSILE =
(
"dropMessages: COURSE_OK", "dropMessages: WAYPOINT_SET", "dropMessages: DESIRED_RANGE_ACHIEVED,SUITABLE_TARGET_FOUND",
fightOrFleeMissile,
setTargetToPrimaryAggressor,
"setAITo: ferdelance3-attackAI.plist"
);
HAVE_CLOAKED_V_MISSILE = (performIdle);
ATTACKED =
(
"dropMessages: COURSE_OK,WAYPOINT_SET,DESIRED_RANGE_ACHIEVED,SUITABLE_TARGET_FOUND",
setTargetToPrimaryAggressor,
"setAITo: ferdelance3-attackAI.plist"
);
HOLD_FULL = ("setStateTo: DECIDE_HOLDFULL");
};
DECIDE_AT_WITCHPOINT =
{
ENTER = ("rollD: 10", "randomPauseAI: 1.5 5");
ROLL_1 = ("setStateTo: HEAD_FOR_PLANET");
ROLL_2 = ("setStateTo: HEAD_FOR_PLANET");
ROLL_3 = ("setStateTo: EXIT_SYSTEM");
ROLL_4 = ("setStateTo: LURK");
ACCEPT_DISTRESS_CALL =
(
setTargetToFoundTarget,
"setAITo: ferdelance3-attackAI.plist"
);
NORMAL_RESPONSE_TO_MISSILE =
(
fightOrFleeMissile,
setTargetToPrimaryAggressor,
"setAITo: ferdelance3-attackAI.plist"
);
HAVE_CLOAKED_V_MISSILE = (performIdle);
ATTACKED =
(
setTargetToPrimaryAggressor,
"setAITo: ferdelance3-attackAI.plist"
);
};
DECIDE_AT_PLANET =
{
ENTER = ("rollD: 10", "randomPauseAI: 1.5 5");
ROLL_1 = ("setStateTo: HEAD_FOR_WITCHPOINT");
ROLL_2 = ("setStateTo: HEAD_FOR_WITCHPOINT");
ROLL_3 = ("setStateTo: EXIT_SYSTEM");
ROLL_4 = ("setStateTo: LURK");
ROLL_5 = ("setAITo: ferdelance3-dockingAI.plist");
ROLL_6 = ("setAITo: ferdelance3-dockingAI.plist");
ACCEPT_DISTRESS_CALL =
(
setTargetToFoundTarget,
"setAITo: ferdelance3-attackAI.plist"
);
NORMAL_RESPONSE_TO_MISSILE =
(
fightOrFleeMissile,
setTargetToPrimaryAggressor,
"setAITo: ferdelance3-attackAI.plist"
);
HAVE_CLOAKED_V_MISSILE = (performIdle);
ATTACKED =
(
setTargetToPrimaryAggressor,
"setAITo: ferdelance3-attackAI.plist"
);
};
DECIDE_HOLDFULL =
{
ENTER = ("rollD: 10", "pauseAI: 2");
ROLL_1 = ("setStateTo: EXIT_SYSTEM");
UPDATE = (exitAI);
};
EXIT_SYSTEM =
{
ENTER = (performHyperSpaceExit);
UPDATE = (performHyperSpaceExit, "pauseAI: 1");
"WITCHSPACE OKAY" = (wormholeEscorts, wormholeGroup);
"WITCHSPACE BLOCKED" =
(
setTargetToFoundTarget, setDestinationWithinTarget, "setDesiredRangeTo: 10000.0", performFlyToRangeFromDestination
);
"WITCHSPACE UNAVAILABLE" = (exitAI);
NORMAL_RESPONSE_TO_MISSILE =
(
fightOrFleeMissile, setTargetToPrimaryAggressor,
"setAITo: ferdelance3-attackAI.plist"
);
HAVE_CLOAKED_V_MISSILE = (performIdle);
ATTACKED =
(
setTargetToPrimaryAggressor,
"setAITo: ferdelance3-attackAI.plist"
);
};
LURK =
{
ENTER = ("setSpeedTo: 0.0", performIdle);
UPDATE =
(
"rollD: 10",
"sendScriptMessage: scanForTargets",
"pauseAI: 5.0"
);
ROLL_1 = ("setStateTo: HEAD_FOR_PLANET");
ACCEPT_DISTRESS_CALL =
(
setTargetToFoundTarget,
"dropMessages: COURSE_OK,WAYPOINT_SET,DESIRED_RANGE_ACHIEVED",
"setAITo: ferdelance3-attackAI.plist"
);
OFFENCE_COMMITTED =
(
setTargetToFoundTarget,
"sendScriptMessage: considerAttackingOnOffence"
);
SUITABLE_TARGET_FOUND =
(
"dropMessages: COURSE_OK,WAYPOINT_SET,DESIRED_RANGE_ACHIEVED",
"setAITo: ferdelance3-interceptAI.plist"
);
NO_SUITABLE_TARGET_FOUND =
(
"dropMessages: COURSE_OK,WAYPOINT_SET,DESIRED_RANGE_ACHIEVED",
"setAITo: ferdelance3-checkForLootAI.plist"
);
NORMAL_RESPONSE_TO_MISSILE =
(
"dropMessages: COURSE_OK,WAYPOINT_SET,DESIRED_RANGE_ACHIEVED,SUITABLE_TARGET_FOUND",
fightOrFleeMissile, setTargetToPrimaryAggressor,
"setAITo: ferdelance3-attackAI.plist"
);
HAVE_CLOAKED_V_MISSILE = (performIdle);
ATTACKED =
(
"dropMessages: COURSE_OK,WAYPOINT_SET,DESIRED_RANGE_ACHIEVED,SUITABLE_TARGET_FOUND",
setTargetToPrimaryAggressor,
"setAITo: ferdelance3-attackAI.plist"
);
};
}
Code: Select all
{
// ferdelance3-attackAI - used by pirates and bounty hunters
GLOBAL =
{
ENTER =
(
"setStateTo: ATTACK_SHIP"
);
RESTARTED =
(
"setStateTo: ATTACK_SHIP"
);
};
ATTACK_SHIP =
{
ENTER =
(
"sendScriptMessage: cloakOff",
"sendScriptMessage: startTimerForConsideringCloakedAttacks",
groupAttackTarget,
performAttack
);
ATTACKED_BY_CLOAKED = ("setStateTo: SPECIAL_LURK");
DO_CLOAKED_ATTACK = ("setAITo: ferdelance3-cloakedAttackAI.plist");
ENERGY_LOW = ("setStateTo: FLEE");
FLEE_FROM_MINE = ("setStateTo: FLEE_FROM_MINE", "pauseAI: 0.5");
FRUSTRATED = (performAttack);
HAVE_CLOAKED_V_MISSILE = (performIdle);
HAVE_CLOAKED_V_MISSILE_STAGE2 =
(
setTargetToPrimaryAggressor,
performAttack,
groupAttackTarget
);
NORMAL_RESPONSE_TO_MISSILE =
(
fightOrFleeMissile,
setTargetToPrimaryAggressor,
performAttack,
groupAttackTarget
);
TARGET_CLOAKED = ("setStateTo: SPECIAL_LURK");
TARGET_LOST = ("exitAIWithMessage: TARGET_LOST");
TARGET_DESTROYED = ("exitAIWithMessage: TARGET_LOST");
EXIT = ("sendScriptMessage: stopTimerForConsideringCloakedAttacks");
};
SPECIAL_LURK =
{
ENTER =
(
"sendScriptMessage: stopTimerForConsideringCloakedAttacks",
"sendScriptMessage: cloakOn",
performFlee,
"pauseAI: 1"
);
UPDATE =
(
"pauseAI: 3",
"rollD: 10"
);
ROLL_1 =
(
"setSpeedTo: 0.0",
performIdle,
exitAI
);
ROLL_2 =
(
"setStateTo: FLEE"
);
ROLL_3 =
(
"setStateTo: FLEE"
);
TARGET_DECLOAKED = ("setStateTo: ATTACK_SHIP"); // script sets target
FLEE_FROM_MINE = ("setStateTo: FLEE_FROM_MINE", "pauseAI: 0.5");
ENERGY_LOW = ("setStateTo: FLEE");
HAVE_CLOAKED_V_MISSILE = ();
HAVE_CLOAKED_V_MISSILE_STAGE2 =
(
setTargetToPrimaryAggressor,
"setStateTo: ATTACK_SHIP"
);
NORMAL_RESPONSE_TO_MISSILE =
(
fightOrFleeMissile,
setTargetToPrimaryAggressor,
"setStateTo: ATTACK_SHIP"
);
ATTACKED =
(
setTargetToPrimaryAggressor,
"setStateTo: ATTACK_SHIP"
);
TARGET_DESTROYED = ("exitAIWithMessage: TARGET_LOST");
};
FLEE =
{
ENTER = ("sendScriptMessage: IfLowEnergyConsiderBeginningWitchspace", "setDesiredRangeTo: 25600", performFlee);
UPDATE = (); // I think that 'performFlee' does checkEnergy automatically
ATTACKED = (setTargetToPrimaryAggressor, "rollD: 10");
ROLL_1 = (fightOrFleeHostiles);
ROLL_2 = ("sendScriptMessage: ifLowEnergyConsiderBeginningWitchspace");
FIGHTING = (setTargetToPrimaryAggressor, "setStateTo: ATTACK_SHIP");
DESIRED_RANGE_ACHIEVED = ("setStateTo: RECOVER");
HAVE_CLOAKED_V_MISSILE = (performIdle, "rollD: 10");
ENERGY_FULL = ("setStateTo: LURK");
NORMAL_RESPONSE_TO_MISSILE = (fightOrFleeMissile, "rollD: 10");
REACHED_SAFETY = ("setStateTo: RECOVER");
TARGET_LOST = ("setStateTo: RECOVER");
EXIT_SYSTEM = ("setStateTo: EXIT_SYSTEM");
FLEE_FROM_MINE = ("setStateTo: FLEE_FROM_MINE", "pauseAI: 0.5");
HAVE_CLOAKED_V_MISSILE = (performIdle);
};
FLEE_FROM_MINE =
{
ENTER = (performFlee, "pauseAI: 2.5");
UPDATE = ("setStateTo: FLEE");
};
RECOVER =
{
ENTER = ("sendScriptMessage: cloakOff", "setSpeedTo: 0.0", performIdle);
UPDATE = (checkEnergy, "pauseAI: 5.0");
ATTACKED = (fightOrFleeHostiles);
FIGHTING = (setTargetToPrimaryAggressor, "setStateTo: ATTACK_SHIP");
FLEEING = ("setStateTo: FLEE");
ENERGY_FULL = (exitAI);
ENERGY_HIGH = (exitAI);
FLEE_FROM_MINE = ("setStateTo: FLEE_FROM_MINE", "pauseAI: 0.5");
HAVE_CLOAKED_V_MISSILE = (performIdle, setTargetToPrimaryAggressor, fightOrFleeHostiles);
NORMAL_RESPONSE_TO_MISSILE = (fightOrFleeMissile, setTargetToPrimaryAggressor, fightOrFleeHostiles);
};
// Next state called only by script
EXIT_SYSTEM =
{
ENTER = (performHyperSpaceExit);
"WITCHSPACE OKAY" = (wormholeEscorts, wormholeGroup);
"WITCHSPACE BLOCKED" = ("setStateTo: FLEE");
"WITCHSPACE UNAVAILABLE" = ("setStateTo: FLEE");
};
}
I should point out that the 'FLEE_FROM_MINE' message, and the various missile messages, are generated by an associated script - as are various other messages in the AIs.