Difference between revisions of "OXP howto AI"

From Elite Wiki
m (typo)
(reorganised. A_H)
Line 1: Line 1:
 
== Methods for AI ==
 
== Methods for AI ==
  +
For more explanation on AI function, [[STATE]]S and [[message]]s, please read the [OoliteAIreference.hml] in your Oolite-filesfolder.
   
  +
== AI ==
  +
=== exitAI; ===
  +
Exits current AI.
   
=== acceptDistressMessageFrom:(ShipEntity *)other; ===
 
  +
=== messageMother:(NSString *)msgString; ===
Has police either respond to a distress call, or possibly decide it is too busy or too scared.
 
  +
Sends a AImessage to the mothership/leader of a group.
   
=== addFuel:(NSString*) fuel_number; ===
 
  +
Example:
Changes fuel level (only of player entity?) by fuel_numer LY's, max to 7.0 min to 0.0.
 
  +
INCOMING_MISSILE = ("messageMother: INCOMING_MISSILE");
  +
The mothership will then behave as if it was targetted by the missile.
   
=== becomeEnergyBlast ===
 
  +
=== pauseAI:(NSString *)intervalString; ===
Used in the [[Qbomb]].
 
  +
Sets AI think-time in seconds.
   
=== becomeExplosion ===
 
  +
=== setAITo:(NSString *)aiString; ===
The entity model is replaced by an explosion.
 
  +
Pauses current AI and switches to anotherAI.plist, this becomes the top AI on the 'AI-stack'.
  +
When anotherAI.plist exits ([[exitAI]]), the previousAI becomes topAI again and AI-state is messaged RESTARTED.
   
=== becomeLargeExplosion ===
+
=== setStateTo: SOMESTATE ===
Used at player entity death, not for use in other instances.
+
Changes the AI state to SOMESTATE.
   
=== broadcastDistressMessage; ===
 
  +
=== switchAITo:(NSString *)aiString; ===
Locates all the stations, bounty hunters and police ships in range and tells them that you are under attack.
 
  +
Switches entity AI to another *AI.plist, the previous AI will be exited.
   
=== checkCourseToDestination; ===
 
Will return "COURSE_OK" or in case of obstacles on the direct route, "WAYPOINT_SET".
 
   
=== checkDistanceTravelled; ===
 
  +
== AI choices ==
May return "GONE_BEYOND_RANGE".
 
  +
=== fightOrFleeHostiles; ===
  +
Has entity consider whether to fight, deploy missiles or flee. Returns "FIGHTING", "DEPLOYING_ESCORTS" or "FLEEING".
   
=== checkGroupOddsVersusTarget; ===
+
=== fightOrFleeMissile; ===
Will return "ODDS_GOOD" or "ODDS_BAD".
+
Deals with missiles, launches ECM if available, flees if not, marks as offender if police.
   
=== checkForFullHold; ===
 
If entity's cargo capacity is reached, will return "HOLD_FULL".
 
   
=== checkForMotherStation; ===
 
  +
== Perform Action ==
Will return "STATION_FOUND" or "NOTHING_FOUND".
 
  +
=== acceptDistressMessageFrom:(ShipEntity *)other; ===
  +
Has police either respond to a distress call, or possibly decide it is too busy or too scared.
   
=== checkForNormalSpace; ===
+
=== becomeEnergyBlast ===
Will return "NORMAL_SPACE" or "INTERSTELLAR_SPACE".
+
Used in the [[Qbomb]].
   
=== checkTargetLegalStatus; ===
+
=== becomeExplosion ===
Returns "TARGET_CLEAN, "TARGET_MINOR_OFFENDER", "TARGET_OFFENDER", "TARGET_FUGITIVE" or "NO_TARGET".
+
The entity model is replaced by an explosion.
   
=== commsMessage:(NSString *)valueString; ===
 
  +
=== becomeLargeExplosion ===
Broadcasts a general message to player.
 
  +
