Up: Mouse Over Toggle   [Contents][Index]


9.10.1 Randomized Message

Component: RandomizedMessage

This component randomly selects a message to be sent from the list, each with a different probability. The probability of any one message being sent is reduced by adding more messages, the ’Chance’ values do not need to add up to 1. When ’RollRandom’ is called, we will go through each item in the list starting with the first, and compare it with the roll of an imaginary 100-sided die (represented by values between 0 and 1). We select the first item we find with a greater value and then optionally stop looking. To use, first add some entries to the ’Randomized Messages’ list. For example, you could add a Sounder component, and a Destructible component, and add both the ’PlaySound’ and ’Destruct’ messages to the list, and adjust their chance. When you want a message to be randomly selected, send the ’RollRandom’ message to this object.

Message on RandomizedMessage: RollRandom ()

Selects a single message from those supplied above. There is a tiny chance that one may be selected even if it has a 0 probability. NOTHING IS IMPOSSIBLE!!!!

Message on RandomizedMessage: RollRandom ()

Selects a single message from those supplied above. There is a tiny chance that one may be selected even if it has a 0 probability. NOTHING IS IMPOSSIBLE!!!!