Game Maker
Logic

Using Properties (Variables)

Learn how to store and manage dynamic data in your games with Properties.

Properties are one of the most powerful features in Game Maker. Think of them as variables for your game. They allow you to store, track, and change information dynamically as your game is played.

You can manage properties in /editmap -> Properties (Redstone Comparator).

What Can You Store?

You can create properties to hold different types of data. See the Property Types page for a full list.

  • Number: Whole numbers (e.g., score, lives, round number).
  • Boolean: A true or false value (e.g., isDoorOpen, hasCompletedPuzzle).
  • Text: A string of text (e.g., a player's chosen class name).
  • Location: A specific coordinate in your map.

Property Holders: Who Owns the Data?

When you create a property, you decide who it belongs to. This is called the Holder. The holder determines the scope of the variable.

See the Property Holders page for a detailed explanation.

  • Global: The property belongs to the map itself. There is only one value for it, shared by everyone.
  • Player: Each player gets their own unique value for the property.
  • Team: Each team gets its own value for the property.

Creating a Property

  1. Go to /editmap -> Properties.
  2. Click "Create Property".
  3. Name: Give it a unique, descriptive name (e.g., player_score, door_is_locked).
  4. Type: Choose the type of data it will hold (Number, Boolean, etc.).
  5. Default Value: Set the initial value for the property. For a Score property, this would likely be 0.
  6. Persistent: If enabled, the property's value for a player will be saved even after they leave the map and rejoin later. This is great for tracking stats across sessions.

Using Properties with Actions

The real power of properties comes from using them with actions to create dynamic game logic.

Changing a Property

The Change Property action is your primary tool for modifying a property's value.

Example: Creating a Score System

  1. Create Property: Create a Number property named Score with a default value of 0.
  2. Create an Event: In a region, set up an event like Player Kill Entity.
  3. Add Action: Add a Change Property action to this event.
  4. Configure the Action:
    • Property: Select your Score property.
    • Holder: Choose Player. This ensures you modify the score of the player who triggered the event.
    • Operator: Select Add.
    • Value: Enter 1.

Now, whenever a player kills an entity in that region, their personal Score property will increase by 1.

Reading a Property (Conditions & Placeholders)

You can use the value of a property to make decisions or display information.

1. In Conditions: Use a Property Condition to check a property's value before running an action.

Example: A Door that Requires a Score of 10

  • Event: Player Interact on a door.
  • Condition: Property Condition
    • Property: Score
    • Holder: Player
    • Check: Greater Than or Equal To
    • Value: 10
  • Action: If the condition is true, run a Change Block action to open the door.

2. As Text Placeholders: Display a property's value in chat, scoreboards, or holograms using placeholders.

  • Format: %p_<property_name>_<holder_type>%
  • Example: To show a player's score in a message, you would write: Your score is: %p_Score_player%