Difference between revisions of "Callback: Build probability"
From GRFSpecs
Jump to navigationJump to searchAndythenorth (talk | contribs) |
|||
Line 1: | Line 1: | ||
− | == Probability |
+ | == 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.) |
||
− | 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 |
+ | 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. |
||
+ | |} |
||
+ | |||
⚫ | |||
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. |
Latest revision as of 20:54, 30 November 2023
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.