Coin Flip

From SimsWiki
Jump to: navigation, search
Coin Flip
Instance:0x01D2
Game Version:The Sims 2


Contents

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 a 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 Smonaff's Jogging mod.

Personal tools
Namespaces

Variants
Actions
Navigation
game select
Toolbox