Difference between revisions of "AI methods"

From Elite Wiki
 
(Added a tonload of methods, still need to check for newer methods.)
Line 1: Line 1:
 
This entry is meant to include the methods not mentioned in the general scripting methods wiki used in AI-scipting mostly.
 
This entry is meant to include the methods not mentioned in the general scripting methods wiki used in AI-scipting mostly.
 
:
 
:
For now this will be a uncohesive list of stuff. ;)
+
For now this will be a uncohesive list of stuff. ;)
 
:
 
:
  
exitAI
 
//Exits the current AI and returns to the AI one below in the [[AIstack]].
 
setStateTo: SOME_STATE
 
//switches AI state to SOME_STATE
 
targetNextBeaconWithCode: XX
 
//sets beacon with code xx as the target.
 
setSpeedfactorTo: x.x
 
//set speed as a fraction of the maxspeed (1.0=100%)
 
setSpeedTo: xx
 
//sets speed to an absolute number, up to maximum speed of vehicle.
 
setRacepointsFromTarget
 
//Navigation for racers
 
performFlyRacepoints
 
//Go!!
 
setDesiredRangeTo: xx
 
//Sets a range as xx metres, used by other methods.
 
performIntercept
 
//Intercept target to within a distance of desiredRange, messages DESIRED_RANGE_REACHED.
 
checkDistanceTravelled.
 
// compares to DesiredRange and messages GONE_BEYOND_RANGE or
 
pauseAI: x
 
//AI waits for x seconds
 
dealEnergyDamageWithinDesiredRange
 
//deals damage equal to weaponEnergy within all entities within desiredRange.
 
becomeExplosion
 
//entity becomes explosion.
 
scriptActionOnTarget
 
//Forces script actions on the current target.
 
switchAITo: someAI.plist
 
//
 
setAITo: someAI.plist
 
//
 
performStop
 
//Come to a complete halt
 
performIdle
 
//do nothing but conserve speed.
 
performAttack
 
//Attacks target
 
groupAttackTarget
 
//Entity will perform attack together with groupmates.
 
performTumble
 
//entity performs a random pitch and roll tumble.
 
setTargetToPrimaryAggressor
 
//sets target to the last object to attack entity.
 
fightOrFleeMissile
 
//entity will use ECM if available or flee.
 
  
{{Stub}}
+
 
 +
''AI_mechanisms''
 +
:
 +
pauseAI: x
 +
  //AI waits for x seconds
 +
:
 +
exitAI
 +
//Exits the current AI and returns to the AI one below in the [[AIstack]].
 +
:
 +
setStateTo: SOME_STATE
 +
//switches AI state to SOME_STATE, message EXIT is sent to current state before exiting.
 +
:
 +
switchAITo: someAI.plist
 +
//exits current AI and starts the new AI.
 +
:
 +
setAITo: someAI.plist
 +
//starts the new AI, current AI will be paused  underneath the new AI, when newAI exits, the firstAI recieves the message RESTARTED in the same state as when the newAI was called.
 +
 
 +
 
 +
 
 +
''Miscellaneous''
 +
targetNextBeaconWithCode: XX
 +
//sets beacon with code xx as the target.
 +
:
 +
checkForFullHold
 +
//Checks the amount of cargo in the calling ship's hold, and if the hold is full sends the HOLD_FULL message.
 +
:
 +
performCollect
 +
//Sets the caller to collect the primary target, assumed to be a scoopable item.
 +
//While in the CONDITION_COLLECT_TARGET condition, the TARGET_LOST message will be received if the target is travelling faster than the collecting ship, and the FRUSTRATED message will be sent after 10 seconds, and thereafter every 5 seconds, while the item has not been collected.
 +
:
 +
becomeExplosion
 +
//entity becomes explosion.
 +
:
 +
scriptActionOnTarget
 +
//Forces script actions on the current target.
 +
:
 +
dealEnergyDamageWithinDesiredRange
 +
//deals damage equal to weaponEnergy within all  entities within desiredRange.
 +
:
 +
setDesiredRangeTo: xx
 +
//Sets desired range to xx metres.
 +
:
 +
becomeEnergyBlast
 +
