Provides random utilities Actions / Conditions / Expressions for Construct 3, include a Seperate Random Number Generator based on Mersenne Twister
Author: piranha305
Website: https://piranha305.itch.io/
Addon Url: https://www.construct.net/en/make-games/addons/1075/rng
Download Latest Version : Version: 1.0.0.3
Made using c3ide2-framework
To build the addon, run the following commands:
npm i
node ./build.js
To run the dev server, run
npm i
node ./dev.js
The build uses the pluginConfig file to generate everything else. The main files you may want to look at would be instance.js and scriptInterface.js
Property Name | Description | Type |
---|---|---|
Replace System Seed | Replace the seed with a new one | check |
Seed | The seed to use for the RNG | text |
Action | Description | Params |
---|---|---|
Set Seed | Sets the seed to use for the RNG | Seed (string) |
Roll Dice | Rolls a number of dice with a number of sides and adds a modifier | Number of Dice (number) Number of Sides (number) Modifier (number) Tag (string) |
Load JSON Data | Loads JSON data, That can be used for random selection | Tag (string) JSON (string) |
Pick Random Position In Layout | Picks a random position in the layout, can access using RandomX and RandomY expressions | |
Pick Random Position In Layout With Margin | Picks a random position in the layout with a margin, can access using RandomX and RandomY expressions | Margin (number) |
Pick Random Position In Viewport | Picks a random position in the viewport, can access using RandomX and RandomY expressions | |
Pick Random Position In Viewport With Margin | Picks a random position in the viewport with a margin, can access using RandomX and RandomY expressions | Margin (number) |
Get Random Position In Rect | Gets a random position in a rect | Left (number) Top (number) Right (number) Bottom (number) |
Pick Random Position In Sprite | Picks a random position in a sprite, can access using RandomX and RandomY expressions | Sprite (object) |
Pick Random Position In Circle | Picks a random position in a circle, can access using RandomX and RandomY expressions | X (number) Y (number) Radius (number) |
Condition | Description | Params |
---|---|---|
Chance | Returns true with a given chance | Chance (number) |
Expression | Description | Return Type | Params |
---|---|---|---|
Roll | Rolls a number of dice with a number of sides and adds a modifier | number | Number of Dice (number) Number of Sides (number) Modifier (number) |
GetDiceFromLastRoll | Gets a die from the last roll | number | Index (number) |
GetDiceRollSum | Gets the sum of a roll | number | Tag (string) |
GetDiceRollValue | Gets the value of a roll | number | Tag (string) Index (number) |
GetRandomToken | Gets a random token from a string | string | Text (string) Seperator (string) |
GetRandomFromCSV | Gets a random value from a comma seperated string | string | comma seperated string (string) |
GetRandomFromCSVWeighted | Gets a random value from a comma seperated string with weights | string | comma seperated string (string) Weights (string) |
RandomString | Generates a random string | string | Length (number) |
RandomNumber | Generates a random number | string | Length (number) |
RandomStringFromPool | Generates a random string from a pool of characters | string | Length (number) Pool (string) |
RandomFromJsonArray | Gets a random value from a JSON array | string | Tag (string) Path (string) |
Guid | Generates a Guid | string | |
RandomX | Gets the last random X position | number | |
RandomY | Gets the last random Y position | number |