Re: Information desired!
Posted: Fri Jul 12, 2024 8:22 am
It's all based on BCC. And that was probably based on ideas in older BB threads (2007-11) - see wiki page for links.
For information and discussion about Oolite.
https://bb.oolite.space/
It's all based on BCC. And that was probably based on ideas in older BB threads (2007-11) - see wiki page for links.
Code: Select all
{
GLOBAL = {
ENTER = "setState: CLOSE_WITH_PLAYER";
};
"CLOSE_WITH_PLAYER" = {
ENTER = ("scanForNearestShipWithRole: player")
"TARGET_FOUND" = (setTargetToFoundTarget, setDestinationToTarget, "setDesiredRangeTo: 1000.0" checkCourseToDestination);
"COURSE_OK" = ("setSpeedFactorTo: 1.0", performFlyToRangeFromDestination);
"WAYPOINT_SET" = ("setAITo: gotoWaypointAI.plist");
"ATTACKED" = (setTargetToPrimaryAggressor, "setStateTo: ATTACK_SHIP");
"ATTACKER_MISSED" = (setTargetToPrimaryAggressor, "setStateTo: ATTACK_SHIP");
"INCOMING_MISSILE" = (fightOrFleeMissile, setTargetToFoundTarget, "setStateTo: ATTACK_SHIP");
"DESIRED_RANGE_ACHIEVED" = (setState: MOVE_AWAY_FROM_PLAYER);
"CASCADE_WEAPON_DETECTED" = ("setAITo: fleeQMineAI.plist");
UPDATE = (performFlyToRangeFromDestination);
};
"MOVE_AWAY_FROM_PLAYER" = {
ENTER = ("scanForNearestShipWithRole: player")
"TARGET_FOUND" = (setTargetToFoundTarget, setDestinationToTarget, "setDesiredRangeTo: 1000.0", checkCourseToDestination);
"COURSE_OK" = ("setSpeedFactorTo: 1.0", performFlyToRangeFromDestination);
"WAYPOINT_SET" = ("setAITo: gotoWaypointAI.plist");
"ATTACKED" = (setTargetToPrimaryAggressor, "setStateTo: ATTACK_SHIP");
"ATTACKER_MISSED" = (setTargetToPrimaryAggressor, "setStateTo: ATTACK_SHIP");
"INCOMING_MISSILE" = (fightOrFleeMissile, setTargetToFoundTarget, "setStateTo: ATTACK_SHIP");
"DESIRED_RANGE_ACHIEVED" = (setState: CLOSE_WITH_PLAYER);
"CASCADE_WEAPON_DETECTED" = ("setAITo: fleeQMineAI.plist");
UPDATE = (performFlyToRangeFromDestination);
};
"ATTACK_SHIP" = {
ENTER = (setTargetToPrimaryAggressor, performAttack);
"FRIENDLY_FIRE" = ("setStateTo: BREAK_OFF");
"ATTACKED" = (setTargetToPrimaryAggressor, performAttack);
"INCOMING_MISSILE" = (fightOrFleeMissile, setTargetToFoundTarget, performAttack);
"CASCADE_WEAPON_DETECTED" = ("setAITo: fleeQMineAI.plist");
"TARGET_DESTROYED" = (performIdle, "setStateTo: DECIDE_ROUTE");
"TARGET_LOST" = (performIdle, "setStateTo: DECIDE_ROUTE");
"NO_TARGET" = (performIdle, "setStateTo: DECIDE_ROUTE");
"CASCADE_WEAPON_DETECTED" = ("setAITo: fleeQMineAI.plist");
"FRUSTRATED" = (performAttack);
};
}
You're not looking for a missing semi-colon; you're looking for a missing comma. The semi-colon is an end-of-line marker; when parsing fails, the error message assumes you finished one line and began another line, forgetting the semi-colon. But that's just the error message, based on it being a common error back in the olden days.Cholmondely wrote: ↑Mon Jul 22, 2024 4:22 pmSo I replaced Murgh's AI.plist with Littlebear's.
Littlebear's AI.plist is giving my AppleMac a major case of indigestion - and I've no idea as to what is up.
"Atom" flags up the following as problematic
"TARGET_FOUND" = (setTargetToFoundTarget, setDestinationToTarget, "setDesiredRangeTo: 1000.0" checkCourseToDestination);
- and my AppleMac parser says "Old-style plist parser: missing semicolon in dictionary"
I have no idea as to where a semi-colon should go... nor have I any idea about the other issue
Unexpected character { at line 1
Code: Select all
{
GLOBAL = {
ENTER = "setStateTo: CLOSE_WITH_PLAYER";
};
"CLOSE_WITH_PLAYER" = {
ENTER = ("scanForNearestShipWithRole: player");
"TARGET_FOUND" = (setTargetToFoundTarget, setDestinationToTarget, "setDesiredRangeTo: 1000.0", checkCourseToDestination); // Old-style plist parser: missing semicolon in dictionary on line 12.
"COURSE_OK" = ("setSpeedFactorTo: 1.0", performFlyToRangeFromDestination);
"WAYPOINT_SET" = ("setAITo: gotoWaypointAI.plist");
"ATTACKED" = (setTargetToPrimaryAggressor, "setStateTo: ATTACK_SHIP");
"ATTACKER_MISSED" = (setTargetToPrimaryAggressor, "setStateTo: ATTACK_SHIP");
"INCOMING_MISSILE" = (fightOrFleeMissile, setTargetToFoundTarget, "setStateTo: ATTACK_SHIP");
"DESIRED_RANGE_ACHIEVED" = ("setStateTo: MOVE_AWAY_FROM_PLAYER");
"CASCADE_WEAPON_DETECTED" = ("setAITo: fleeQMineAI.plist");
UPDATE = (performFlyToRangeFromDestination);
};
"MOVE_AWAY_FROM_PLAYER" = {
ENTER = ("scanForNearestShipWithRole: player");
"TARGET_FOUND" = (setTargetToFoundTarget, setDestinationToTarget, "setDesiredRangeTo: 1000.0", checkCourseToDestination);
"COURSE_OK" = ("setSpeedFactorTo: 1.0", performFlyToRangeFromDestination);
"WAYPOINT_SET" = ("setAITo: gotoWaypointAI.plist");
"ATTACKED" = (setTargetToPrimaryAggressor, "setStateTo: ATTACK_SHIP");
"ATTACKER_MISSED" = (setTargetToPrimaryAggressor, "setStateTo: ATTACK_SHIP");
"INCOMING_MISSILE" = (fightOrFleeMissile, setTargetToFoundTarget, "setStateTo: ATTACK_SHIP");
"DESIRED_RANGE_ACHIEVED" = ("setStateTo: CLOSE_WITH_PLAYER");
"CASCADE_WEAPON_DETECTED" = ("setAITo: fleeQMineAI.plist");
UPDATE = (performFlyToRangeFromDestination);
};
"ATTACK_SHIP" = {
ENTER = (setTargetToPrimaryAggressor, performAttack);
"FRIENDLY_FIRE" = ("setStateTo: BREAK_OFF");
"ATTACKED" = (setTargetToPrimaryAggressor, performAttack);
"INCOMING_MISSILE" = (fightOrFleeMissile, setTargetToFoundTarget, performAttack);
"CASCADE_WEAPON_DETECTED" = ("setAITo: fleeQMineAI.plist");
"TARGET_DESTROYED" = (performIdle, "setStateTo: DECIDE_ROUTE");
"TARGET_LOST" = (performIdle, "setStateTo: DECIDE_ROUTE");
"NO_TARGET" = (performIdle, "setStateTo: DECIDE_ROUTE");
"CASCADE_WEAPON_DETECTED" = ("setAITo: fleeQMineAI.plist");
"FRUSTRATED" = (performAttack);
};
}
Code: Select all
11:32:35.103 [LogEvents] GlobalLog (OOJSGlobal.m:266): Xpat Adder 1122 from Xpat Adder 17465 spawned at 60 km
11:32:35.103 [LogEvents] GlobalLog (OOJSGlobal.m:266): Xpat Adder 28853 from Xpat Adder 17465 spawned at 59 km
11:32:35.103 [LogEvents] GlobalLog (OOJSGlobal.m:266): Xpat Adder 6772 from Xpat Adder 8616 spawned at 60 km
11:32:35.103 [LogEvents] GlobalLog (OOJSGlobal.m:266): Xpat Adder 7605 from Xpat Adder 8616 spawned at 60 km
11:32:35.103 [LogEvents] GlobalLog (OOJSGlobal.m:266): Xpat Adder 17465 spawned at 60 km
11:32:35.103 [LogEvents] GlobalLog (OOJSGlobal.m:266): Xpat Adder 992 from Xpat Adder 17465 spawned at 60 km
11:32:35.103 [LogEvents] GlobalLog (OOJSGlobal.m:266): Xpat Adder 8616 spawned at 60 km
11:32:35.103 [LogEvents] GlobalLog (OOJSGlobal.m:266): Xpat Adder 9881 spawned at 60 km
11:32:35.103 [LogEvents] GlobalLog (OOJSGlobal.m:266): Xpat Adder 4369 from Xpat Adder 9881 spawned at 61 km
11:32:35.103 [LogEvents] GlobalLog (OOJSGlobal.m:266): Xpat Adder 17910 from Xpat Adder 9881 spawned at 60 km
11:32:35.103 [LogEvents] GlobalLog (OOJSGlobal.m:266): Xpat Adder 5674 from Xpat Adder 9881 spawned at 60 km
...
11:34:41.566 [LogEvents] GlobalLog (OOJSGlobal.m:266): targeted Xpat Adder 1122 who has 80 energy
11:34:46.575 [LogEvents] GlobalLog (OOJSGlobal.m:266): targeted Xpat Adder 28853 who has 80 energy
...
11:34:58.801 [LogEvents] GlobalLog (OOJSGlobal.m:266): primed EQ_BROADCASTCOMMSMFD
11:35:09.440 [LogEvents] GlobalLog (OOJSGlobal.m:266): got message from Cobra Mark III 27313 : Hi there.
11:35:11.465 [LogEvents] GlobalLog (OOJSGlobal.m:266): got message from Xpat Adder 28853 : Greetings, noble spacefarer.
11:35:17.331 [LogEvents] GlobalLog (OOJSGlobal.m:266): got message from Cobra Mark III 27313 : Rickety Xpat, what is your status?
11:35:22.355 [LogEvents] GlobalLog (OOJSGlobal.m:266): got message from Xpat Adder 28853 : Kind Commander, we ware indeed in a sorry state and in need of help.
11:35:29.585 [LogEvents] GlobalLog (OOJSGlobal.m:266): got message from Cobra Mark III 27313 : Chin up, emigrants. You'll get there.
11:35:37.608 [LogEvents] GlobalLog (OOJSGlobal.m:266): got message from Xpat Adder 28853 : Thanks. That lifted our morale.
...
11:36:35.637 [LogEvents] GlobalLog (OOJSGlobal.m:266): got message from Xpat Adder 5674 : Nothing to worry about yet…
...
11:36:40.930 [FPS_MONITOR] GlobalLog (OOJSGlobal.m:266): *** FPS report ***: over the last minute, truncated harmonic mean fps was 39, high: 52, low: 32
11:36:40.930 [FPS_MONITOR] GlobalLog (OOJSGlobal.m:266): *** FPS report ***: over the last 2 minutes, truncated harmonic mean fps was 38, high: 52, low: 27
11:36:43.033 [LogEvents] GlobalLog (OOJSGlobal.m:266): targeted Xpat Adder 992 who has 80 energy
11:36:43.034 [LogEvents] GlobalLog (OOJSGlobal.m:266): targeted Xpat Adder 5674 who has 80 energy
11:36:43.035 [LogEvents] GlobalLog (OOJSGlobal.m:266): targeted Xpat Adder 6772 who has 80 energy
11:36:43.037 [LogEvents] GlobalLog (OOJSGlobal.m:266): targeted Xpat Adder 17910 who has 80 energy
11:36:43.039 [LogEvents] GlobalLog (OOJSGlobal.m:266): targeted Xpat Adder 8616 who has 80 energy
11:36:43.040 [LogEvents] GlobalLog (OOJSGlobal.m:266): targeted Xpat Adder 9881 who has 80 energy
11:36:43.041 [LogEvents] GlobalLog (OOJSGlobal.m:266): targeted Xpat Adder 7605 who has 80 energy
11:36:43.042 [LogEvents] GlobalLog (OOJSGlobal.m:266): targeted Xpat Adder 4369 who has 80 energy
11:37:04.549 [LogEvents] GlobalLog (OOJSGlobal.m:266): targeted Xpat Adder 1122 who has 80 energy
11:37:06.557 [LogEvents] GlobalLog (OOJSGlobal.m:266): targeted Xpat Adder 7605 who has 80 energy
11:37:20.301 [LogEvents] GlobalLog (OOJSGlobal.m:266): targeted Xpat Adder 4369 who has 80 energy
11:37:20.557 [LogEvents] GlobalLog (OOJSGlobal.m:266): targeted Telescope marker 24896 who has -1 energy
11:37:22.068 [LogEvents] GlobalLog (OOJSGlobal.m:266): targeted Xpat Adder 4369 who has 80 energy
11:37:22.908 [LogEvents] GlobalLog (OOJSGlobal.m:266): targeted Telescope marker 24767 who has -1 energy
11:37:22.909 [LogEvents] GlobalLog (OOJSGlobal.m:266): lost lock on Xpat Adder 4369
Yeah, that is the follow player AI, right? But what AI do the refugee ships have? If the refugee ships have this new AI, how did/does that come to be? Tell us all the details you're omitting.Cholmondely wrote: ↑Tue Jul 23, 2024 11:29 amBumped into a clutch of Refugee Adders (what is the collective noun for them?) at Bemaera - and they were just tumbling and not going anywhere. Even when I flew into the middle of them and had a "BCC" natter with a couple of them. They did not follow me when I left, and just carried on tumbling.
Current AI.plist:
*According to the AppleMac parser, there are no syntax issues with the following.
Sorry - I was busily adding more oomph into my whine above.Wildeblood wrote: ↑Tue Jul 23, 2024 11:41 amYeah, that is the follow player AI, right? But what AI do the refugee ships have? If the refugee ships have this new AI, how did/does that come to be? Tell us all the details you're omitting.
Code: Select all
{
GLOBAL = {
ENTER = (
"setStateTo: HEAD_FOR_PLANET"
);
};
"GO_TO_RANDOM_STATION" = {
ATTACKED = (
setTargetToPrimaryAggressor,
"commsMessage: [xpat-appeal]",
fightOrFleeHostiles
);
"ATTACKER_MISSED" = (
"commsMessage: [xpat-appeal]",
performFlee,
"setStateTo: ATTACKED"
);
"CASCADE_WEAPON_DETECTED" = (
"setAITo: fleeQMineAI.plist"
);
"COURSE_OK" = (
"setSpeedFactorTo: 0.5",
performFlyToRangeFromDestination
);
"DESIRED_RANGE_ACHIEVED" = (
dockEscorts,
setTargetToNearestStation,
"setAITo: dockingAI.plist"
);
"DOCKING_REFUSED" = (
"setStateTo: CHECK_STATUS"
);
ENTER = (
"dropMessages: WAYPOINT_SET",
"setDesiredRangeTo: 15000.0",
setDestinationToTarget,
checkCourseToDestination
);
"INCOMING_MISSILE" = (
setTargetToPrimaryAggressor,
"sendTargetCommsMessage: [xpat-plea]",
"setStateTo: INCOMING_MISSILE",
"randomPauseAI: 0.25 1.5"
);
"NO_STATION_FOUND" = (
"switchAITo: exitingTraderAI.plist"
);
"TARGET_FOUND" = (
setTargetToFoundTarget,
"sendTargetCommsMessage: [xpat-plea]",
fightOrFleeHostiles
);
UPDATE = (
setTargetToLastStation,
"setDesiredRangeTo: 15000.0",
setDestinationToTarget,
checkCourseToDestination,
scanForHostiles,
"pauseAI: 10.0"
);
"WAYPOINT_SET" = (
"setAITo: gotoWaypointAI.plist"
);
};
"GO_TO_STATION" = {
"AEGIS_IN_DOCKING_RANGE" = (
dockEscorts,
setTargetToSystemStation,
"setAITo: dockingAI.plist"
);
ATTACKED = (
"setAITo: traderInterceptAI.plist",
performFlee,
"commsMessage: [xpat-plea]",
"setStateTo: HEAD_FOR_PLANET"
);
"ATTACKER_MISSED" = (
"commsMessage: [xpat-appeal]",
performFlee,
"setStateTo: ATTACKED"
);
"CASCADE_WEAPON_DETECTED" = (
"setAITo: fleeQMineAI.plist"
);
"COURSE_OK" = (
"setSpeedFactorTo: 0.5",
performFlyToRangeFromDestination
);
"DESIRED_RANGE_ACHIEVED" = (
dockEscorts,
setTargetToSystemStation,
"setAITo: dockingAI.plist"
);
"DOCKING_REFUSED" = (
"pauseAI: 40.0",
"commsMessage: [xpat-broadcast]",
"switchAITo: route2sunskimAI.plist"
);
ENTER = (
"dropMessages: WAYPOINT_SET",
setTargetToSystemStation,
"setDesiredRangeTo: 5000.0",
setDestinationToTarget,
checkCourseToDestination
);
"INCOMING_MISSILE" = (
"setAITo: traderInterceptAI.plist",
"setStateTo: INCOMING_MISSILE",
"randomPauseAI: 0.25 1.5"
);
"NO_STATION_FOUND" = (
"switchAITo: exitingTraderAI.plist"
);
"ROLL_1" = (
"commsMessage: [xpat-broadcast]",
"pauseAI: 40.0",
"setStateTo: GO_TO_STATION"
);
"ROLL_2" = (
"pauseAI: 40.0",
"setStateTo: GO_TO_STATION"
);
"TARGET_FOUND" = (
setTargetToFoundTarget,
"pauseAI: 40.0",
"rollD: 2"
);
UPDATE = (
setTargetToSystemStation,
"setDesiredRangeTo: 5000.0",
setDestinationToTarget,
checkCourseToDestination,
"scanForNearestShipWithRole: player",
"pauseAI: 10.0"
);
"WAYPOINT_SET" = (
"setAITo: gotoWaypointAI.plist"
);
};
"HEAD_FOR_PLANET" = {
"AEGIS_CLOSE_TO_MAIN_PLANET" = (
"setStateTo: GO_TO_STATION"
);
"AEGIS_IN_DOCKING_RANGE" = (
dockEscorts,
"setStateTo: GO_TO_STATION"
);
ATTACKED = (
"setAITo: traderInterceptAI.plist",
performFlee,
"commsMessage: [xpat-plea]",
"setStateTo: HEAD_FOR_PLANET"
);
"ATTACKER_MISSED" = (
"commsMessage: [xpat-appeal]",
performFlee,
"setStateTo: ATTACKED"
);
"CASCADE_WEAPON_DETECTED" = (
"setAITo: fleeQMineAI.plist"
);
"COURSE_OK" = (
"setSpeedFactorTo: 0.65",
performFlyToRangeFromDestination
);
"DESIRED_RANGE_ACHIEVED" = (
"setStateTo: GO_TO_STATION"
);
ENTER = (
setCourseToPlanet,
"setDesiredRangeTo: 30000.0",
"setSpeedFactorTo: 0.35",
checkCourseToDestination
);
"INCOMING_MISSILE" = (
"commsMessage: [xpat-appeal]",
performFlee,
"setStateTo: ATTACKED"
);
RESTARTED = (
checkAegis
);
"ROLL_1" = (
"commsMessage: [xpat-broadcast]",
"pauseAI: 40.0",
"setStateTo: HEAD_FOR_PLANET"
);
"ROLL_2" = (
"pauseAI: 40.0",
"setStateTo: HEAD_FOR_PLANET"
);
"TARGET_FOUND" = (
setTargetToFoundTarget,
"pauseAI: 40.0",
"rollD: 2"
);
UPDATE = (
setCourseToPlanet,
"setDesiredRangeTo: 30000.0",
checkCourseToDestination,
"scanForNearestShipWithRole: player",
"pauseAI: 10.0"
);
"WAYPOINT_SET" = (
"setAITo: gotoWaypointAI.plist"
);
};
}
So, you just have zombie ships floating there, with no active AI?Cholmondely wrote: ↑Tue Jul 23, 2024 11:50 amI overwrote the original refugee ship AI (it is also printed above) since I know of no way to transition from the one AI to the other AI and wished to test the fruits of Littlebear's labours.
Code: Select all
{
GLOBAL ={
ENTER = ("setSpeedFactorTo: 0.25", performIdle);
"EXITED WITCHSPACE" = ("switchAITo: assassins_rebooted_mafia_spacelane_drugshipAI.plist");
UPDATE = ("pauseAI: 1.0", "setStateTo: WAIT_BY_STATION1");
};
"FOUND_PLAYER" =
{
ENTER = ("rollD: 3");
"ROLL_1" = ("switchAITo: assassins_rebooted_mafia_planet_drugshipAI.plist");
"ROLL_2" = ("switchAITo: assassins_rebooted_mafia_outbound_drugshipAI.plist");
"ROLL_3" = ("switchAITo: assassins_rebooted_mafia_exiting_drugshipAI.plist");
};
"BREAK_OFF" ={
ENTER = ("setSpeedFactorTo: 0.30", performIdle);
UPDATE = ("pauseAI: 1.5", "setStateTo: WAIT_BY_STATION1");
};
"ATTACK_SHIP" = {
ENTER = (setTargetToPrimaryAggressor, "sendTargetCommsMessage: [assassins-mafia-threat]", groupAttackTarget, performAttack);
"ATTACKED" = (setTargetToPrimaryAggressor, performAttack);
"FRIENDLY_FIRE" = ("setStateTo: BREAK_OFF");
"INCOMING_MISSILE" = (fightOrFleeMissile, setTargetToFoundTarget, performAttack);
"TARGET_DESTROYED" = (performIdle, "setStateTo: WAIT_BY_STATION1");
"TARGET_LOST" = (performIdle, "setStateTo: WAIT_BY_STATION1");
"NO_TARGET" = (performIdle, "setStateTo: WAIT_BY_STATION1");
"FRUSTRATED" = (performAttack);
};
"WAIT_BY_STATION1" = {
ENTER = ("scanForNearestShipWithRole: player", "rollD: 3");
"ROLL_1" = (
"setCoordinates: pwm 250000 175000 66500", setDestinationFromCoordinates,
"setDesiredRangeTo: 9500.0", checkCourseToDestination);
"ROLL_2" = (
"setCoordinates: pwm 250000 175000 66500", setDestinationFromCoordinates,
"setDesiredRangeTo: 10500.0", checkCourseToDestination);
"ROLL_3" = (
"setCoordinates: pwm 250000 175000 66500", setDestinationFromCoordinates,
"setDesiredRangeTo: 11700.0", checkCourseToDestination);
"TARGET_FOUND" = (setTargetToFoundTarget, "setStateTo: FOUND_PLAYER");
"FRIENDLY_FIRE" = ("setStateTo: BREAK_OFF");
"APPROACHING_SURFACE" = ("setSpeedFactorTo: 0.01", performLandOnPlanet);
COURSE_OK = ("setSpeedFactorTo: 0.35", performFlyToRangeFromDestination);
"WAYPOINT_SET" = ("setAITo: gotoWaypointAI.plist");
"FRUSTRATED" = ("setStateTo: WAIT_BY_STATION2");
DESIRED_RANGE_ACHIEVED = ("setStateTo: WAIT_BY_STATION2");
RESTARTED = ("setStateTo: WAIT_BY_STATION1");
"ATTACKED" = (setTargetToPrimaryAggressor, groupAttackTarget, "setStateTo: ATTACK_SHIP");
"INCOMING_MISSILE" = (fightOrFleeMissile, setTargetToFoundTarget, setTargetToPrimaryAggressor, groupAttackTarget, "setStateTo: ATTACK_SHIP");
UPDATE = ("scanForNearestShipWithRole: player");
};
"WAIT_BY_STATION2" = {
ENTER = ("scanForNearestShipWithRole: player", "rollD: 3");
"ROLL_1" = (
"setCoordinates: pwm 250000 175000 66500", setDestinationFromCoordinates,
"setDesiredRangeTo: 2500.0", checkCourseToDestination);
"ROLL_2" = (
"setCoordinates: pwm 250000 175000 66500", setDestinationFromCoordinates,
"setDesiredRangeTo: 3500.0", checkCourseToDestination);
"ROLL_3" = (
"setCoordinates: pwm 250000 175000 66500", setDestinationFromCoordinates,
"setDesiredRangeTo: 5750.0", checkCourseToDestination);
"TARGET_FOUND" = (setTargetToFoundTarget, "setStateTo: FOUND_PLAYER");
"FRIENDLY_FIRE" = ("setStateTo: BREAK_OFF");
"APPROACHING_SURFACE" = ("setSpeedFactorTo: 0.01", performLandOnPlanet);
COURSE_OK = ("setSpeedFactorTo: 0.55", performFlyToRangeFromDestination);
"WAYPOINT_SET" = ("setAITo: gotoWaypointAI.plist");
"FRUSTRATED" = ("setStateTo: WAIT_BY_STATION1");
DESIRED_RANGE_ACHIEVED = ("setStateTo: WAIT_BY_STATION1");
RESTARTED = ("setStateTo: WAIT_BY_STATION2");
"ATTACKED" = (setTargetToPrimaryAggressor, groupAttackTarget, "setStateTo: ATTACK_SHIP");
"INCOMING_MISSILE" = (fightOrFleeMissile, setTargetToFoundTarget, setTargetToPrimaryAggressor, groupAttackTarget, "setStateTo: ATTACK_SHIP");
UPDATE = ("scanForNearestShipWithRole: player");
};
}
Code: Select all
this.name = "assassins_rebooted_lawful_ship.js";
this.author = "LittleBear";
this.copyright = "CC-by-nc-sa-3.0";
this.version = "1.0";
this.description = "Used to make attacking certain ships a crime and prevent friendly fire.";
// Ships and Stations added by the OXZ have the roles lawful or chaotic in addition to their normal roles.
// Lawful ships will never target each other, so will only hit each other by accident when shooting at another target
// All the lawful ships have zero bountys so also won't be targeted by police ships either.
// If hit by a police ship or a member of it's own faction then the scipt messages the AI not to attack the other ship and instead wait for 2 seconds before returing to what
// it was doing before it was hit. If the player is the attacker then attacking a lawful ship will make the player a fugertive. The ship which hit the ship will also get a friendly fire
// warning and its AI will stop firing to for a few seconds.
this.shipBeingAttacked = function (whom)
{
if (!whom) return;
this.ship.bounty = 0
if (whom.isPlayer)
{
this.ship.reactToAIMessage("ATTACKED");
player.bounty |= 51;
}
// Cause a police ship attacking a lawful ship to break off. If the lawful ship or attacking ship gained a bounty, both are reset to zero.
if (whom.roles.indexOf("police") > -1 )
{
whom.target = null;
whom.bounty = 0;
whom.reactToAIMessage("TARGET_LOST");
this.ship.target = null;
this.ship.bounty = 0;
this.ship.reactToAIMessage("FRIENDLY_FIRE");
return;
}
// If the attacker is another lawful ship, then it will only have hit by accident and the ship will not have been the attacker's current target.
// No need to break the attacker's target, but the ship will not respond to the accidental hit except by Idleing for 1.5 seconds before returning to its normal AI.
if (whom.roles.indexOf("assassins_rebooted_lawful_character") > -1 )
{
whom.bounty = 0;
this.ship.target = null;
this.ship.bounty = 0;
this.ship.reactToAIMessage("FRIENDLY_FIRE");
return;
}
// If the attacker is another lawful station with turrets and it is accidently pelting one of it's own defenders with plasma, the defender will perform a short flee to get out of the way.
if (whom.roles.indexOf("assassins_rebooted_lawful_gunner") > -1 )
{
whom.bounty = 0;
this.ship.bounty = 0;
this.ship.reactToAIMessage("AVOID_LAWFUL_GUNNER");
return;
}
// End of this.shipBeingAttacked
}
this.shipBeingAttackedUnsuccessfully = function(whom)
{
if (!whom) return;
this.ship.bounty = 0
if (whom.isPlayer)
{
this.ship.reactToAIMessage("ATTACKED");
player.bounty |= 51;
}
// Cause a police ship attacking a lawful ship to break off. If the lawful ship or attacking ship gained a bounty, both are reset to zero.
if (whom.roles.indexOf("police") > -1 )
{
whom.target = null;
whom.bounty = 0;
whom.reactToAIMessage("TARGET_LOST");
this.ship.target = null;
this.ship.bounty = 0;
this.ship.reactToAIMessage("FRIENDLY_FIRE");
return;
}
// If the attacker is another lawful ship, then it will only have hit by accident and the ship will not have been the attacker's current target.
// No need to break the attacker's target, but the ship will not respond to the accidental hit except by Idleing for 1.5 seconds before returning to its normal AI.
if (whom.roles.indexOf("assassins_rebooted_lawful_character") > -1 )
{
whom.bounty = 0;
this.ship.target = null;
this.ship.bounty = 0;
this.ship.reactToAIMessage("FRIENDLY_FIRE");
return;
}
// If the attacker is another lawful station with turrets and it is accidently pelting one of it's own defenders with plasma, the defender will perform a short flee to get out of the way.
if (whom.roles.indexOf("assassins_rebooted_lawful_gunner") > -1 )
{
whom.bounty = 0;
this.ship.bounty = 0;
this.ship.reactToAIMessage("AVOID_LAWFUL_GUNNER");
return;
}
// End of shipBeingAttackedUnsuccessfully
}
this.shipAttackedWithMissile = function(missile, whom)
{
if (!whom) return;
this.ship.bounty = 0
if (whom.isPlayer)
{
this.ship.reactToAIMessage("ATTACKED");
player.bounty |= 51;
}
// Cause a police ship attacking a lawful ship to break off. If the lawful ship or attacking ship gained a bounty, both are reset to zero.
if (whom.roles.indexOf("police") > -1 )
{
whom.target = null;
whom.bounty = 0;
whom.reactToAIMessage("TARGET_LOST");
this.ship.target = null;
this.ship.bounty = 0;
this.ship.reactToAIMessage("FRIENDLY_FIRE");
return;
}
// If the attacker is another lawful ship, then it will only have hit by accident and the ship will not have been the attacker's current target.
// No need to break the attacker's target, but the ship will not respond to the accidental hit except by Idleing for 1.5 seconds before returning to its normal AI.
if (whom.roles.indexOf("assassins_rebooted_lawful_character") > -1 )
{
whom.bounty = 0;
this.ship.target = null;
this.ship.bounty = 0;
this.ship.reactToAIMessage("FRIENDLY_FIRE");
return;
}
// If the attacker is another lawful station with turrets and it is accidently pelting one of it's own defenders with plasma, the defender will perform a short flee to get out of the way.
if (whom.roles.indexOf("assassins_rebooted_lawful_gunner") > -1 )
{
whom.bounty = 0;
this.ship.bounty = 0;
this.ship.reactToAIMessage("AVOID_LAWFUL_GUNNER");
return;
}
// End of this.shipAttackedWithMissile
}
this.shipDied = function (whom)
{
if (whom && whom.isPlayer)
{
player.bounty |= 51;
}
// End of this.shipDied
}
Don't do that. I've told you how to proceed: make sure the AI is doing what you want (not something vaguely like want you want) before you start on the javascript. Then get a working script before you start dreaming of feature creep. You want this piece of the puzzle definitively finished, and crossed off the to-do list.Cholmondely wrote: ↑Tue Jul 23, 2024 11:40 pmBut what I want to achieve is to have the switch in AI made as a response to the BCC. Which presumably requires different coding.
Either have the Refugee Adder randomly ask the player: "Can you escort us to the station?" or else have the player offer and the Refugee Adder randomly accept.
And then I suppose that it would be an idea for the player to offer to open a witch-hole to somewhere safer as a system, too. Presumably once the Refugee Adder has accepted the player as an escort, it will follow the player into the witch-hole anyway.
If I can manage something workable for all this then I can see the following loose ends looming in the distance.
That you don't need to worry about. I am trying to nail the AI down first. But I'm also trying to understand what I'm doing (at least a little). Currently rereading the AI pages and trying to make sense of both them and the AI.plists given above. And am very slowly getting somewhere!Wildeblood wrote: ↑Wed Jul 24, 2024 3:01 amDon't do that. I've told you how to proceed: make sure the AI is doing what you want (not something vaguely like want you want) before you start on the javascript. Then get a working script before you start dreaming of feature creep. You want this piece of the puzzle definitively finished, and crossed off the to-do list.Cholmondely wrote: ↑Tue Jul 23, 2024 11:40 pmBut what I want to achieve is to have the switch in AI made as a response to the BCC. Which presumably requires different coding.
Either have the Refugee Adder randomly ask the player: "Can you escort us to the station?" or else have the player offer and the Refugee Adder randomly accept.
And then I suppose that it would be an idea for the player to offer to open a witch-hole to somewhere safer as a system, too. Presumably once the Refugee Adder has accepted the player as an escort, it will follow the player into the witch-hole anyway.
If I can manage something workable for all this then I can see the following loose ends looming in the distance.