//Used by QC-bomb, energy wave spreads from entity,  detonating entities caught, who in turn detonate.
 +
:
 +
checkTargetLegalStatus
 +
//Returns: TARGET_CLEAN, TARGET_MINOR_OFFENDER, TARGET_OFFENDER, or TARGET_FUGITIVE.
 +
:
 +
markTargetForFines
 +
//Marks target for fines when docking.
 +
:
 +
switchLightsOn
 +
//Flashers are turned on (default). 
 +
:
 +
switchLightsOff
 +
//Flashers are turned off.
 +
:
 +
fireECM
 +
//Forces ECM use.
 +
 
 +
 
 +
 
 +
 
 +
''Navigation''
 +
setSpeedfactorTo: x.x
 +
//set speed as a fraction of the maxspeed (1.0=100%)
 +
:
 +
setSpeedTo: xx
 +
//sets speed to an absolute number, up to maximum  speed of vehicle.
 +
:
 +
setRacepointsFromTarget
 +
//Navigation for racers
 +
:
 +
performFlyRacepoints
 +
//Go!!
 +
:
 +
setDesiredRangeTo: xx
 +
//Sets a range as xx metres, used by other methods.
 +
:
 +
performIntercept
 +
//Intercept target to within a distance of desiredRange, messages DESIRED_RANGE_REACHED.
 +
:
 +
checkDistanceTravelled.
 +
// compares to DesiredRange and messages GONE_BEYOND_RANGE
 +
:
 +
setDestinationToCurrentLocation
 +
//
 +
:
 +
performFlyToRangeFromDestination
 +
:
 +
 
 +
requestDockingCoordinates
 +
//
 +
:
 +
getWitchspaceEntryCoordinates
 +
//
 +
:
 +
setDestinationFromCoordinates
 +
//
 +
:
 +
performFaceDestination
 +
//Requests the ship stop and face the location given by destination. The message FACING_DESTINATION will be sent when this has been achieved
 +
:
 +
performTumble
 +
//Requests the ship randomly vary it's  pitch and roll until taken out of CONDITION_TUMBLE. Current speed is not affected.
 +
:
 +
performStop
 +
//Come to a complete halt
 +
:
 +
performIdle
 +
//Sets the AI's current state to CONDITION_IDLE and resets the frustration factor to zero.
 +
//Unlike performHold the current speed is not modified.
 +
:
 +
performHold
 +
//Sets the entity's speed to zero, sets the AI's current state to CONDITION_TRACK_TARGET and resets the frustration factor to zero.
 +
:
 +
performLanding
 +
//Used to land ships on planet.
 +
:
 +
landOnPlanet
 +
//...this one too. ?
 +
:
 +
performDocking
 +
//Docks ship-entity with a station-entity.
 +
//Is stated above as non-functioning,
 +
//but is used in fighterInterceptAI.plist of the Behemoth.OXP
 +
:
 +
:
 +
 
 +
 
 +
 
 +
 
 +
 
 +
''Scanning, targetting and attacking''
 +
scanForNearestMerchantmen
 +
//Looks for the nearest merchant vessel (including the player's ship) within scanner range.
 +
//The calling entity remembers the targeted ship, but it does not become the current target.
 +
//It can be made the current target by responding to the TARGET_FOUND message with a call to setTargetToFoundTarget.
 +
:
 +
scanForRandomMerchantmen
 +
//Randomly selects one of the merchant vessels within scanner range.
 +
//The calling entity remembers the targeted ship, but it does not become the current target.
 +
//It can be made the current target by responding to the TARGET_FOUND message with a call to setTargetToFoundTarget.
 +
//The player's ship has an equal chance of being selected, if it is within scanner range. The internal game setting of PIRATES_PREFER_PLAYER is ignored in this function.
 +
:
 +
scanForLoot
 +
//Selects the nearest scoopable item within scanner range.
 +
//The calling entity remembers the item, but it does not become the current target.
 +
//It can be made the current target by responding to the TARGET_FOUND message with a call to setTargetToFoundTarget.
 +
:
 +
scanForRandomLoot
 +
//Selects a random scoopable item from all those within scanner range.
 +