Used at player entity death, not for use in other instances.
Example:
 
"sendCommsMessage: [thargoid_curses]"
 
   
 
=== dealEnergyDamageWithinDesiredRange ===
 
=== dealEnergyDamageWithinDesiredRange ===
Line 60: Line 62:
 
=== escortCheckMother; ===
 
=== escortCheckMother; ===
 
Returns "ESCORTING" or "NOT_ESCORTING".
 
Returns "ESCORTING" or "NOT_ESCORTING".
 
=== exitAI; ===
 
Exits current AI.
 
 
=== fightOrFleeHostiles; ===
 
Has entity consider whether to fight, deploy missiles or flee. Returns "FIGHTING", "DEPLOYING_ESCORTS" or "FLEEING".
 
 
=== fightOrFleeMissile; ===
 
Deals with missiles, launches ECM if available, flees if not, marks as offender if police.
 
 
=== findNearestPlanet; ===
 
(PlanetEntity *)
 
Will scan for planetentity, returns message TARGET_FOUND (or NOTHING_FOUND).
 
   
 
=== fireECM ===
 
=== fireECM ===
 
Used by stations and hermits.
 
Used by stations and hermits.
 
=== getWitchspaceEntryCoordinates; ===
 
Calculates coordinates from the nearest station it can find, or just fly 10s forward.
 
   
 
=== groupAttackTarget; ===
 
=== groupAttackTarget; ===
 
All ships in group will have their targets set to this entity's target and performAttack.
 
All ships in group will have their targets set to this entity's target and performAttack.
 
=== initialiseTurret; ===
 
Prepares the turret.
 
   
 
=== landOnPlanet; ===
 
=== landOnPlanet; ===
 
Selects the nearest planet it can find, lands (10km from planet) and 'removes' the entity.
 
Selects the nearest planet it can find, lands (10km from planet) and 'removes' the entity.
   
=== LaunchSomeship ===
+
=== Launch..Someship ===
 
Launches a ship fron a dockable entity, various types of this method exist.
 
Launches a ship fron a dockable entity, various types of this method exist.
 
*LaunchDefenceShip
 
*LaunchDefenceShip
Line 95: Line 78:
 
*LaunchPolice
 
*LaunchPolice
 
*LaunchScavenger
 
*LaunchScavenger
Probably will work for other roles too?
+
Probably will work for other [[role]]s too?
   
 
=== markTargetForFines; ===
 
=== markTargetForFines; ===
Deals out a fine.
+
Deals out a fine to target.
 
Example:
 
Example:
 
"markTargetForFines 100"
 
"markTargetForFines 100"
Line 104: Line 87:
   
 
=== markTargetForOffence:(NSString*) valueString; ===
 
=== markTargetForOffence:(NSString*) valueString; ===
Has police mark up the criminal status of target entity.
+
Has police mark up the criminal record ([[Legal status]]) of target entity.
   
 
=== messageMother:(NSString *)msgString; ===
 
=== messageMother:(NSString *)msgString; ===
Line 111: Line 94:
 
INCOMING_MISSILE = ("messageMother: INCOMING_MISSILE");
 
INCOMING_MISSILE = ("messageMother: INCOMING_MISSILE");
 
The mothership will then behave as if it was targetted by the missile.
 
The mothership will then behave as if it was targetted by the missile.
 
=== patrolReportIn; ===
 
 
=== pauseAI:(NSString *)intervalString; ===
 
Sets AI think-time in seconds.
 
   
 
=== performAttack; ===
 
=== performAttack; ===
Line 136: Line 114:
   
 
=== performFlyToRangeFromDestination; ===
 
=== performFlyToRangeFromDestination; ===
NOT YET IMPLEMENTED
+
NOT YET IMPLEMENTED.
  +
Sets the AI's current state to CONDITION_FLY_RANGE_FROM_DESTINATION.
  +
