Difference between revisions of "Callback: Build probability"

From GRFSpecs
Jump to navigationJump to search
(Add CB 162 (third time lucky?))
 
Line 1: Line 1:
 
== Build probability (e.g. Reverse rail vehicle on build) (162) ==
 
== Build probability (e.g. Reverse rail vehicle on build) (162) ==
   
  +
This callback assigns rail vehicles a random chance of being built facing forward or backward (reversed) when purchased.
(Details to be added)
 
  +
  +
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 {{ottdp|14|no|ottdrev=g05ed9f56fd}} OpenTTD 14 and above.
 
This callback is available from {{ottdp|14|no|ottdrev=g05ed9f56fd}} OpenTTD 14 and above.

Revision as of 20:41, 30 November 2023

Build probability (e.g. Reverse 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.