//The calling entity remembers the item, but it does not become the current target.
 +
//It can be made the current target by responding to the TARGET_FOUND message with a call to setTargetToFoundTarget.
 +
:
 +
scanForThargoid                                                 
 +
//Military scan for ships with role of thargoid.
 +
:
 +
scanForNonThargoids
 +
//Thargoid scan for ships with role other than thargoid.
 +
:
 +
setTargetToPrimaryAggressor
 +
//If there is no current primary agressor against the caller, or the caller has already targeted the primary agressor, this function does nothing.
 +
//If there is a primary agressor and the caller is not currently attacking another target, the primary agressor is targeted.
 +
//If the caller is already attacking another entity there is a 75% chance it will continue to attack the current target rather than change its target to the primary agressor.
 +
//The game decides which entity, if any, is currently the primary agressor against the caller.
 +
:
 +
setTargetToFoundTarget
 +
//Makes most recently found target the current target.
 +
:
 +
performFlee
 +
//Sets the caller to flee from the primary target at maximum speed.
 +
//While in the CONDITION_INTERCEPT_TARGET condition, the REACHED_SAFETY message will be received once the primary target is at least as far away as the current value of desired_range.
 +
//If the caller has a cloaking device, it will be activated.
 +
:
 +
performAttack
 +
//Tells the caller to start attacking its current target.
 +
:
 +
groupAttackTarget
 +
//Entity will perform attack together with groupmates.
 +
:
 +
fightOrFleeMissile
 +
//If a missile is in flight and is targetting the AI's ship or another ship in it's group, all ships in the group have their found_target and primary_aggressor  properties changed to that missle.
 +
//The first missle found is dealt with, range and bearing are not taken into account.
 +
//If the AI's ship has an ECM it will use it.
 +
//If not, the AI's ship and any ships in it's group will flee the missle using performFlee with a desired_range of 10 kms.
 +
//In this case the FLEEING message is sent to the current AI state.
 +
:
 +
fightOrFleeHostiles
 +
//Outputs either a FIGHTING or FLEEING message to AI.
 +
:
 +
:
 +
 
 +
 
 +
 
 +
 
 +
 
 +
''Group action''
 +
:
 +
RequestNewTarget
 +
//selects a random hostile vessel?
 +
:
 +
CheckGroupOddsVersusTarget
 +
//Checks odds (by absolute nuimbers or power?) of groups vs adversaries.
 +
//Returns several messages, ODDS_BAD, ODD_GOOD or ODDS_EQUAL.
 +
:
 +
escortCheckMother
 +
//Outputs ESCORTING or NOT_ESCORTING message.
 +
:
 +
messageMother: AI_MESSAGE
 +
//escort (or defenceship?) messages its mother with a AI message such as ATTACKED.
 +
:
 +
scanForFormationLeader
 +
:
 +
performEscort
 +
//escort will deploy in formation and follow mother.
 +
:
 +
deployEscorts
 +
//requests escorts.
 +
:
 +
dockEscorts
 +
//tells escorts to dock with station.
 +
:
 +
patrolReportIn
 +
//Probably simmilar to escorting, used to let patrolls fly in formation. ?
 +
:
 +
wormholeEscorts
 +
//tells escorts to search for the nearest wormhole and exit through it.
 +
:
 +
 
 +
''Stations and carriers''
 +
LaunchDefenceShip
 +
//Dock-capable entity launches a defenceship.
 +
//defenceship type can be defined in shipdata.plist.
 +
LaunchScavenger
 +
//Launches a ship with role scavenger.
 +
LaunchMiner
 +
//Launches a ship with role miner.
 +
LaunchPolice
 +
//Launches a ship with role police.
 +
IncreaseAlertLevel
 +
//Increases alertlevel. Levels are CONDITION_GREEN, YELLOW_ALERT, RED_ALERT.
 +
decreaseAlertLevel
 +
//depricates the alertlevel of entity by one level.
 +
:
 +
 
 +
 
 +
 
 +
''comms''
 +
broadcastDistressMessage
 +
//General call for help. All in range get message 
 +
sendTargetCommsMessage: hello!
 +
//AI sends a comms message to it's current target.
 +