While in this state the entity will attempt to fly to its current destination, stopping at the desired range from it.
   
 
=== performHold; ===
 
=== performHold; ===
Performs idleness while tracking a potential target.
+
Performs idleness while tracking a potential target, speed is set to zero. [[frustration]]level is reset.
   
 
=== performHyperSpaceExit; ===
 
=== performHyperSpaceExit; ===
Line 145: Line 123:
   
 
=== performIdle; ===
 
=== performIdle; ===
Performs idleness. Ship corrects its roll and pitch to 'horizontal' flight.
+
Performs idleness. Ship corrects its roll and pitch to 'horizontal' flight, speed is unaffected. [[frustration]]level is reset to zero.
   
 
=== performIntercept; ===
 
=== performIntercept; ===
Line 156: Line 134:
 
Performs random pitch and roll, 'evasive maneuvers'.
 
Performs random pitch and roll, 'evasive maneuvers'.
   
=== recallDockingInstructions; ===
 
  +
=== setSpeedTo:(NSString *)speedString; ===
  +
Sets desired speed to an absolute value, entity cannot go faster than maxspeed value determined in the [[shipdata.plist]]. If speed is above maxspeed, entity will use fuelinjectors if available.
   
=== requestDockingCoordinates; ===
 
  +
=== setSpeedFactorTo:(NSString *)speedString; ===
Requests coordinates from the nearest station it can find (which may be a rock hermit).
 
  +
Sets the desired speed to a percentage of maxspeed (0->1=0%->100%). If speedfactor is set above 100%, entity will use fuelinjectors if available.
   
=== requestNewTarget; ===
+
=== suggestEscort; ===
Locates all the ships in range targetting the mother ship, and chooses the nearest/biggest.
+
Has an escort seek employment and either gets accepted or rejected by the "mother".
   
=== rollD:(NSString*) die_number; ===
 
  +
=== switchLightsOff ===
Uses "dice" for random situation use.
 
  +
If an entity has lights (or flashers), this command will turn them off.
  +
Default state is on. (See [[shipdata.plist]])
   
=== scanForFormationLeader; ===
+
=== switchLightsOn ===
Locates the nearest suitable formation leader in range.
+
Will turn flashers back on.
   
=== scanForHostiles; ===
+
=== wormholeEntireGroup; ===
Locates all the ships in range targetting the receiver and chooses the nearest.
+
Wormholes ships in this group.
   
=== scanForLoot; ===
+
=== wormholeEscorts; ===
Locates the nearest debris in range.
+
Wormholes official escorts.
   
=== scanForNearestMerchantmen; ===
+
=== wormholeGroup; ===
Locates the nearest merchantman in range
+
Wormholes ships in group of which this is a leader.
   
=== scanForNearestShipWithRole:(NSString*) scanRole; ===
 
Locates all the ships in range and chooses the nearest.
 
   
=== scanForNonThargoid; ===
 
  +
== Navigation ==
Locates all the non thargoid ships in range and chooses the nearest.
 
   
=== scanForOffenders; ===
 
  +
=== getWitchspaceEntryCoordinates; ===
Locates all the ships in range and compares their legal status or bounty, and chooses the worst offender.
 
  +
Calculates coordinates from the nearest station it can find, or just fly 10s forward.
   
=== scanForRandomLoot; ===
+
=== recallDockingInstructions; ===
Locates the all debris in range and chooses a piece at random from the first sixteen found.
+
...
   
=== scanForRandomMerchantmen; ===
+
=== requestDockingCoordinates; ===
Locates one of the merchantman in range.
+
Requests coordinates from the nearest station it can find (which may be a rock hermit).
 
=== scanForRocks; ===
 
Locates the all boulders and asteroids in range and selects one of up to 16. Returns "TARGET_FOUND" or"NOTHING_FOUND".
 
 
=== scanForThargoid; ===
 
Locates all the thargoid warships in range and chooses the nearest.
 
 
=== scriptActionOnTarget:(NSString*) action; ===
 
