PHost - Friendly Codes

PHost 4.1h



Friendly codes are three-letter codes serving as a password for a planet's or starship's computer systems. Two objects having the same friendly code appear friendly to each other.

Some friendly codes activate special missions for the planet or the starship. PHost aims to move away from using friendly code for these cases, towards extended missions and commands, but the friendly codes are still supported.

Friendly codes can contain any printable character from the ASCII set. This includes all latin letters in upper and lower case, numbers, and many punctuation characters, but disallows control characters and high-ASCII characters such as umlauts, cyrillic letters, etc.

Who has which Friendly Code

Starships and planets have their own Friendly Code. Starbases always use the same friendly code as the planet they orbit.

Mine fields are controlled by the planet belonging to the owner of the mine field and being located nearest to the mine field center.

Universal Minefield Friendly Code


Each minefield has an own, "local" friendly code (as above). In addition, you can define a "universal" minefield friendly code. For this, set a planet to mfX, where X can be any character. Ships can then also use this code to achieve a friendly code match with your minefields, for example to safely pass through them.

This is useful when you want to grant a (not-yet-)ally free flight through your minefields without granting him access to your planets.

mfX is not considered a special friendly code that is exempt from Friendly Code Matching (because it is actually intended for matching).

When several planets owned by one player have an mfX friendly code, the planet with the highest Id number specifies the universal minefield friendly code. When Bird Men try to change a planet's friendly code to mfX using Super Spy Deluxe, that will trigger an Ionic Pulse to decloak ships orbiting that planet (if possible, see mission description).

(v4.1g/3.5g:) The AllowUniversalMinefieldFCode option can be used to disable all special treatment of the mfX friendly codes. When this option is off, using a mfX will neither work as a Universal Minefield Friendly Code, nor automatically trigger an Ionic Pulse.

Friendly Code Matching

What happens when friendly codes match? (This list is expected to be complete.)

  • A starbase's Load Torpedoes mission will load torpedoes onto ships with matching code, Refuel Ships will refuel them, Unload will unload them.
  • A starbase's Force Surrender mission will force ships with matching code to give up and surrender.
  • Objects with matching codes will not attack each other in combat.
  • Ships that match a minefield friendly code will not trigger a mine. Webs will not drain fuel from ships with matching codes.
  • Ships that match the friendly code of a Firecloud will be allowed to pass the Chunnel.
  • Ships that match the friendly code of a minefield will not sweep the field.
  • Fed ships that match the friendly code of a starbase will be allowed to use parts from that base for Super Refit.
  • Ships that match the friendly code of a planet will be allowed to beam up minerals from that planet, use the planet's supplies for Training and build torpedoes or fighters.
  • Ships that match the friendly code of a planet can Colonize there even if the planet is already inhabited by another player.
  • Ships that match the friendly code of a repair ship can be repaired by it; ships that match the friendly code of an academy ship can receive crew from it.

Now when are two friendly codes are considered matching? When they are identical, character by character, of course. Friendly codes are case-sensitive, a lower-case 'a' doesn't match an upper-case 'A'. However, in PHost, there's one big exception: Special Friendly Codes Never Match!

If a ship has a special friendly code (either registered friendly codes or the unregistered ones) then it will never match the friendly code of another ship, planet, or minefield. For example, if a ship has a friendly code of mkt then it will fight an enemy ship even if the enemy ship also has a friendly code of mkt. This holds true even for unregistered games, and does not distinguish between planet and ship codes (a ship with bum will not match another ship with bum, although bum has a special effect only on planets).

All the special friendly codes defined by PHost are listed below. Add-ons may define their own special friendly codes. At host-side, these codes are listed in a file xtrfcode.txt. Players can use the send fcodes command to request a copy of that file. The file format is described below.

Back to top

Special Friendly Codes

All special friendly codes are case-sensitive in PHost, that is, you must match the spelling exactly to trigger the special action. In HOST, some friendly codes are case-insensitive.


ald, alt, alm Registered Players Only

