Difference between revisions of "OXP howto AI"
(→setTargetToFoundTarget;) |
|||
Line 6: | Line 6: | ||
=== addFuel:(NSString*) fuel_number; === | === addFuel:(NSString*) fuel_number; === | ||
+ | Changes fuel level (only of player entity?) by fuel_numer LY's, max to 7.0 min to 0.0. | ||
+ | === 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. | ||
=== 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. | ||
− | |||
=== checkCourseToDestination; === | === checkCourseToDestination; === | ||
Line 36: | Line 44: | ||
Broadcasts a general message to player. | Broadcasts a general message to player. | ||
Example: | Example: | ||
− | + | "sendCommsMessage: [thargoid_curses]" | |
+ | |||
+ | === dealEnergyDamageWithinDesiredRange === | ||
+ | Needs desiredRange to be set first, then deals [[weaponEnergy]]([[Shipdata.plist]]) damage within this sphere. | ||
+ | |||
+ | === deployEscorts === | ||
+ | Deploys an escort. | ||
=== ejectCargo; === | === ejectCargo; === | ||
Line 49: | Line 63: | ||
=== exitAI; === | === exitAI; === | ||
Exits current AI. | Exits current AI. | ||
− | |||
=== fightOrFleeHostiles; === | === fightOrFleeHostiles; === | ||
Line 60: | Line 73: | ||
(PlanetEntity *) | (PlanetEntity *) | ||
Will scan for planetentity, returns message TARGET_FOUND (or NOTHING_FOUND). | Will scan for planetentity, returns message TARGET_FOUND (or NOTHING_FOUND). | ||
+ | |||
+ | === fireECM === | ||
+ | Used by stations and hermits. | ||
=== getWitchspaceEntryCoordinates; === | === getWitchspaceEntryCoordinates; === | ||
Line 69: | Line 85: | ||
=== initialiseTurret; === | === initialiseTurret; === | ||
Prepares the turret. | 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 === | ||
+ | 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; === | === markTargetForFines; === | ||
Line 85: | Line 107: | ||
=== messageMother:(NSString *)msgString; === | === messageMother:(NSString *)msgString; === | ||
− | |||
Sends a AImessage to the mothership/leader of a group. | Sends a AImessage to the mothership/leader of a group. | ||
Example: | Example: | ||
Line 145: | Line 166: | ||
=== rollD:(NSString*) die_number; === | === rollD:(NSString*) die_number; === | ||
Uses "dice" for random situation use. | Uses "dice" for random situation use. | ||
− | |||
=== scanForFormationLeader; === | === scanForFormationLeader; === | ||
Line 238: | Line 258: | ||
=== setSunSkimStartCoordinates; === | === setSunSkimStartCoordinates; === | ||
+ | |||
+ | === setStateTo: SOMESTATE === | ||
+ | Changes the AI state to SOMESTATE. | ||
=== setTakeOffFromPlanet; === | === setTakeOffFromPlanet; === | ||
Line 253: | Line 276: | ||
=== switchAITo:(NSString *)aiString; === | === switchAITo:(NSString *)aiString; === | ||
Switches entity AI to another *AI.plist, the previous AI will be exited. | Switches entity AI to another *AI.plist, the previous AI will be exited. | ||
+ | |||
+ | === switchLightsOff === | ||
+ | If an entity has [[Flashers]], this command will turn them off. | ||
+ | Default state of Flashers is on. | ||
+ | |||
+ | === switchLightsOff === | ||
+ | Will turn flashers back on. | ||
=== wormholeEntireGroup; === | === wormholeEntireGroup; === | ||
Line 267: | Line 297: | ||
− | stub | + | {{stub}} |
-------------------------------------------------------------------------------- | -------------------------------------------------------------------------------- | ||
− | [[Category:Oolite]] | + | [[Category:Oolite]][[OXP_Howto]] |
Revision as of 16:29, 21 January 2006
Contents
- 1 Methods for AI
- 1.1 acceptDistressMessageFrom:(ShipEntity *)other;
- 1.2 addFuel:(NSString*) fuel_number;
- 1.3 becomeEnergyBlast
- 1.4 becomeExplosion
- 1.5 becomeLargeExplosion
- 1.6 broadcastDistressMessage;
- 1.7 checkCourseToDestination;
- 1.8 checkDistanceTravelled;
- 1.9 checkGroupOddsVersusTarget;
- 1.10 checkForFullHold;
- 1.11 checkForMotherStation;
- 1.12 checkForNormalSpace;
- 1.13 checkTargetLegalStatus;
- 1.14 commsMessage:(NSString *)valueString;
- 1.15 dealEnergyDamageWithinDesiredRange
- 1.16 deployEscorts
- 1.17 ejectCargo;
- 1.18 enterTargetWormhole;
- 1.19 escortCheckMother;
- 1.20 exitAI;
- 1.21 fightOrFleeHostiles;
- 1.22 fightOrFleeMissile;
- 1.23 findNearestPlanet;
- 1.24 fireECM
- 1.25 getWitchspaceEntryCoordinates;
- 1.26 groupAttackTarget;
- 1.27 initialiseTurret;
- 1.28 landOnPlanet;
- 1.29 LaunchSomeship
- 1.30 markTargetForFines;
- 1.31 markTargetForOffence:(NSString*) valueString;
- 1.32 messageMother:(NSString *)msgString;
- 1.33 patrolReportIn;
- 1.34 pauseAI:(NSString *)intervalString;
- 1.35 performAttack;
- 1.36 performCollect;
- 1.37 performDocking;
- 1.38 performEscort;
- 1.39 performFaceDestination;
- 1.40 performFlee;
- 1.41 performFlyToRangeFromDestination;
- 1.42 performHold;
- 1.43 performHyperSpaceExit;
- 1.44 performIdle;
- 1.45 performIntercept;
- 1.46 performMining;
- 1.47 performTumble;
- 1.48 recallDockingInstructions;
- 1.49 requestDockingCoordinates;
- 1.50 requestNewTarget;
- 1.51 rollD:(NSString*) die_number;
- 1.52 scanForFormationLeader;
- 1.53 scanForHostiles;
- 1.54 scanForLoot;
- 1.55 scanForNearestMerchantmen;
- 1.56 scanForNearestShipWithRole:(NSString*) scanRole;
- 1.57 scanForNonThargoid;
- 1.58 scanForOffenders;
- 1.59 scanForRandomLoot;
- 1.60 scanForRandomMerchantmen;
- 1.61 scanForRocks;
- 1.62 scanForThargoid;
- 1.63 scriptActionOnTarget:(NSString*) action;
- 1.64 sendTargetCommsMessage:(NSString*) message;
- 1.65 setAITo:(NSString *)aiString;
- 1.66 setCoordinates:(NSString *)system_x_y_z;
- 1.67 setCourseToPlanet;
- 1.68 setCourseToWitchpoint;
- 1.69 setDesiredRangeTo:(NSString *)rangeString;
- 1.70 setDestinationFromCoordinates;
- 1.71 setDestinationToCurrentLocation;
- 1.72 setDestinationToDockingAbort;
- 1.73 setDestinationToStationBeacon;
- 1.74 setDestinationToTarget;
- 1.75 setDestinationToWitchpoint;
- 1.76 setDestinationWithinTarget;
- 1.77 setPlanetPatrolCoordinates;
- 1.78 setSpeedTo:(NSString *)speedString;
- 1.79 setSpeedFactorTo:(NSString *)speedString;
- 1.80 setSunSkimEndCoordinates;
- 1.81 setSunSkimExitCoordinates;
- 1.82 setSunSkimStartCoordinates;
- 1.83 setStateTo: SOMESTATE
- 1.84 setTakeOffFromPlanet;
- 1.85 setTargetToFoundTarget;
- 1.86 setTargetToPrimaryAggressor;
- 1.87 suggestEscort;
- 1.88 switchAITo:(NSString *)aiString;
- 1.89 switchLightsOff
- 1.90 switchLightsOff
- 1.91 wormholeEntireGroup;
- 1.92 wormholeEscorts;
- 1.93 wormholeGroup;
Methods for AI
acceptDistressMessageFrom:(ShipEntity *)other;
Has police either respond to a distress call, or possibly decide it is too busy or too scared.
addFuel:(NSString*) fuel_number;
Changes fuel level (only of player entity?) by fuel_numer LY's, max to 7.0 min to 0.0.
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.
broadcastDistressMessage;
Locates all the stations, bounty hunters and police ships in range and tells them that you are under attack.
checkCourseToDestination;
Will return "COURSE_OK" or in case of obstacles on the direct route, "WAYPOINT_SET".
checkDistanceTravelled;
May return "GONE_BEYOND_RANGE".
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".
commsMessage:(NSString *)valueString;
Broadcasts a general message to player. Example:
"sendCommsMessage: [thargoid_curses]"
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".
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
Used by stations and hermits.
getWitchspaceEntryCoordinates;
Calculates coordinates from the nearest station it can find, or just fly 10s forward.
groupAttackTarget;
All ships in group will have their targets set to this entity's target and performAttack.
initialiseTurret;
Prepares the turret.
landOnPlanet;
Selects the nearest planet it can find, lands (10km from planet) and 'removes' the entity.
LaunchSomeship
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. 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 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.
patrolReportIn;
pauseAI:(NSString *)intervalString;
Sets AI think-time in seconds.
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
performHold;
Performs idleness while tracking a potential target.
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.
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'.
recallDockingInstructions;
requestDockingCoordinates;
Requests coordinates from the nearest station it can find (which may be a rock hermit).
requestNewTarget;
Locates all the ships in range targetting the mother ship, and chooses the nearest/biggest.
rollD:(NSString*) die_number;
Uses "dice" for random situation use.
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.
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;
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;
Defines acceptable range distance from destination.
setDestinationFromCoordinates;
Enables the plotting of manual waypoints.
setDestinationToCurrentLocation;
Altitude controll?
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.
setSpeedTo:(NSString *)speedString;
setSpeedFactorTo:(NSString *)speedString;
setSunSkimEndCoordinates;
setSunSkimExitCoordinates;
setSunSkimStartCoordinates;
setStateTo: SOMESTATE
Changes the AI state to SOMESTATE.
setTakeOffFromPlanet;
Selects the nearest planet it can find and adds entity 10 km from planet, unless there is no planet to be found.
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.
suggestEscort;
Has an escort seek employment and either gets accepted or rejected by the "mother".
switchAITo:(NSString *)aiString;
Switches entity AI to another *AI.plist, the previous AI will be exited.
switchLightsOff
If an entity has Flashers, this command will turn them off. Default state of Flashers is on.
switchLightsOff
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.
- This article is a stub. You can help EliteWiki by expanding it.