Will cause immediate reaction to any changes this makes.
 
 
=== sendTargetCommsMessage:(NSString*) message; ===
 
Sends any message to the established (found) target.
 
 
Example:
 
"sendTargetCommsMessage: Listen to me!!"
 
 
=== setAITo:(NSString *)aiString; ===
 
Pauses current AI and switches to anotherAI.plist, this becomes the top AI on the 'AI-stack'.
 
When anotherAI.plist exits ([[exitAI]]), the previousAI becomes topAI again and AI-state is messaged RESTARTED.
 
   
 
=== setCoordinates:(NSString *)system_x_y_z; ===
 
=== setCoordinates:(NSString *)system_x_y_z; ===
Line 204: Line 181:
   
 
=== setDesiredRangeTo:(NSString *)rangeString; ===
 
=== setDesiredRangeTo:(NSString *)rangeString; ===
Defines acceptable range distance from destination.
 
  +
Some methods (such as scanForNearestMerchantmen, checkCourseToDestination, checkDistanceTravelled, etc) require a "desired range" parameter to be set before they can be used.
  +
  +
This method is used to set the desired range. There is only one value for desired range within an instance of the AI. The value of desired range is modified internally by AI methods such as fightOrFleeMissile, setCourseToWitchpoint, and setPlanetPatrolCoordinates.
   
 
=== setDestinationFromCoordinates; ===
 
=== setDestinationFromCoordinates; ===
Line 210: Line 189:
   
 
=== setDestinationToCurrentLocation; ===
 
=== setDestinationToCurrentLocation; ===
Altitude controll?
 
  +
This method sets the destination of the current entity to its current location plus a random offset of up to 0.5 metres in the X, Y, and Z coordinates. This can be used to make a ship idle in a small area of space without being completely still.
   
 
=== setDestinationToDockingAbort; ===
 
=== setDestinationToDockingAbort; ===
Line 229: Line 208:
 
=== setPlanetPatrolCoordinates; ===
 
=== setPlanetPatrolCoordinates; ===
 
Check we've arrived near the last given coordinates.
 
Check we've arrived near the last given coordinates.
 
=== setSpeedTo:(NSString *)speedString; ===
 
 
=== setSpeedFactorTo:(NSString *)speedString; ===
 
   
 
=== setSunSkimEndCoordinates; ===
 
=== setSunSkimEndCoordinates; ===
  +
...
   
 
=== setSunSkimExitCoordinates; ===
 
=== setSunSkimExitCoordinates; ===
  +
...
   
 
=== setSunSkimStartCoordinates; ===
 
=== setSunSkimStartCoordinates; ===
  +
...
   
=== setStateTo: SOMESTATE ===
 
Changes the AI state to SOMESTATE.
 
   
=== setTakeOffFromPlanet; ===
 
  +
== Communication ==
Selects the nearest planet it can find and adds entity 10 km from planet, unless there is no planet to be found.
 
  +
  +
=== broadcastDistressMessage; ===
  +
Locates all the stations, bounty hunters and police ships in range and tells them that you are under attack.
  +
  +
=== commsMessage:(NSString *)valueString; ===
  +
Broadcasts a general message to player.
  +
Example:
  +
"sendCommsMessage: [thargoid_curses]"
  +
  +
=== initialiseTurret; ===
  +
Prepares the turret.
  +
  +
=== patrolReportIn; ===
  +
...
  +
  +
=== sendTargetCommsMessage:(NSString*) message; ===
  +
Sends any message to the established (found) target.
  +
  +
Example:
  +
"sendTargetCommsMessage: Listen to me!!"
  +
  +
  +
== Locating stuff ==
  +
All these methods require a range to be set by setDesiredRange or by <scanner_range> in [[shipdata.plist]], all will return the message TARGET_FOUND or NOTHING_FOUND.
  +