When used on a Merlin Class Alchemy ship, tells it to produce only one mineral (3 supplies -> 1 Duranium, Tritanium or Molybdenum). The last letter of the friendly code is the mineral to produce.

(v4.0k/3.4m:) When used on a Refinery or Advanced Refinery ship, tells it to consume only one mineral. The other minerals are not converted into fuel. The last letter is the mineral to consume.

Precondition: These codes only have an effect on ships having an appropriate alchemy function. These friendly codes only work for registered players. The ship does not need fuel.

Relevant PControl Stage: Alchemy

Relevant Configuration Option: AllowAlchemy

See also: naX etc.


("Beam down money") The ship will beam all its money down to the planet it is orbiting. You can also use the Beam Down Credits mission or the unload command instead of this friendly code. If you do not own the planet, the planet owner will receive a message that you donated him money.


  • ship is orbiting a planet
  • The ship does not need fuel for bdm

Relevant PControl Stage: CargoDump

btf, btm, btt

("Beam Transfer") The starship will transfer cargo to enemy (foreign) ships at the same location in space. If there are several ships, the cargo is split in equal portions.

  • btf Transfer fighters
  • btm Transfer money
  • btt Transfer torpedoes

You can also use the Transfer Torpedoes, Transfer Fighters and Transfer Fighters missions instead of these friendly codes. (v4.0h:) Alternatively, you can use the command transfer to transfer fighters, money and torpedoes like with a normal ship-to-foreign-ship transfer.

These friendly codes will transfer stuff to all foreign ships, including cloaked ones.


  • ship has goods to transfer
  • at least one foreign ship at the same position which can carry the transferred goods (i.e. matching weapon type for btt and btf); can be cloaked.
  • You do not need fuel for this action

Relevant PControl Stage: BeamTransfers

cln Registered Players Only

("Clone") Clones the ship. The ship must be in orbit around a planet with starbase. Cloning overrides a pending normal build order. Cloning costs the normal mineral amounts, but twice as much money (for details, see the ShipCloneCostRate config option).

Preconditions for cloning:

  • Cloning must be enabled (AllowShipCloning).
  • This only works for ships you (the ship owner) can not build normally.
  • The starbase must have appropriate tech levels.
  • The starbase must have enough resources. Clone orders walk the build queue like any other build order; resources are allocated in the turn the clone order will be finally performed. Clone orders that do not have enough minerals will be marked with a ! in build queue messages.
  • You must own the starbase, or the owner must have granted you the planet level of alliance.
  • The ship must not be unclonable.
  • The ship cannot move while it wants to be cloned (its warp speed will be reset to zero).

Normally, the Crystals and Privateers can not clone. PHost does not explicitly forbid it, but with the default configuration, cloning is far too expensive for them.

When a ship is cloned, build points are deduced from the starbase owner. This may not be the same player as the owner of the ship being cloned (and thus, the owner of the new ship) if the ship is using a planet-level alliance.

Relevant PControl Stage: ShipBuildOrders (ship must fulfill most preconditions in this stage to be added to the build queue), ShipBuilding_1, ShipBuilding_2 (ship will be cloned, and minerals/cash must be available in these stages).

Relevant Configuration Option: AllowShipCloning


("Give Ship") Gives a ship away to another race. The receiving race is encoded in the third letter of the friendly code:

  • gs1 gives the ship to the Feds
  • gs2 gives the ship to the Lizards
  • ...
  • gsa gives the ship to the Rebels
  • gsb gives the ship to the Colonies

Ship givings are simultaneous, that is you can exchange a ship with a friend by setting the appropriate gsX codes on both ships.

This command is perfectly identical to the give ship command; see there for more details. Note that, unlike that command, this friendly code cannot be disabled by the host in PHost up to version 4.0i (in 4.0j and later, CPEnableGive affects gsX as well).


  • The receiving race must have ship or planet at the same location (type, cloak, cargo etc. does not matter).
  • Ship must not be ungiveable
  • The ship does not need fuel for the trade.

