| NWN2 Scripting. |
Simulation Training. Introduction Home First Program Seeing Results Variables and Data Types Comments Functions Data Conversion Random Numbers Concatenation Arithmetic Operators Compound Assignments One More or Less Precedence Relational Operators The Open Branch The Closed Branch Logical AND Logical OR Compound Statements ELSE If Switch Case The ? Operator The for Loop The while Loop The do while Loop Introduction to Functions Passing Values Passing Multiple Values Multiple Functions Simplifying Functions TRUE/fALSE Conditions Return Values Setting Global Variables Getting Global Variables Setting Local Variables Getting Local Variables WayPoints Introduction Static Waypoint Sets Dynamic Waypoint Sets Dynamic WP Cycles Input Output |
Random NumbersIn the NWN2 game, as in many other games, random events can take place. In the days of board games, such as Dungon and Dragons, different multisided dice were used to determine the outcomes of events. In a like manner, the NWN2 editor offers the programming equivalent of these multisided dice. This section will give an introduction on how to use them. The Six-Sided DiceThe most common dice are the six-sided dice. One of these can generate a number from 1 to 6. Two of them can generate numbers from 2 to 12. The NWN2 prototype function for a six-sided die is:
|
|