The calling entity remembers the found target, but it does not become the current (universal) target. It can be made the current target by responding to the TARGET_FOUND message with a call to setTargetToFoundTarget.
  +
  +
=== find.. ===
  +
==== findNearestPlanet; ====
  +
(PlanetEntity *)
  +
Will scan for planetentity.
  +
  +
=== scanFor.. ===
  +
==== scanForFormationLeader; ====
  +
Locates the nearest suitable formation leader in range.
  +
  +
==== scanForHostiles; ====
  +
Locates all the ships in range targetting the receiver and chooses the nearest.
  +
  +
==== scanForLoot; ====
  +
Locates the nearest debris in range.
  +
  +
==== scanForNearestMerchantmen; ====
  +
Locates the nearest merchantman in range
  +
  +
==== scanForNearestShipWithRole:(NSString*) scanRole; ====
  +
Locates all the ships in range and chooses the nearest.
  +
  +
==== scanForNonThargoid; ====
  +
Locates all the non thargoid ships in range and chooses the nearest.
  +
  +
==== scanForOffenders; ====
  +
Locates all the ships in range and compares their legal status or bounty, and chooses the worst offender.
  +
  +
==== scanForRandomLoot; ====
  +
Locates the all debris in range and chooses a piece at random from the first sixteen found.
  +
  +
==== scanForRandomMerchantmen; ====
  +
Locates one of the merchantman in range.
  +
  +
==== scanForRocks; ====
  +
Locates the all boulders and asteroids in range and selects one of up to 16. Returns "TARGET_FOUND" or"NOTHING_FOUND".
  +
  +
==== scanForThargoid; ====
  +
Locates all the thargoid warships in range and chooses the nearest.
  +
  +
=== CheckFor.. ===
  +
"Check for.." methods are a bit more variable in their output messages.
  +
  +
==== checkCourseToDestination; ====
  +
Will return "COURSE_OK" or in case of obstacles on the direct route, "WAYPOINT_SET".
  +
  +
==== checkDistanceTravelled; ====
  +
May return "GONE_BEYOND_RANGE" or DESIRED_RANGE_ACHIEVED.
  +
  +
==== checkGroupOddsVersusTarget; ====
  +
Will return "ODDS_GOOD" or "ODDS_BAD".
  +
  +
==== checkForFullHold; ====
  +
If entity's cargo capacity is reached, will return "HOLD_FULL".
  +
  +
==== checkForMotherStation; ====
  +
Will return "STATION_FOUND" or "NOTHING_FOUND".
  +
  +
==== checkForNormalSpace; ====
  +
Will return "NORMAL_SPACE" or "INTERSTELLAR_SPACE".
  +
  +
==== checkTargetLegalStatus; ====
  +
Returns "TARGET_CLEAN, "TARGET_MINOR_OFFENDER", "TARGET_OFFENDER", "TARGET_FUGITIVE" or "NO_TARGET".
  +
  +
  +
== Targetting ==
  +
  +
=== requestNewTarget; ===
  +
Locates all the ships in range targetting the mother ship, and chooses the nearest/biggest.
   
 
=== setTargetToFoundTarget; ===
 
=== setTargetToFoundTarget; ===
Affirms a target found by a scanFor- or find-Something-method as the universal target.
+
Affirms a [[TARGET_FOUND]] by a scanFor- or find-Something-method as the universal target.
   
 
=== setTargetToPrimaryAggressor; ===
 
=== setTargetToPrimaryAggressor; ===
 
Changes to a different enemy target if attacked, unless already very busy attacking another.
 
Changes to a different enemy target if attacked, unless already very busy attacking another.
   
=== suggestEscort; ===
 
Has an escort seek employment and either gets accepted or rejected by the "mother".
 
   
=== switchAITo:(NSString *)aiString; ===
 
  +
== Miscellaneous ==
Switches entity AI to another *AI.plist, the previous AI will be exited.
 
  +
  +
=== addFuel:(NSString*) fuel_number; ===
  +
