Entry Cost Modifiers - KSP-RO/RP-1 GitHub Wiki

Introduction

RP-0 includes support for modifying the entry costs of parts depending on which other parts are unlocked. This is modeled on the CONFIG entry cost modifiers of RealFuels, and serve three main purposes:

  1. Upgrades can have their entry costs reduced if you bought the original part (AJ10 Mid engine is cheaper to research if you already researched AJ10 Early).
  2. Identical items can have their entry costs eliminated (if you bought the FASA LR89, the stock LR89 should be free to unlock, and vice versa).
  3. Parts which share a base research cost can be set such that the player only pays the cost once (you only have to pay once to research LEO-reentry-class ablation, and once you do any other part that uses it will be cheaper to unlock. E.g. unlock the 1.25m LEO-rated heat shield, and the 0.625m version, the 2m version, and the Mercury and Vostok capsules will all be cheaper to unlock).

Implementation

Entry cost modifiers go in the ENTRYCOSTMODIFIERS node. They are set per part, using a PART{} subnode with its name being the name of the part, and some modifiers. Note that the name of the part should have all _ and . replaced by -

Examples

Example 1, the LR89

The link doesn't work anymore maybe this one at least points to the correct file

First thing to note: There's one PART per actual ingame part. Each PART names what part it covers, and then has both a subtractors node and a multipliers node.

  • Subtractors are simple: for each part listed in the subtractor node, if it is unlocked, that amount specified is subtracted from the entry cost.

  • Multipliers are too: for each part listed in the node, if it is unlocked, the entry cost is multiplied by that multiplier.

You'll note here that the LR79 gives a subtraction to the LR89 entry cost: that models the fact that if you unlock an LR79, you've done much of the research required to have a working LR89 (and vice versa--the LR79 PART node in ENTRYCOSTMODIFIERS includes a similar link to the LR89s). In addition, this example shows that once you unlock one LR89, the other's cost goes to zero (a multiplier of 0).

Example 2, LEO heatshields

This example shows, using some MM processing to cut down on copying and pasting, the setting up of a class. First, we specify each part that is going to have this class as a subtractor: we create the node, name the part, and then tag it for later use. Next, we go through and apply a modifier to all tagged parts. The purpose of this is to give a 16000 "setup fee" that you only pay once to unlock LEO reentry ablation. Once you've paid it, all other parts that use that are now 16000 cheaper to unlock. To do so we state that every part in the class will have a subtractor of 16000, but we also cap the total amount that can be subtracted at 16000 so you can't "double up" by unlocking two parts, and then getting 32000 off the third.

Tips

In order to ensure that the player doesn't lose out by unlocking one part before another, it's worth making sure that all modifiers are mutual: if the early avionics 1m part gives you 1000 off the 2m unit, the 2m unit should give you 1000 off the 1m unit.