//Comms can use arrays from descriptions.plist as text in square brackets.
 +
commsMessage: [thargoidcurses]
 +
//Sends a comms message to all in range.
 +
 
 +
 
 +
 
 +
{{Stub}}

Revision as of 01:10, 5 August 2006

This entry is meant to include the methods not mentioned in the general scripting methods wiki used in AI-scipting mostly.

For now this will be a uncohesive list of stuff. ;)


AI_mechanisms

pauseAI: x
 //AI waits for x seconds
exitAI
//Exits the current AI and returns to the AI one below in the AIstack.
setStateTo: SOME_STATE
//switches AI state to SOME_STATE, message EXIT is sent to current state before exiting.
switchAITo: someAI.plist
//exits current AI and starts the new AI.
setAITo: someAI.plist
//starts the new AI, current AI will be paused  underneath the new AI, when newAI exits, the firstAI recieves the message RESTARTED in the same state as when the newAI was called.


Miscellaneous

targetNextBeaconWithCode: XX
//sets beacon with code xx as the target.
checkForFullHold
//Checks the amount of cargo in the calling ship's hold, and if the hold is full sends the HOLD_FULL message.
performCollect
//Sets the caller to collect the primary target, assumed to be a scoopable item.
//While in the CONDITION_COLLECT_TARGET condition, the TARGET_LOST message will be received if the target is travelling faster than the collecting ship, and the FRUSTRATED message will be sent after 10 seconds, and thereafter every 5 seconds, while the item has not been collected.
becomeExplosion
//entity becomes explosion.
scriptActionOnTarget
//Forces script actions on the current target.
dealEnergyDamageWithinDesiredRange
//deals damage equal to weaponEnergy within all   entities within desiredRange.
setDesiredRangeTo: xx
//Sets desired range to xx metres.
becomeEnergyBlast
//Used by QC-bomb, energy wave spreads from entity,  detonating entities caught, who in turn detonate.
checkTargetLegalStatus
//Returns: TARGET_CLEAN, TARGET_MINOR_OFFENDER, TARGET_OFFENDER, or TARGET_FUGITIVE.
markTargetForFines
//Marks target for fines when docking.
switchLightsOn 
//Flashers are turned on (default).  
switchLightsOff 
//Flashers are turned off.
fireECM 
//Forces ECM use.



Navigation

setSpeedfactorTo: x.x
//set speed as a fraction of the maxspeed (1.0=100%)
setSpeedTo: xx
//sets speed to an absolute number, up to maximum   speed of vehicle.
setRacepointsFromTarget
//Navigation for racers
performFlyRacepoints
//Go!!
setDesiredRangeTo: xx
//Sets a range as xx metres, used by other methods.
performIntercept
//Intercept target to within a distance of desiredRange, messages DESIRED_RANGE_REACHED.
checkDistanceTravelled.
// compares to DesiredRange and messages GONE_BEYOND_RANGE
setDestinationToCurrentLocation
//

performFlyToRangeFromDestination

requestDockingCoordinates
//
getWitchspaceEntryCoordinates
//
setDestinationFromCoordinates
//
performFaceDestination
//Requests the ship stop and face the location given by destination. The message FACING_DESTINATION will be sent when this has been achieved
performTumble
//Requests the ship randomly vary it's  pitch and roll until taken out of CONDITION_TUMBLE. Current speed is not affected.
performStop
//Come to a complete halt
performIdle
//Sets the AI's current state to CONDITION_IDLE and resets the frustration factor to zero.
//Unlike performHold the current speed is not modified.
performHold
//Sets the entity's speed to zero, sets the AI's current state to CONDITION_TRACK_TARGET and resets the frustration factor to zero.
performLanding
//Used to land ships on planet.
landOnPlanet
//...this one too. ?
performDocking
//Docks ship-entity with a station-entity. 
//Is stated above as non-functioning, 
//but is used in fighterInterceptAI.plist of the Behemoth.OXP



Scanning, targetting and attacking