Relevant PControl Stage: TransferOwner

Relevant Configuration Option: CPEnableGive


Engages the hyperdrive, on ships that have one. See there for details.


("Load Fighter Minerals") Automatically loads minerals for building fighters, and build these fighters. This code replaces the Build Fighters mission, which requires you to manually load the minerals. Unlike that mission, it can also works for other races. Generally, lfm is considered a special ability of Rebels, Robots and Colonies, but PHost 4.0e and later allow hosts to enable it to everyone.

Actually, this action has two parts:

  • First, it loads up minerals and supplies from the planet into the ship's cargo hold. Each fighter requires 3 kt Tritanium, 2 kt Molybdenum and 5 supplies (configurable, ShipFighterCost).
  • Second, it builds fighters from the minerals in cargo. In particular, this will also process the minerals you loaded into the cargo hold manually.

You can also use the Gather-build fighters mission instead of this friendly code.


  • ship has fighter bays
  • ship has fuel
  • fighter building is enabled for ship owner (AllowBuildFighters)
  • ship is at a friendly planet (otherwise, only minerals from cargo hold will be processed)

Relevant PControl Stage: BuildFighters

Relevant Configuration Option: AllowBuildFighters

mdX Registered Players Only

("Mine Drop") These codes modify the Lay Mines and Lay Web Mines missions; see there for more information. They specify how many torpedoes to convert into mines:

  • mdq converts 1/4 (quarter) of all available torpedoes
  • mdh converts 1/2 (half) of all available torpedoes
  • md1 converts 10 torpedoes
  • md2 converts 20 torpedoes
  • ...
  • md9 converts 90 torpedoes
  • md0 converts 100 torpedoes

mdq and mdh will truncate the fractional result of their computation, i.e. mdq on a ship with 15 torps will lay 3 torpedoes.

You can also use the Lay Minefield or Lay Web Minefield extended mission instead of this friendly code. These missions allow you to directly specify the number of mines to lay.

miX Registered Players Only

("Minefield Identity") These codes modify the Lay Mines and Lay Web Mines missions. You may lay a mine field belonging to another player. The third letter of the friendly code is the race in whose identity to lay the mines (mi1=Federation, mi2=Lizards etc. to mia=Rebels, mib=Colonies (lower case!)).

==> Unless you have a mine-level alliance, the laying ship will be an enemy after the mine laying, and be in danger of a mine hit.

Availability of this friendly code is configured using the AllowMinefieldIdentity or MineIdNeedsPermission configuration options, which allow disabling the code altogether or restricting it to alliances.

You can also use the Lay Minefield or Lay Web Minefield extended mission instead of this friendly code. These missions allow you to specify the intended owner of the new minefield.

Note that some front-ends have problems displaying non-crystal web mines and show them as normal mines. Look at the mine sweep messages in this case. Programs that read util.dat should show them correctly.

Relevant Configuration Options: AllowMinefieldIdentity, MineIdNeedsPermission

mkt Registered Players Only

("Make Torpedoes") Builds torpedoes. This codes builds as many torpedoes as possible, it requires the same amounts of money and minerals as on the starbase. However, using this code, your ships get independent from high-tech bases to resupply their arms.

You can also use the Gather-build Torpedoes or Build Torpedoes mission instead of this friendly code.


  • ship has torpedo launchers
  • ship has fuel
  • owner of ship is registered
  • ship has enough minerals and money to build torpedoes (unlike lfm, minerals are not gathered automatically!).

msc Registered Players Only

("Mine Scoop") This modifies the Mine Sweep mission. When the ship is inside an own minefield, the mines are gathered back into cargo hold and turned into torpedoes again. It does not matter what torpedo type was originally used to lay the mine field. The ship needs torpedo launchers and beams for this.

You can also use the Scoop Torpedoes mission instead of this friendly code.


  • ship has fuel
  • ship has beams and torpedo launchers
  • ship is inside an own minefield
  • ship has Mine Sweep mission

