Difference between revisions of "Callback: Build probability"

From GRFSpecs
Jump to navigationJump to search
Line 1: Line 1:
== Build probability (e.g. Reverse rail vehicle on build) (162) ==
+
== Probability of reversing rail vehicle on build (162) ==
   
 
This callback assigns rail vehicles a random chance of being built facing forward or backward (reversed) when purchased.
 
This callback assigns rail vehicles a random chance of being built facing forward or backward (reversed) when purchased.

Revision as of 20:43, 30 November 2023

Probability of reversing rail vehicle on build (162)

This callback assigns rail vehicles a random chance of being built facing forward or backward (reversed) when purchased.

Return a value between 0...100 (decimal) to indicate the probability of being reversed.

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.