Game Maker

List

A property type that holds a collection of other types, like a list of players or locations.

The List property type is an advanced but incredibly powerful tool. It allows you to store a collection, or list, of other property types. For example, you can have a "List of Players," a "List of Locations," or even a "List of Materials."

  • Default Value: An empty list []

How to Create a List

When creating a new property, first select the "List" option (right-click a type in the menu), and then select the type of element the list will contain (e.g., Player, Location).

Common Use Cases

  • List of Players:
    • Track all players who are currently "alive" in a round.
    • Store a queue of players waiting to join an arena.
  • List of Locations:
    • Create a dynamic patrol path for a mob.
    • Store a series of spawn points to cycle through.
  • List of Items:
    • Create a random loot table for a chest.

Operators (in Change Property action)

  • Add: Adds a new element to the end of the list.
  • Remove (by index): Removes the element at a specific position in the list (e.g., remove the 1st element).
  • Remove (by value): Removes all occurrences of a specific value from the list.
  • Clear: Empties the entire list.
  • Shuffle: Randomizes the order of all elements in the list.
  • Reverse: Reverses the order of the list.

Checks (in Property Condition)

  • Contains: Checks if the list contains a specific value.
  • Is Empty: Checks if the list has no elements.
  • Size Equals: Checks if the list has a specific number of elements.

Sub-Types (Reading from a List)

When you use a List property as a value in another action (e.g., for a Teleport location), you can use a sub-type to specify which element to get from the list.

  • Get Index: Retrieves the element at a specific position (e.g., get the 1st location from a list of spawn points).
  • Get Random: Retrieves a random element from the list.
  • Get Size: Retrieves the number of elements in the list (as a Number).