Relevant PControl Stage: MineSweeping

Relevant Formulas: Mine Sweeping.


("No Alchemy") When used on an alchemy, refinery or advanced refinery ship, tells it not to do alchemy. Thus the ship can be used as a normal freighter.

In HOST, this friendly code is reported not to work on advanced refinery ships.

nad, nat, nam Registered Players Only

When used on a Merlin Class Alchemy Ship, tells it to produce only two minerals (6 supplies -> 2 Minerals). The last letter of the friendly code is the mineral not to produce.

(v4.0k/3.4m:) When used on a Refinery or Advanced Refinery ship, tells it to consume only two minerals. The last letter of the friendly code is the mineral not converted into fuel.

Precondition: These codes only have an effect on ships having an appropriate alchemy function. These friendly codes only work for registered players. The ship does not need fuel.

Relevant PControl Stage: Alchemy

Relevant Configuration Option: AllowAlchemy

See also: alX etc.


Ships that have the Boarding ability (by default, all Privateer and Crystal ships) usually board a ship when they try to tow it while it has no fuel. This friendly code on the towing ship prevents that. This way, Privateers and Crystals can tow friendly fuel-less ships without boarding them.


Prevents use of torpedoes or fighters in battle. The ship will only use its beam weapons. This is useful when fighting a weak ship you wish to capture.

For the battle, the ship will appear to have the correct number of torpedo launchers/bays but no ammo in PHost. In HOST, NTP reports the correct amount and type of ammo, but no torpedo launchers/fighter bays.

pop Glory-Device ships only

Sets off the Glory Device at the end of the turn (after movement, before combat).


  • Ship needs fuel to detonate

Relevant Formulas: Glory Device.

trg Glory-Device ships only

Triggers the Glory Device when a cloaked ship belonging to the primary enemy is found at the same location. With the Kill mission, any cloaked enemy ship triggers the device.


  • Ship needs fuel to detonate
  • The glory device only triggers when it finds a cloaked enemy ship (as defined by primary enemy or mission). It does not detonate when it finds uncloaked ships, nor when the Glory ship owner offers ship level to the cloaked ship owner.
  • With the High-damage Glory Device (which is the "smaller" of the two Glory Devices), trg does not find cloaked ships that have the Anti-cloak Immunity function or which are immune through the AntiCloakImmunity configuration option.

Relevant Formulas: Glory Device.


The ship will scan for wormholes. You'll receive the scanner report sub space messages next turn.

You do not need fuel to scan for wormholes. With ExtendedSensorSweep enabled, Sensor Sweep will also find wormholes, so you do not need this friendly code.

Relevant Configuration Option: WrmScanRange

Relevant PControl Stage: WormholeScan

Relevant Formulas: Scanning for Wormholes.


If the ship reaches a wormhole entry after normal movement, it will attempt to travel through the wormhole. To move through the wormhole, the ship needs about as much fuel as it needs to travel 1/100 of the distance traveled (configurable, WrmTravelDistDivisor). If this fuel is not available, the ship will move unpredictably and get heavily damaged.


  • ship is at wormhole after movement
  • ship is not training
  • the ship needs enough fuel for the travel. If it has too little fuel, it will still enter the wormhole, but bad things will happen to the ship.

If WrmVoluntaryTravel is disabled, wormhole travel is mandatory and the ship just needs to be in range of the wormhole (inside entry radius) to be sucked through the wormhole.

Relevant PControl Stage: Movement

Relevant Formulas: Wormhole Travel.

Planets and Bases


("Attack") Directs the planet to attack ships (similar to the Kill mission on starships).

The Super Star Destroyer is immune against this friendly code, as are the Klingons and Rebels.

Relevant Configuration Options: AllowPlanetAttacks, PlanetsAttackKlingons, PlanetsAttackRebels.


("Beam Up Money") The planet will beam up all money to alien ships in orbit (including cloaked ones). If there are multiple ships, it will split the money into equal portions.


  • planet has cash
  • foreign ships orbit the planet. It does not matter whether they're cloaked. The ship owner will receive a message.