Changes fuel level (only of player entity?) by fuel_numer LY's, max to 7.0 min to 0.0.
  +
  +
=== rollD:(NSString*) die_number; ===
  +
Uses "dice" for random situation use.
  +
  +
=== scriptActionOnTarget:(NSString*) action; ===
  +
Will cause immediate reaction to any changes this makes.
  +
  +
=== setTakeOffFromPlanet; ===
  +
Selects the nearest planet it can find and adds entity 10 km from planet, unless there is no planet to be found.
  +
  +
  +
  +
  +
  +
  +
  +
  +
   
=== switchLightsOff ===
 
If an entity has lights (or flashers), this command will turn them off.
 
Default state is on. (See [[shipdata.plist]])
 
   
=== switchLightsOn ===
 
Will turn flashers back on.
 
   
=== wormholeEntireGroup; ===
 
Wormholes ships in this group.
 
   
=== wormholeEscorts; ===
 
Wormholes official escorts.
 
   
=== wormholeGroup; ===
 
Wormholes ships in group of which this is a leader.
 
   
   

Revision as of 15:33, 23 January 2006

Contents

Methods for AI

For more explanation on AI function, STATES and messages, please read the [OoliteAIreference.hml] in your Oolite-filesfolder.

AI

exitAI;

Exits current AI.

messageMother:(NSString *)msgString;

Sends a AImessage to the mothership/leader of a group.

Example:

INCOMING_MISSILE = ("messageMother: INCOMING_MISSILE");

The mothership will then behave as if it was targetted by the missile.

pauseAI:(NSString *)intervalString;

Sets AI think-time in seconds.

setAITo:(NSString *)aiString;

Pauses current AI and switches to anotherAI.plist, this becomes the top AI on the 'AI-stack'. When anotherAI.plist exits (exitAI), the previousAI becomes topAI again and AI-state is messaged RESTARTED.

setStateTo: SOMESTATE

Changes the AI state to SOMESTATE.

switchAITo:(NSString *)aiString;

Switches entity AI to another *AI.plist, the previous AI will be exited.


AI choices

fightOrFleeHostiles;

Has entity consider whether to fight, deploy missiles or flee. Returns "FIGHTING", "DEPLOYING_ESCORTS" or "FLEEING".

fightOrFleeMissile;

Deals with missiles, launches ECM if available, flees if not, marks as offender if police.


Perform Action

acceptDistressMessageFrom:(ShipEntity *)other;

Has police either respond to a distress call, or possibly decide it is too busy or too scared.

becomeEnergyBlast

Used in the Qbomb.

becomeExplosion

The entity model is replaced by an explosion.

becomeLargeExplosion

Used at player entity death, not for use in other instances.

dealEnergyDamageWithinDesiredRange

Needs desiredRange to be set first, then deals weaponEnergy(Shipdata.plist) damage within this sphere.

deployEscorts

Deploys an escort.

ejectCargo;

Ejects cargo.

enterTargetWormhole;

Will locate nearest wormhole, and enter it.

escortCheckMother;

Returns "ESCORTING" or "NOT_ESCORTING".

fireECM

Used by stations and hermits.

groupAttackTarget;

All ships in group will have their targets set to this entity's target and performAttack.

landOnPlanet;

Selects the nearest planet it can find, lands (10km from planet) and 'removes' the entity.

Launch..Someship

Launches a ship fron a dockable entity, various types of this method exist.

  • LaunchDefenceShip
  • LaunchMiner
  • LaunchPolice
  • LaunchScavenger

Probably will work for other roles too?

markTargetForFines;

Deals out a fine to target. Example:

"markTargetForFines 100"

Will fine the target 10Cr. N.b. for commercial transactions "awardMoney -$" is a more suitable method.

markTargetForOffence:(NSString*) valueString;

Has police mark up the criminal record (Legal status) of target entity.

messageMother:(NSString *)msgString;

Sends a AImessage to the mothership/leader of a group. Example:

