Skip to content
Vašek edited this page Feb 7, 2019 · 11 revisions

choose

Randomly choose given parameter

Syntax:

choose(params T[] items)
Argument Description
params T[] items The variables to choose from

Returns: T

Description:

This function will randomly return one of the given arguments (as many as are stated). The input values can be strings, integers, variables or constants. It is very useful when you want to spawn enemies in random angle or make randomized games with set attacks or moves.

NOTE: This function will return the same value every time the game is run due to the fact that SimplexRpgEngine generates the same initial random seed every time to make debugging code a far easier task. To avoid this behavior, use randomize() at the start of your game.

Example:

image_angle = choose(0, 90, 180, 270);

This code will set an object's image_angle to one of four angles (in this case 0, 90, 180, or 270 degrees) on random when the event is called.

Back to number_functions

Clone this wiki locally