Relevant PControl Stage: BeamUpCredits


("Configuration") Tells PHost to send you the pconfig.src file within your utilx.dat next turn. You can also use the send config command instead of this friendly code.

A number of add-ons will react on this friendly code (by sending configuration messages), too.

In HOST, this friendly code causes HOST to send you the configuration as a set of sub-space messages. PHost's configuration is too large to fit in sub-space messages.

dmp Registered Players Only

("Dump") When the planet has a starbase, recycles all starship parts (hulls, beams, torpedo launchers, engines) in starbase storage. This returns the minerals used to build these parts, as per RecycleRate, but not the money.

Parts required by the current build order are not affected.

Precondition: this code only works for registered players

Relevant PControl Stage: DumpOldBaseParts


("Mine Field", the third character can be anything) Universal Minefield Friendly Code.


("Nuke") Like ATT, but also attacks fuel-less ships. Fuel-less capital ships owned by the Bird Men can not be attacked, though.


("Priority Build") Tell PHost which build orders you want to have executed first. X is a digit between 1 and 9. You can use each of these 9 friendly codes to designate up to 9 priority builds, PB1 being the most important (first). This friendly code is enabled with the AllowPriorityBuild config option. The exact interpretation depends on the build queue mode (BuildQueue).

  • Fifo and PAL queue: the PB build orders are moved to the head of the build queue when you set these friendly codes. You can then reset the friendly codes.
  • PBP queue: when you are granted a priority build, PHost performs your most important build order (PBx, with smallest x). Hence you have to keep these friendly codes all the time, because you don't usually know when you'll be granted a priority build.

Full details are on the Build Queue page.

Relevant Configuration Option: AllowPriorityBuild

Relevant PControl Stage: ShipBuildOrders

Unimplemented Friendly Codes

The following HOST friendly codes are not implemented in PHost. In addition, HOST processes some friendly codes case-insensitive and some not; in PHost, all codes are case-sensitive.

ffX, eeX, FFX

("Locking Alliance Friendly Codes") These friendly codes are not implemented in PHost. Alliances work completely different in PHost. PHost's alliance feature predates that of HOST by about two years.

For details, see Alliances.


This undocumented HOST friendly code is not implemented in PHost. It causes the ship to build fighters but not beam up stuff. (Actually, any variation of lfm containing a capital letter has that effect.)


("No Config") In HOST, this friendly code tells HOST not to send the host configuration messages. PHost never sends its configuration file when not asked to. See con.

Back to top


Add-on or external programs sometimes introduce new special friendly codes to implement new behavior. PHost's handling of special friendly codes with respect to matching (i.e., special friendly codes never match) is a simple and consistent rule for players to follow. PHost implements a mechanism that allows it to recognize an add-on's new friendly codes as being special for the purposes of matching.

The friendly codes are listed in a file xtrfcode.txt which must reside in the game or root directory. It contains a list of all the special codes. Hosts should update it according to the add-ons they use. Since version 3.4, PHost automatically updates the file to include the PHost special codes (before, it would include them only in copies sent to players).

The file consists of a list of tokens with up to three characters, separated by whitespace and/or newlines. A three-character token defines just that friendly code special, shorter tokens declare special everything that starts with these characters. Matching is case-sensitive.

For example, if the xtrfcode.txt file contains


then friendly codes of BJG, AJG, RJG as well as any friendly code that begins with J are considered special and will never match another friendly code. The above example may be suitable for use with the "Jumpgate" add-on (although the J code is overly broad: only codes consisting of J followed by a number are considered special by "Jumpgate", but there's no shorter way to describe that exactly than listing them all).

Here is another example xtrfcode.txt file that may be used with the RacePlus add-on (a bit broader than needed, too):


Finally, another example xtrfcode.txt file that may be used with the FHost add-on:


Back to top

Last updated 31 May 2015.

Mail for support, ideas, bug reports, questions. Contact Details