INCOMING_MISSILE = ("messageMother: INCOMING_MISSILE");

The mothership will then behave as if it was targetted by the missile.

performAttack;

Attacks target.

performCollect;

Performs 'collection' of target.

performDocking;

NOT YET IMPLEMENTED.

performEscort;

Performs escorting.

performFaceDestination;

Has entity face destination.

performFlee;

Sets the caller (AI) to flee from it's primary target at maximum speed. If the caller has a cloacking device, it will be activated.

performFlyToRangeFromDestination;

NOT YET IMPLEMENTED. Sets the AI's current state to CONDITION_FLY_RANGE_FROM_DESTINATION. While in this state the entity will attempt to fly to its current destination, stopping at the desired range from it.

performHold;

Performs idleness while tracking a potential target, speed is set to zero. frustrationlevel is reset.

performHyperSpaceExit;

Gets a list of destinations within range, checks if clear of nearby masses, and select one at random. May return "WITCHSPACE UNAVAILABLE" or "WITCHSPACE BLOCKED".

performIdle;

Performs idleness. Ship corrects its roll and pitch to 'horizontal' flight, speed is unaffected. frustrationlevel is reset to zero.

performIntercept;

Performs target interception.

performMining;

Performs mining. (Finds, intercepts and shoots asteroids with mining laser, if fitted.)

performTumble;

Performs random pitch and roll, 'evasive maneuvers'.

setSpeedTo:(NSString *)speedString;

Sets desired speed to an absolute value, entity cannot go faster than maxspeed value determined in the shipdata.plist. If speed is above maxspeed, entity will use fuelinjectors if available.

setSpeedFactorTo:(NSString *)speedString;

Sets the desired speed to a percentage of maxspeed (0->1=0%->100%). If speedfactor is set above 100%, entity will use fuelinjectors if available.

suggestEscort;

Has an escort seek employment and either gets accepted or rejected by the "mother".

switchLightsOff

If an entity has lights (or flashers), this command will turn them off. Default state is on. (See shipdata.plist)

switchLightsOn

Will turn flashers back on.

wormholeEntireGroup;

Wormholes ships in this group.

wormholeEscorts;

Wormholes official escorts.

wormholeGroup;

Wormholes ships in group of which this is a leader.


Navigation

getWitchspaceEntryCoordinates;

Calculates coordinates from the nearest station it can find, or just fly 10s forward.

recallDockingInstructions;

...

requestDockingCoordinates;

Requests coordinates from the nearest station it can find (which may be a rock hermit).

setCoordinates:(NSString *)system_x_y_z;

Sets PWM destination coords.

setCourseToPlanet;

Selects the nearest planet it can find, reaching desired range 50 km from the planet.

setCourseToWitchpoint;

Sets destination coords to Witchpoint area.

setDesiredRangeTo:(NSString *)rangeString;

Some methods (such as scanForNearestMerchantmen, checkCourseToDestination, checkDistanceTravelled, etc) require a "desired range" parameter to be set before they can be used.

This method is used to set the desired range. There is only one value for desired range within an instance of the AI. The value of desired range is modified internally by AI methods such as fightOrFleeMissile, setCourseToWitchpoint, and setPlanetPatrolCoordinates.

setDestinationFromCoordinates;

Enables the plotting of manual waypoints.

setDestinationToCurrentLocation;

This method sets the destination of the current entity to its current location plus a random offset of up to 0.5 metres in the X, Y, and Z coordinates. This can be used to make a ship idle in a small area of space without being completely still.

setDestinationToDockingAbort;

DockingAbort coordinates...Xm in front of a dockingslit?

setDestinationToStationBeacon;

Gets station beacon position.

setDestinationToTarget;

Sets destination to target coords.

setDestinationToWitchpoint;

Sets destination coords to WitchspaceExitPosition.

setDestinationWithinTarget;

Handy for ramming and racing.

