Difference between revisions of "OXP howto AI"
(→Perform Action: added setUpEscorts) |
m (small conforms) |
||
Line 30: | Line 30: | ||
== AI == |
== AI == |
||
− | === exitAI |
+ | === exitAI === |
Exits current AI. |
Exits current AI. |
||
Line 54: | Line 54: | ||
== AI choices == |
== AI choices == |
||
− | === fightOrFleeHostiles |
+ | === fightOrFleeHostiles === |
Has entity consider whether to fight, deploy missiles or flee. Returns "FIGHTING", "DEPLOYING_ESCORTS" or "FLEEING". |
Has entity consider whether to fight, deploy missiles or flee. Returns "FIGHTING", "DEPLOYING_ESCORTS" or "FLEEING". |
||
− | === fightOrFleeMissile |
+ | === fightOrFleeMissile === |
Deals with missiles, launches ECM if available, flees if not, marks as offender if police. |
Deals with missiles, launches ECM if available, flees if not, marks as offender if police. |
||
Line 75: | Line 75: | ||
=== dealEnergyDamageWithinDesiredRange === |
=== dealEnergyDamageWithinDesiredRange === |
||
− | Needs desiredRange to be set first, then deals [[weaponEnergy]]([[Shipdata.plist]]) damage within this sphere. |
+ | Needs desiredRange to be set first, then deals [[weaponEnergy]] ([[Shipdata.plist]]) damage within this sphere. |
=== deployEscorts === |
=== deployEscorts === |
||
Deploys an escort. |
Deploys an escort. |
||
− | === ejectCargo |
+ | === ejectCargo === |
Ejects cargo. |
Ejects cargo. |
||
− | === enterTargetWormhole |
+ | === enterTargetWormhole === |
Will locate nearest wormhole, and enter it. |
Will locate nearest wormhole, and enter it. |
||
− | === escortCheckMother |
+ | === escortCheckMother === |
Returns "ESCORTING" or "NOT_ESCORTING". |
Returns "ESCORTING" or "NOT_ESCORTING". |
||
=== fireECM === |
=== fireECM === |
||
− | Used by stations and hermits. |
+ | Used by stations and hermits to engage ECM. |
− | === 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. |
||
− | === 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. |
||
− | === Launch.. |
+ | === Launch..''Some''Ship === |
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 104: | Line 104: | ||
*LaunchPolice |
*LaunchPolice |
||
*LaunchScavenger |
*LaunchScavenger |
||
− | Probably will work for other [[ |
+ | Probably will work for other [[roles]] too? |
− | === markTargetForFines |
+ | === markTargetForFines === |
Deals out a fine to target. |
Deals out a fine to target. |
||
Example: |
Example: |
||
Line 121: | Line 121: | ||
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. |
||
− | === performAttack |
+ | === performAttack === |
Attacks target. |
Attacks target. |
||
− | === performCollect |
+ | === performCollect === |
Performs 'collection' of target. |
Performs 'collection' of target. |
||
− | === performDocking |
+ | === performDocking === |
NOT YET IMPLEMENTED. |
NOT YET IMPLEMENTED. |
||
− | === performEscort |
+ | === performEscort === |
Performs escorting. |
Performs escorting. |
||
− | === performFaceDestination |
+ | === performFaceDestination === |
Has entity face destination. |
Has entity face destination. |
||
− | === performFlee |
+ | === 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. |
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 |
+ | === performFlyToRangeFromDestination === |
NOT YET IMPLEMENTED. |
NOT YET IMPLEMENTED. |
||
Sets the AI's current state to CONDITION_FLY_RANGE_FROM_DESTINATION. |
Sets the AI's current state to CONDITION_FLY_RANGE_FROM_DESTINATION. |
||
Line 147: | Line 147: | ||
Used in shuttleAI. combined method to target and fly towards planet? |
Used in shuttleAI. combined method to target and fly towards planet? |
||
− | === performHold |
+ | === performHold === |
− | Performs idleness while tracking a potential target, speed is set to zero. [[frustration]]level is reset. |
+ | Performs idleness while tracking a potential target, speed is set to zero. [[frustration]] level is reset. |
− | === performHyperSpaceExit |
+ | === 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". |
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 |
+ | === performIdle === |
− | Performs idleness. Ship corrects its roll and pitch to 'horizontal' flight, speed is unaffected. [[frustration]]level is reset to zero. |
+ | Performs idleness. Ship corrects its roll and pitch to 'horizontal' flight, speed is unaffected. [[frustration]] level is reset to zero. |
− | === performIntercept |
+ | === performIntercept === |
Performs target interception. |
Performs target interception. |
||
Line 162: | Line 162: | ||
Same as landOnPlanet, duplicate method or no longer in use? |
Same as landOnPlanet, duplicate method or no longer in use? |
||
− | === performMining |
+ | === performMining === |
Performs mining. (Finds, intercepts and shoots asteroids with [[mining]] laser, if fitted.) |
Performs mining. (Finds, intercepts and shoots asteroids with [[mining]] laser, if fitted.) |
||
− | === performTumble |
+ | === performTumble === |
Performs random pitch and roll, 'evasive maneuvers'. |
Performs random pitch and roll, 'evasive maneuvers'. |
||
Line 174: | Line 174: | ||
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. |
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. |
||
− | === setUpEscorts |
+ | === setUpEscorts === |
− | Useful to quickly establish ( |
+ | Useful to quickly establish (by name and number the [[shipdata.plist]] prescribed) escorts, when a ship is introduced to a system. |
− | === suggestEscort |
+ | === suggestEscort === |
Has an escort seek employment and either gets accepted or rejected by the "mother". |
Has an escort seek employment and either gets accepted or rejected by the "mother". |
||
Line 187: | Line 187: | ||
Will turn flashers back on. |
Will turn flashers back on. |
||
− | === wormholeEntireGroup |
+ | === wormholeEntireGroup === |
Wormholes ships in this group. |
Wormholes ships in this group. |
||
− | === wormholeEscorts |
+ | === wormholeEscorts === |
Wormholes official escorts. |
Wormholes official escorts. |
||
− | === wormholeGroup |
+ | === wormholeGroup === |
Wormholes ships in group of which this is a leader. |
Wormholes ships in group of which this is a leader. |
||
== Navigation == |
== Navigation == |
||
− | === getWitchspaceEntryCoordinates |
+ | === getWitchspaceEntryCoordinates === |
Calculates coordinates from the nearest station it can find, or just fly 10s forward. |
Calculates coordinates from the nearest station it can find, or just fly 10s forward. |
||
− | === recallDockingInstructions |
+ | === recallDockingInstructions === |
... |
... |
||
− | === requestDockingCoordinates |
+ | === requestDockingCoordinates === |
− | Requests coordinates from the nearest station it can find (which may be a |
+ | Requests coordinates from the nearest station it can find (which may be a Rock hermit). |
=== setCoordinates:(NSString *)system_x_y_z; === |
=== setCoordinates:(NSString *)system_x_y_z; === |
||
Sets PWM destination coords. |
Sets PWM destination coords. |
||
− | === setCourseToPlanet |
+ | === setCourseToPlanet === |
Selects the nearest planet it can find, reaching desired range 50 km from the planet. |
Selects the nearest planet it can find, reaching desired range 50 km from the planet. |
||
− | === setCourseToWitchpoint |
+ | === setCourseToWitchpoint === |
Sets destination coords to Witchpoint area. |
Sets destination coords to Witchpoint area. |
||
Line 221: | Line 221: | ||
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. |
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 === |
Enables the plotting of manual waypoints. |
Enables the plotting of manual waypoints. |
||
− | === setDestinationToCurrentLocation |
+ | === 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. |
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 === |
− | DockingAbort coordinates... |
+ | DockingAbort coordinates... X distance from the dockingslit? |
− | === setDestinationToStationBeacon |
+ | === setDestinationToStationBeacon === |
Gets station beacon position. |
Gets station beacon position. |
||
− | === setDestinationToTarget |
+ | === setDestinationToTarget === |
Sets destination to target coords. |
Sets destination to target coords. |
||
− | === setDestinationToWitchpoint |
+ | === setDestinationToWitchpoint === |
Sets destination coords to WitchspaceExitPosition. |
Sets destination coords to WitchspaceExitPosition. |
||
− | === setDestinationWithinTarget |
+ | === setDestinationWithinTarget === |
Handy for ramming and racing. |
Handy for ramming and racing. |
||
− | === setPlanetPatrolCoordinates |
+ | === setPlanetPatrolCoordinates === |
Check we've arrived near the last given coordinates. |
Check we've arrived near the last given coordinates. |
||
− | === setSunSkimEndCoordinates |
+ | === setSunSkimEndCoordinates === |
... |
... |
||
− | === setSunSkimExitCoordinates |
+ | === setSunSkimExitCoordinates === |
... |
... |
||
− | === setSunSkimStartCoordinates |
+ | === setSunSkimStartCoordinates === |
... |
... |
||
Line 257: | Line 257: | ||
== Communication == |
== Communication == |
||
− | === broadcastDistressMessage |
+ | === broadcastDistressMessage === |
Locates all the stations, bounty hunters and police ships in range and tells them that you are under attack. |
Locates all the stations, bounty hunters and police ships in range and tells them that you are under attack. |
||
Line 265: | Line 265: | ||
"sendCommsMessage: [thargoid_curses]" |
"sendCommsMessage: [thargoid_curses]" |
||
− | === patrolReportIn |
+ | === patrolReportIn === |
... |
... |
||
Line 279: | Line 279: | ||
=== find.. === |
=== find.. === |
||
− | ==== findNearestPlanet |
+ | ==== findNearestPlanet ==== |
(PlanetEntity *) |
(PlanetEntity *) |
||
Will scan for planetentity. |
Will scan for planetentity. |
||
=== scanFor.. === |
=== scanFor.. === |
||
− | ==== scanForFormationLeader |
+ | ==== scanForFormationLeader ==== |
Locates the nearest suitable formation leader in range. |
Locates the nearest suitable formation leader in range. |
||
− | ==== scanForHostiles |
+ | ==== scanForHostiles ==== |
Locates all the ships in range targetting the receiver and chooses the nearest. |
Locates all the ships in range targetting the receiver and chooses the nearest. |
||
− | ==== scanForLoot |
+ | ==== scanForLoot ==== |
Locates the nearest debris in range. |
Locates the nearest debris in range. |
||
− | ==== scanForNearestMerchantmen |
+ | ==== scanForNearestMerchantmen ==== |
Locates the nearest merchantman in range |
Locates the nearest merchantman in range |
||
Line 299: | Line 299: | ||
Locates all the ships in range and chooses the nearest. |
Locates all the ships in range and chooses the nearest. |
||
− | ==== scanForNonThargoid |
+ | ==== scanForNonThargoid ==== |
Locates all the non thargoid ships in range and chooses the nearest. |
Locates all the non thargoid ships in range and chooses the nearest. |
||
− | ==== scanForOffenders |
+ | ==== scanForOffenders ==== |
Locates all the ships in range and compares their legal status or bounty, and chooses the worst offender. |
Locates all the ships in range and compares their legal status or bounty, and chooses the worst offender. |
||
− | ==== scanForRandomLoot |
+ | ==== scanForRandomLoot ==== |
Locates the all debris in range and chooses a piece at random from the first sixteen found. |
Locates the all debris in range and chooses a piece at random from the first sixteen found. |
||
− | ==== scanForRandomMerchantmen |
+ | ==== scanForRandomMerchantmen ==== |
Locates one of the merchantman in range. |
Locates one of the merchantman in range. |
||
− | ==== scanForRocks |
+ | ==== scanForRocks ==== |
Locates the all boulders and asteroids in range and selects one of up to 16. Returns "TARGET_FOUND" or"NOTHING_FOUND". |
Locates the all boulders and asteroids in range and selects one of up to 16. Returns "TARGET_FOUND" or"NOTHING_FOUND". |
||
− | ==== scanForThargoid |
+ | ==== scanForThargoid ==== |
Locates all the thargoid warships in range and chooses the nearest. |
Locates all the thargoid warships in range and chooses the nearest. |
||
Line 320: | Line 320: | ||
"Check for.." methods are a bit more variable in their output messages. |
"Check for.." methods are a bit more variable in their output messages. |
||
− | ==== checkCourseToDestination |
+ | ==== checkCourseToDestination ==== |
Will return "COURSE_OK" or in case of obstacles on the direct route, "WAYPOINT_SET". |
Will return "COURSE_OK" or in case of obstacles on the direct route, "WAYPOINT_SET". |
||
− | ==== checkDistanceTravelled |
+ | ==== checkDistanceTravelled ==== |
May return "GONE_BEYOND_RANGE" or DESIRED_RANGE_ACHIEVED. |
May return "GONE_BEYOND_RANGE" or DESIRED_RANGE_ACHIEVED. |
||
− | ==== checkGroupOddsVersusTarget |
+ | ==== checkGroupOddsVersusTarget ==== |
Will return "ODDS_GOOD" or "ODDS_BAD". |
Will return "ODDS_GOOD" or "ODDS_BAD". |
||
− | ==== checkForFullHold |
+ | ==== checkForFullHold ==== |
If entity's cargo capacity is reached, will return "HOLD_FULL". |
If entity's cargo capacity is reached, will return "HOLD_FULL". |
||
− | ==== checkForMotherStation |
+ | ==== checkForMotherStation ==== |
Will return "STATION_FOUND" or "NOTHING_FOUND". |
Will return "STATION_FOUND" or "NOTHING_FOUND". |
||
− | ==== checkForNormalSpace |
+ | ==== checkForNormalSpace ==== |
Will return "NORMAL_SPACE" or "INTERSTELLAR_SPACE". |
Will return "NORMAL_SPACE" or "INTERSTELLAR_SPACE". |
||
− | ==== checkTargetLegalStatus |
+ | ==== checkTargetLegalStatus ==== |
Returns "TARGET_CLEAN, "TARGET_MINOR_OFFENDER", "TARGET_OFFENDER", "TARGET_FUGITIVE" or "NO_TARGET". |
Returns "TARGET_CLEAN, "TARGET_MINOR_OFFENDER", "TARGET_OFFENDER", "TARGET_FUGITIVE" or "NO_TARGET". |
||
Line 344: | Line 344: | ||
== Targetting == |
== Targetting == |
||
− | === requestNewTarget |
+ | === requestNewTarget === |
Locates all the ships in range targetting the mother ship, and chooses the nearest/biggest. |
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 |
+ | Changes to a different enemy target if attacked, unless already very involved in attacking another. |
Line 359: | Line 359: | ||
Changes fuel level (only of player entity?) by fuel_numer LY's, max to 7.0 min to 0.0. |
Changes fuel level (only of player entity?) by fuel_numer LY's, max to 7.0 min to 0.0. |
||
− | === initialiseTurret |
+ | === initialiseTurret === |
Prepares the turret. |
Prepares the turret. |
||
Line 381: | Line 381: | ||
Will cause immediate reaction to any changes this makes. |
Will cause immediate reaction to any changes this makes. |
||
− | === setTakeOffFromPlanet |
+ | === setTakeOffFromPlanet === |
Selects the nearest planet it can find and adds entity 10 km from planet, unless there is no planet to be found. |
Selects the nearest planet it can find and adds entity 10 km from planet, unless there is no planet to be found. |
||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
{{stub}} |
{{stub}} |
||
-------------------------------------------------------------------------------- |
-------------------------------------------------------------------------------- |
||
− | [[Category:Oolite |
+ | [[Category:Oolite]] |
Revision as of 21:09, 26 January 2006
Contents
- 1 Methods for AI
- 2 AI
- 3 AI choices
- 4 Perform Action
- 4.1 acceptDistressMessageFrom:(ShipEntity *)other;
- 4.2 becomeEnergyBlast
- 4.3 becomeExplosion
- 4.4 becomeLargeExplosion
- 4.5 dealEnergyDamageWithinDesiredRange
- 4.6 deployEscorts
- 4.7 ejectCargo
- 4.8 enterTargetWormhole
- 4.9 escortCheckMother
- 4.10 fireECM
- 4.11 groupAttackTarget
- 4.12 landOnPlanet
- 4.13 Launch..SomeShip
- 4.14 markTargetForFines
- 4.15 markTargetForOffence:(NSString*) valueString;
- 4.16 messageMother:(NSString *)msgString;
- 4.17 performAttack
- 4.18 performCollect
- 4.19 performDocking
- 4.20 performEscort
- 4.21 performFaceDestination
- 4.22 performFlee
- 4.23 performFlyToRangeFromDestination
- 4.24 performFlyToPlanet
- 4.25 performHold
- 4.26 performHyperSpaceExit
- 4.27 performIdle
- 4.28 performIntercept
- 4.29 performLanding
- 4.30 performMining
- 4.31 performTumble
- 4.32 setSpeedTo:(NSString *)speedString;
- 4.33 setSpeedFactorTo:(NSString *)speedString;
- 4.34 setUpEscorts
- 4.35 suggestEscort
- 4.36 switchLightsOff
- 4.37 switchLightsOn
- 4.38 wormholeEntireGroup
- 4.39 wormholeEscorts
- 4.40 wormholeGroup
- 5 Navigation
- 5.1 getWitchspaceEntryCoordinates
- 5.2 recallDockingInstructions
- 5.3 requestDockingCoordinates
- 5.4 setCoordinates:(NSString *)system_x_y_z;
- 5.5 setCourseToPlanet
- 5.6 setCourseToWitchpoint
- 5.7 setDesiredRangeTo:(NSString *)rangeString;
- 5.8 setDestinationFromCoordinates
- 5.9 setDestinationToCurrentLocation
- 5.10 setDestinationToDockingAbort
- 5.11 setDestinationToStationBeacon
- 5.12 setDestinationToTarget
- 5.13 setDestinationToWitchpoint
- 5.14 setDestinationWithinTarget
- 5.15 setPlanetPatrolCoordinates
- 5.16 setSunSkimEndCoordinates
- 5.17 setSunSkimExitCoordinates
- 5.18 setSunSkimStartCoordinates
- 6 Communication
- 7 Locating stuff
- 7.1 find..
- 7.2 scanFor..
- 7.2.1 scanForFormationLeader
- 7.2.2 scanForHostiles
- 7.2.3 scanForLoot
- 7.2.4 scanForNearestMerchantmen
- 7.2.5 scanForNearestShipWithRole:(NSString*) scanRole;
- 7.2.6 scanForNonThargoid
- 7.2.7 scanForOffenders
- 7.2.8 scanForRandomLoot
- 7.2.9 scanForRandomMerchantmen
- 7.2.10 scanForRocks
- 7.2.11 scanForThargoid
- 7.3 CheckFor..
- 8 Targetting
- 9 Miscellaneous
Methods for AI
Exerpt from the [OoliteAIreference.html]:
AI Script Format
The AI system consists of a stack of state machines (only the top one of which is active), which respond to game events sent to them as messages. They respond by calling a series of methods which affect the behaviour of the entity and possibly trigger changes to the AI by changing the state or (more drastically) the state machine.
Each state machine (or AI script) is described in a property list in either ASCII or XML format, which can be edited with a text editor or with Property List Editor. The structure is of a dictionary containing each of the machine's possible states referenced by an identifying state name. Each state comprises a dictionary of responses to messages the AI might receive, referenced by the message itself. Each response is an array of methods that will be called when the AI receives that message.
The AI function calls within a message handler are separated from each other by a comma. If a function takes a parameter the value is separated from the function name by a colon and a space, and both the function name and value are enclosed in double quotes.
In ASCII format a simple (two-state) machine looks like this:
{ "STATE_1" = { "ENTER" = (); "MESSAGE_A" = ("method1: value", method2, method3); "MESSAGE_B" = (method4, "setStateTo: STATE_2"); EXIT = (); UPDATE = (); }; "STATE_2" = { "ENTER" = (); "MESSAGE_A" = ("method1: another_value", method5); "MESSAGE_B" = (method6, method7, "setStateTo: STATE_1"); EXIT = (); UPDATE = (); }; }
The same script in XML.
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 Q bomb.
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 to engage ECM.
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.
performFlyToPlanet
Used in shuttleAI. combined method to target and fly towards planet?
performHold
Performs idleness while tracking a potential target, speed is set to zero. frustration level 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. frustration level is reset to zero.
performIntercept
Performs target interception.
performLanding
Same as landOnPlanet, duplicate method or no longer in use?
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.
setUpEscorts
Useful to quickly establish (by name and number the shipdata.plist prescribed) escorts, when a ship is introduced to a system.
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.
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... X distance from the 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]"
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 involved in 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.
initialiseTurret
Prepares the turret.
rollD:(NSString*) die_number;
Uses "dice" for random situation use.
Example1, 3 options in SomeAI.plist:
GLOBAL = { ENTER = ("rollD: 3"); "ROLL_1" = (action1); "ROLL_2" = (action2); "ROLL_3" = (action3);}
Example2, 50% chance in script.plist;
conditions = ("d100_number lessthan 50"); do = (action1); else = (action2);
is similar in function.
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.