Difference between revisions of "Randvar"

From EDukeWiki
Jump to navigation Jump to search
(var suffix merge)
Line 1: Line 1:
'''randvar''' <gamevar> <value>
'''randvar''' <gamevar> <value><br>
'''randvarvar''' <gamevar> <value>
'''randvarvar''' <gamevar> <value>

Revision as of 19:31, 24 February 2011

randvar <gamevar> <value>
randvarvar <gamevar> <value>

This function generates a random number from 0 to <value> and assigns it to <gamevar>.

This command should not be used in unsynchronized code or it will desynchronize multiplayer games. See the list of unsynchronized events for a full list.

In prior releases of DOS EDuke, randvar contained a flaw that would desynchronize multiplayer regardless of where the command was used. The bug has since been corrected for post-1.0 releases of EDuke32.

Commands with a "var" suffix take gamevars rather than constants or defined labels for their inputs.