Random

Category: Executor Tier: Basic

Purpose

Generates random values and stores them in variables.

Visual Reference

As added to your scene
Random brick as it appears in the GDLink editor

When To Use

1. Random Damage

Keyboard Listener (Key: "Space")
-> AND Gate
-> Random Executor (Integer, Min: 20, Max: 30, Target: Local "damage_dealt")
-> Property Executor (Set Global "enemy_health" -= Local "damage_dealt")

Deal 20-30 random damage.

2. Random Loot Drop

Collision Listener (Group: "enemies")
-> Property Listener (Global "enemy_health" == 0)
-> AND Gate
-> Random Executor (Choice: "sword,shield,potion", Target: Local "drop_item")
-> Edit Object Executor (Add: "res://items/" + Local "drop_item" + ".tscn")

Enemy drops random item on death.

3. Procedural Spawn Position

Always Listener (Pulse: 2 seconds)
-> AND Gate
-> Random Executor (Float, Min: -10, Max: 10, Target: Local "spawn_x")
-> Random Executor (Float, Min: -10, Max: 10, Target: Local "spawn_z")
-> Edit Object Executor (Add: "res://enemy.tscn", Position: (Local "spawn_x", 0, Local "spawn_z"))

Spawn enemies at random XZ positions every 2 seconds.

4. Random Color Variation

Message Listener (Subject: "spawn")
-> AND Gate
-> Random Executor (Color, Target: Local "color")
-> Material Executor (Albedo Color: Local "color")

Each spawned object gets random color.

5. Dice Roll Mini-Game

Keyboard Listener (Key: "R", Tap: true)
-> AND Gate
-> Random Executor (Integer, Min: 1, Max: 20, Target: Global "dice_roll")
-> PRINT Executor ("You rolled: {dice_roll}")

Roll 20-sided die (D20).

Runtime Behavior

Executes: Generates a random value and stores it in specified variable

Generated UI Mockup — showing expanded properties
Random
-
x
Name:
Label this brick...
Random Mode:
v
Int Min:
v
Int Max:
v
Variable Name:
v

Properties

Property

Type

Default

Notes

random_mode

String, “Integer Range”

Type of random value - Integer Range, Float Range, Boolean, or Choice List

int_min

Integer, 1

Minimum value for Integer Range

int_max

Integer, 10

Maximum value for Integer Range

variable_name

String, “random_value”

Variable to store result