setPlanetPatrolCoordinates;

Check we've arrived near the last given coordinates.

setSunSkimEndCoordinates;

...

setSunSkimExitCoordinates;

...

setSunSkimStartCoordinates;

...


Communication

broadcastDistressMessage;

Locates all the stations, bounty hunters and police ships in range and tells them that you are under attack.

commsMessage:(NSString *)valueString;

Broadcasts a general message to player. Example:

"sendCommsMessage: [thargoid_curses]"

initialiseTurret;

Prepares the turret.

patrolReportIn;

...

sendTargetCommsMessage:(NSString*) message;

Sends any message to the established (found) target.

Example:

"sendTargetCommsMessage: Listen to me!!"


Locating stuff

All these methods require a range to be set by setDesiredRange or by <scanner_range> in shipdata.plist, all will return the message TARGET_FOUND or NOTHING_FOUND. The calling entity remembers the found target, but it does not become the current (universal) target. It can be made the current target by responding to the TARGET_FOUND message with a call to setTargetToFoundTarget.

find..

findNearestPlanet;

(PlanetEntity *) Will scan for planetentity.

scanFor..

scanForFormationLeader;

Locates the nearest suitable formation leader in range.

scanForHostiles;

Locates all the ships in range targetting the receiver and chooses the nearest.

scanForLoot;

Locates the nearest debris in range.

scanForNearestMerchantmen;

Locates the nearest merchantman in range

scanForNearestShipWithRole:(NSString*) scanRole;

Locates all the ships in range and chooses the nearest.

scanForNonThargoid;

Locates all the non thargoid ships in range and chooses the nearest.

scanForOffenders;

Locates all the ships in range and compares their legal status or bounty, and chooses the worst offender.

scanForRandomLoot;

Locates the all debris in range and chooses a piece at random from the first sixteen found.

scanForRandomMerchantmen;

Locates one of the merchantman in range.

scanForRocks;

Locates the all boulders and asteroids in range and selects one of up to 16. Returns "TARGET_FOUND" or"NOTHING_FOUND".

scanForThargoid;

Locates all the thargoid warships in range and chooses the nearest.

CheckFor..

"Check for.." methods are a bit more variable in their output messages.

checkCourseToDestination;

Will return "COURSE_OK" or in case of obstacles on the direct route, "WAYPOINT_SET".

checkDistanceTravelled;

May return "GONE_BEYOND_RANGE" or DESIRED_RANGE_ACHIEVED.

checkGroupOddsVersusTarget;

Will return "ODDS_GOOD" or "ODDS_BAD".

checkForFullHold;

If entity's cargo capacity is reached, will return "HOLD_FULL".

checkForMotherStation;

Will return "STATION_FOUND" or "NOTHING_FOUND".

checkForNormalSpace;

Will return "NORMAL_SPACE" or "INTERSTELLAR_SPACE".

checkTargetLegalStatus;

Returns "TARGET_CLEAN, "TARGET_MINOR_OFFENDER", "TARGET_OFFENDER", "TARGET_FUGITIVE" or "NO_TARGET".


Targetting

requestNewTarget;

Locates all the ships in range targetting the mother ship, and chooses the nearest/biggest.

setTargetToFoundTarget;

Affirms a TARGET_FOUND by a scanFor- or find-Something-method as the universal target.

setTargetToPrimaryAggressor;

Changes to a different enemy target if attacked, unless already very busy attacking another.


Miscellaneous

addFuel:(NSString*) fuel_number;

Changes fuel level (only of player entity?) by fuel_numer LY's, max to 7.0 min to 0.0.

rollD:(NSString*) die_number;

Uses "dice" for random situation use.

scriptActionOnTarget:(NSString*) action;

Will cause immediate reaction to any changes this makes.

setTakeOffFromPlanet;

Selects the nearest planet it can find and adds entity 10 km from planet, unless there is no planet to be found.











This article is a stub. You can help EliteWiki by expanding it.