|
|
(One intermediate revision by one user not shown) |
Line 1: |
Line 1: |
− | {{GlobalBHAV
| + | #REDIRECT [[Coin Flip]] |
− | |name=Coin Flip
| + | |
− | |instance=0x01D2
| + | |
− | |expansion=The Sims 2
| + | |
− | }}
| + | |
− | | + | |
− | ==Code==
| + | |
− | ###
| + | |
− | # Group = 0x7FD46CD0, Instance = 0x01D2
| + | |
− | # Title = Coin Flip
| + | |
− | #
| + | |
− | # Format = 8009, Params = 0, Locals = 1
| + | |
− | # Tree type = 0, Header flag = 0, Tree version = 0xFFFF8006, Cache flags = 0
| + | |
− |
| + | |
− | 0: Random Number (Local 0 (coin) := 0 .. < 2); true: 1, false: error
| + | |
− | 1: Local 0 (coin) == 0; true: true, false: false
| + | |
− | | + | |
− | ==Purpose==
| + | |
− | Flipping a coin is a classic way to make decision using chance. There is a 50/50 chance of either "Heads" or "Tails." This global BHAV simulates a coin flip when a random "True" or "False" value is desired. Leaving a decision to chance can offer variety in interactions, which can make them more interesting.
| + | |
− | | + | |
− | ==Usage==
| + | |
− | There are no arguments for this global.
| + | |
− | | + | |
− | Insert [global 0x01D2] Coin Flip when the path of your BHAV should diverge, randomly heading in one of two directions. Set the True Target to the node leading to one path and the False Target to the node of other path. When the Coin Flip returns either "True" or "False," the path of code execution will lead down either of your "True" or "False" paths accordingly.
| + | |
− | | + | |
− | | + | |
− | ==Examples==
| + | |
− | Many Maxis BHAVs seem to use the Random Number for probabilities other than 50/50, but numerous custom mods make use of it. A specific example is in the "Jog" BHAV of [http://www.modthesims.info/member.php?u=219071 Smonaff's] [http://www.modthesims.info/d/199203 Jogging mod].
| + | |