scanForNearestMerchantmen
//Looks for the nearest merchant vessel (including the player's ship) within scanner range.
//The calling entity remembers the targeted ship, but it does not become the current target. 
//It can be made the current target by responding to the TARGET_FOUND message with a call to setTargetToFoundTarget.
scanForRandomMerchantmen
//Randomly selects one of the merchant vessels within scanner range.
//The calling entity remembers the targeted ship, but it does not become the current target. 
//It can be made the current target by responding to the TARGET_FOUND message with a call to setTargetToFoundTarget.
//The player's ship has an equal chance of being selected, if it is within scanner range. The internal game setting of PIRATES_PREFER_PLAYER is ignored in this function.
scanForLoot
//Selects the nearest scoopable item within scanner range.
//The calling entity remembers the item, but it does not become the current target. 
//It can be made the current target by responding to the TARGET_FOUND message with a call to setTargetToFoundTarget.
scanForRandomLoot
//Selects a random scoopable item from all those within scanner range.
//The calling entity remembers the item, but it does not become the current target. 
//It can be made the current target by responding to the TARGET_FOUND message with a call to setTargetToFoundTarget.
scanForThargoid                                                  
//Military scan for ships with role of thargoid.
scanForNonThargoids
//Thargoid scan for ships with role other than thargoid.
setTargetToPrimaryAggressor
//If there is no current primary agressor against the caller, or the caller has already targeted the primary agressor, this function does nothing.
//If there is a primary agressor and the caller is not currently attacking another target, the primary agressor is targeted.
//If the caller is already attacking another entity there is a 75% chance it will continue to attack the current target rather than change its target to the primary agressor.
//The game decides which entity, if any, is currently the primary agressor against the caller.
setTargetToFoundTarget
//Makes most recently found target the current target.
performFlee
//Sets the caller to flee from the primary target at maximum speed.
//While in the CONDITION_INTERCEPT_TARGET condition, the REACHED_SAFETY message will be received once the primary target is at least as far away as the current value of desired_range.
//If the caller has a cloaking device, it will be activated.
performAttack
//Tells the caller to start attacking its current target.
groupAttackTarget
//Entity will perform attack together with groupmates.
fightOrFleeMissile
//If a missile is in flight and is targetting the AI's ship or another ship in it's group, all ships in the group have their found_target and primary_aggressor  properties changed to that missle. 
//The first missle found is dealt with, range and bearing are not taken into account. 
//If the AI's ship has an ECM it will use it. 
//If not, the AI's ship and any ships in it's group will flee the missle using performFlee with a desired_range of 10 kms. 
//In this case the FLEEING message is sent to the current AI state.
fightOrFleeHostiles
//Outputs either a FIGHTING or FLEEING message to AI.



Group action

RequestNewTarget
//selects a random hostile vessel?
CheckGroupOddsVersusTarget
//Checks odds (by absolute nuimbers or power?) of groups vs adversaries. 
//Returns several messages, ODDS_BAD, ODD_GOOD or ODDS_EQUAL.
escortCheckMother 
//Outputs ESCORTING or NOT_ESCORTING message.
messageMother: AI_MESSAGE
//escort (or defenceship?) messages its mother with a AI message such as ATTACKED.
scanForFormationLeader
performEscort
//escort will deploy in formation and follow mother.
deployEscorts
//requests escorts.
dockEscorts 
//tells escorts to dock with station.
patrolReportIn 
//Probably simmilar to escorting, used to let patrolls fly in formation. ?
wormholeEscorts
//tells escorts to search for the nearest wormhole and exit through it.

Stations and carriers

LaunchDefenceShip
//Dock-capable entity launches a defenceship. 
//defenceship type can be defined in shipdata.plist.
LaunchScavenger
//Launches a ship with role scavenger.
LaunchMiner
//Launches a ship with role miner.
LaunchPolice
//Launches a ship with role police.
IncreaseAlertLevel
//Increases alertlevel. Levels are CONDITION_GREEN, YELLOW_ALERT, RED_ALERT.
decreaseAlertLevel
//depricates the alertlevel of entity by one level.


comms

broadcastDistressMessage
//General call for help. All in range get message   
sendTargetCommsMessage: hello!
//AI sends a comms message to it's current target. 
//Comms can use arrays from descriptions.plist as text in square brackets.
commsMessage: [thargoidcurses]
//Sends a comms message to all in range.



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