Sets a flag in
C++ that terminates the script the function has been called from.
Pauses the execution of a given script for a certain amount of time.
number time: The time to pause the script in seconds.
function BlockOnCommand(block, max_duration, alternate_break_func)¶
Blocks the execution until the execution of
block has been finished or
max_duration has expired. If
alternate_break_func is provided,
block will stopped being serviced, once
function block: The function to service.
number max_duration: The time
blockis allowed to run for. Set to
-1to only use
alternate_break_functo stop the execution of
function alternate_break_func[Optional]: If this function returns
true, execution of
blockwill stop. Required if
max_durationis set to
Default function to call, if a
block should be terminated.
Tests if a
block is valid.
function block: The function to test.
Services chained events.
Tests, if a provided
GameObjectWrapper wrapper is a valid
GameObject. This function should always be called when working with native functions on any
function Clamp(value, min, max)¶
Clamps a given value.
number value: The value to clamp.
number min: The minimum value.
number max: The maximum value.
A workaround to simulate a floor function by calling the default
tostring(...) and converting back to a number.
number val: The value to floor.
A simple modulus function.
number a: Dividend.
number b: Divisor.
function Chance(seed, percent)¶
Returns if something happened, given a % chance.
number seed: Random seed.
number percent: The chance of the event to happen.
trueif the event should happen,
Returns the current minute.
number: The current minute.
Returns the current time in seconds.
number: The current time in seconds.
Returns a chance based on difficulty.
The function does not work as indicated and always returns a chance of 100%.
string difficulty: The current difficulty.
number: The chance for an event based on difficulty. Currently returns 100.
function PlayerSpecificName(player_object, var_name)¶
Creates a player-specific name for a given variable.
PlayerObject player_object: The
PlayerObjectto create a specific variable name for.
string var_name: The base name of the variable.
string: The player-specific variable name.
If you have no idea what
_G is in
LUA don't use this function.