Skip to content

Learning Modding Concepts

In this tutorial, you will learn the basics of systems like inheritance and blueprints, which are essential for creating advanced mods in Space Marine 2. By the end, you'll have a mod that makes characters in the game change size every second.

To focus on new theory, we'll assume you've completed the Quick Start tutorial.

  1. Open the pc_marine_base_authority.cls file. This is the parent class for all marine characters in the game.

    Theory

    You can learn more about this file in the Inheritance section.

  2. Find the Prop Blueprints property, click + , select Blueprint Client, and click Apply.

  3. Give your blueprint a meaningful name that reflects its purpose – in this tutorial, we'll call it DynamicScale.

    Info

    Blueprints are logic scripts that let you define advanced behaviors without writing raw code. Think of them as visual flowcharts, or graphs: they react to events, execute logic, and update variables.

  4. Expand the newly created blueprint entry to see the Nodes and Variables sections. Nodes is a service section you won't need, but Variables is where you'll add the values used by the blueprint. Just like you added the blueprint, add a new Bool (boolean) variable called IsBig.

  5. To edit the blueprint, click the Open button next to its name. This will launch the blueprint graph editor.

    Tip

    You can learn more about how the game’s logic works by opening existing blueprints and exploring them. For example, open the COLORING blueprint and navigate the graph with your mouse. Use your mouse wheel to zoom in/out. Drag nodes around for better visibility.

  6. Add the first node of our DynamicScale blueprint: right-click anywhere on the grid in the blueprint editor and select the On Init node from the menu.

    Theory

    The On Init node starts the blueprint logic when your actor (character) is created in the game. As we want every actor to begin this behavior as soon as it spawns, we start our graph with this node.

  7. Add the second node as a continuation of the first: click and drag from the red square on the right side of the On Init node.

    When you release the mouse button, the node menu will appear. This time, select the Schedule node, then select Start.

    Theory

    Let’s break it down. Pink nodes represent events, like On Init, which triggers when the actor is initialized. Each graph can only have one node for a specific event.

    Red squares in the nodes are execution pins that define the order in which nodes run. When On Init triggers, it starts the blueprint's scenario, which — through the connection you made — immediately starts the Schedule node's execution. The Schedule node sets up a repeating sequence: once started, it runs the node connected to its On Period pin every specified number of seconds (by default, every 1 second).

  8. Next, define when the schedule execution should stop. Drag a connection from the Stop pin of the Schedule node and select the On Terminate event node. This ensures the schedule stops when the actor is removed from the game.

    Tip

    When you draw a connection from a node, the editor will suggest only suitable nodes that can possibly follow this node.

  9. Now recreate the rest of the blueprint graph as shown below to complete the behavior:

    • If: checks a Condition and triggers one of two nodes depending on whether it's True or False.
    • Get BP Variable: retrieves a blueprint variable's value. This is a getter node: it has no execution pin and simply returns a value requested by another node. In our example, it gets the value of IsBig, the boolean variable you created in Step 3. A new Bool variable is False by default (unchecked box).

      Tip

      To quickly access a list of all values available in a field, click ... next to it.

    • Set Geom Scale: sets a custom value for the Scale property of a given actor.
      Leave the default value OWNER (which refers to the current class). Enter a smaller value in the node that runs when IsBig = True and a larger value in the node for IsBig = False.

    • Update BP Variable: updates a blueprint variable’s value. In our case, InBig.
      After increasing the actor's scale, mark the Bool checkbox so IsBig = True; after decreasing the scale, leave the checkbox unchecked. This way, the IsBig value toggles with each iteration of the schedule, switching the actor between big and small sizes.

  10. Save the changes in pc_marine_base_authority.cls.

  11. Copy the modified pc_marine_base_authority.cls file and its corresponding .resource file as you did in the Quick Start. Note that in this tutorial, the .resource file is essential – the mod won't work without it.
  12. Launch the game and watch every character cycle through growing and shrinking every second!

Warhammer 40,000: Space Marine 2 © Games Workshop Limited 2024. Space Marine, the Space Marine logo, GW, Games Workshop, 40K, Warhammer, Warhammer 40,000, 40,000, the 'Aquila' Double-headed Eagle logo, and all associated logos, illustrations, images, names, creatures, races, vehicles, locations, weapons, characters, and the distinctive likeness thereof, are either ® or TM, and/or © Games Workshop Limited, variably registered around the world, and used under licence. Focus Entertainment and its logos are trademarks, registered or not, of Focus Entertainment. Saber Interactive and its logos are trademarks, registered or not, of Saber Interactive. Powered by Wwise © 2006 – 2024 Audiokinetic Inc. Havok software is © 2024 Microsoft. Uses Bink Video. Copyright © 1997-2024 by Epic Games Tools LLC. All rights reserved to their respective owners.