Callback: Build probability

From GRFSpecs
Jump to navigationJump to search

Build Probability (162)

This callback allows the game to ask for the chances of an action happening on build. (Currently the only action is reversing rail vehicles.)

Return a value between 0...100 (decimal) to indicate the probability of an action happening.

Returning 0 means the action will never happen. Returning 50 means the action will have a 50:50 chance of happening. Returning 100 means the action will always happen.

Variable 10 Meaning
0 Probability of reversing rail vehicle, i.e. facing forward or backward, when purchased*.
.. Reserved.
  • The same random-reverse behaviour can be implemented without the callback, by randomly switching to reversed sprites in the vehicle's varaction 2 chain, but this is inefficient as it typically causes sprites to be duplicated in the grf.

This callback is available from Supported by OpenTTD 14 (g05ed9f56fd)14 Not supported by TTDPatch OpenTTD 14 and above.