Skip to content

SpawnVessel Behaviour

Jeremie Rossignol edited this page Feb 11, 2016 · 11 revisions

Behaviour for spawning one or more Vessels on land or in orbit. Note that one needs to be very careful when putting together .craft files for use with this parameter:

  • Be careful what parts are used in the construction of the vessel. Using a part from an add-on effectively means that the contract will be dependent on the player having that add-on.
  • Be careful of other add-ons that are installed that add part modules to parts you are using. A couple specific examples:
  • The mod MechJeb and Engineer for all adds the MechJeb/KER PartModule to all probe cores and command modules. This will make your mod incompatible for players not using MechJeb/KER.
  • RemoteTech replaces the stock antenna PartModule with its own. Unfortunately, this is a two way street - building a craft without RemoteTech means that the resulting craft won't have the correct antenna modules if the player is using RemoteTech.
  • AntennaRange does the same thing as RemoteTech.
BEHAVIOUR
{
    name = SpawnVessel
    type = SpawnVessel

    // Use this to defer the creation of the vessel until the flight scene is
    // loaded.  This works around the issue that the vessel is initially loaded
    // in the actual VAB building, and if the vessel is too big will be visible
    // as it clips outside the VAB.  However, vessels with certain parts (the
    // RTG for sure) fail on a resource exception when loaded - loading them
    // earlier works around the issue slightly.  This is a stock bug that will
    // hopefully be fixed in the near future (the problem exists in KSP 1.0.4
    // for sure).
    //
    // Type:      bool
    // Required:  No (defaulted)
    // Default:   false
    //
    deferVesselCreation = false

    // The VESSEL node indicates a vessel to spawn and can be specified
    // multiple times.
    VESSEL
    {
        // If the name is not supplied, defaults from the name within the
        // craft file.  Note that this name behaves like the
        // VesselParameterGroup define field - in other words, you may
        // refer back to this vessel by this name in VesselParameterGroup
        // parameters.
        //
        // Type:      string
        // Required:  No (defaulted)
        //
        name = A vessel

        // Path to the .craft file (relative to the GameData/ directory).
        //
        // Type:      string
        // Required:  Yes (unless craftPart is supplied)
        //
        craftURL = ContractConfigurator/Little Rocket.craft

        // The name of a single part build the craft from.  Note that spawning
        // height does not get properly detected when using this method, so a
        // manual height may need to be supplied (using the height attribute.
        //
        // Type:      AvailablePart
        // Required:  Yes (unless craftURL is supplied)
        //
        craftPart = fuelTank_long

        // Location of the flag to use.  Uses the players flag for the current
        // game if not specified.
        //
        // Type:      string
        // Required:  No (defaulted)
        //
        flagURL = Squad/Flags/satellite

        // The type of vessel (affects display in the tracking station).
        //
        // Type:      VesselType
        // Required:  No (defaulted)
        // Values:
        //     Base
        //     Lander
        //     Probe
        //     Rover
        //     Ship (default)
        //     Station
        //     Unknown
        //
        vesselType = Rover

        // Whether the vessel should show up as owned or unowned.  If it is
        // owned, then it will be immediately selectable.
        //
        // Type:      bool
        // Required:  No (defaulted)
        // Default:   false
        //
        owned = false

        // Where the vessel should spawn - defaulted from the contract if
        // not supplied.
        //
        // Type:      CelestialBody
        // Required:  No (defaulted)
        //
        targetBody = Kerbin

        // The ORBIT node indicates the orbit the vessel is in.  The
        // easiest way to get this information is to create the orbit
        // you want in KSP (using HyperEdit or good old fashioned
        // rocket science), and save your game.  In the persistant.sfs
        // file, search for your craft, and find the ORBIT node.
        //
        // Note that REF represents the reference body - but will be
        // overriden by the targetBody.
        // 
        // The ORBIT node is not used for landed vessels.
        ORBIT
        {
            SMA = 1449999.99996286
            ECC = 1.07570816555399E-05
            INC = 0
            LPE = 270.690311604893
            LAN = 1.93635924563296
            MNA = 1.55872660382504
            EPH = 31.3999999999994
            REF = 1
        }

        // If you wish to specify a landed vessel, you must also 
        // supply the following values:

        // Specifies the location of the spawn point via lat/lon.
        //
        // Type:      double
        // Required:  See above
        //
        lat = -0.096992729723051
        lon = 285.425467968966

        // The location name.  Use this instead of lat/long coordinates
        // to specify coordinates based on the location of a PQS city.
        //
        // Type:      string
        // Required:  No
        //
        pqsCity = KSC

        // An optional offset vector from the center of the PQS City.
        // Use this to make your Kerbal relative to the PQS City,
        // which will make it work even for RSS or other mods that may
        // move the PQS city.  To get the offset coordinates, position
        // your ship/kerbal at the desired location and go to the
        // Location tab in the Contract Configurator debug window
        // (alt-F10).
        //
        // Type:      Vector3d
        // Required:  No
        //
        pqsOffset = 447.307865750742, 5.14341771520321E-05, 24.9700656982985

        // Only applies to landed vessels, use to override the altitude.
        // If not supplied, defaults to the terrain altitude.  Note that this
        // is the altitude above sea level.
        //
        // Type:      double
        // Required:  See above
        //
        alt = 67.6843734193826

        // Additional height that should be added to the vessel when spawning.
        // Use this when the location chosen doesn't seem to have the right
        // auto-calculated terrain height, or when using craftPart with larger
        // parts.
        //
        // Type:      float
        // Required:  No, defaulted
        // Default:   0.0 (if craftURL is used)
        //            2.5 (if craftPart is used)
        //
        height = 5.0

        // Specifies the heading of the vessel in degrees (0 = N, 90 = E...).
        //
        // Type:      float
        // Required:  No (defaulted)
        // Default:   0.0
        //
        heading = 180.0

        // Specifies the roll of the vessel in degrees (positive = roll right).
        //
        // Type:      float
        // Required:  No (defaulted)
        // Default:   0.0
        //
        roll = 45.0

        // Specifies the pitch of the vessel in degrees (positive is nose up)
        //
        // Type:      float
        // Required:  No (defaulted)
        // Default:   0.0
        //
        pitch = 30.0

        // A CREW node indicates one or more crew members to add to the
        // vessel.  The CREW node may be specified multiple times.
        CREW
        {
            // Name for the crew member - if not provided, one is
            // auto-generated.
            //
            // Type:      string
            // Required:  No
            //
            name = Patrick R. Kerman

            // Gender of the kerbal.  If not specified, will be assigned a random
            // gender.
            //
            // Type:      ProtoCrewMember.Gender
            // Required:  No
            // Values:
            //     Male
            //     Female
            //
            gender = Female

            // Whether or not the Kerbal should be added to the roster on 
            // recovery.
            //
            // Type:      bool
            // Required:  No (defaulted)
            // Default:   true
            //
            addToRoster = true

            // Number of crew to generate from this node.  Shouldn't be
            // supplied if name is supplied.
            //
            // Type:      int
            // Required:  No (defaulted)
            // Default:   1
            //
            count = 1
        }
    }
}
Clone this wiki locally