Difference between revisions of "Callback: Build probability"
From GRFSpecs
Jump to navigationJump to searchAndythenorth (talk | contribs) (Add CB 162 (third time lucky?)) |
|||
(2 intermediate revisions by one other user not shown) | |||
Line 1: | Line 1: | ||
− | == Build |
+ | == 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.) |
||
− | (Details to be added) |
||
+ | |||
+ | 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 {{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.