CoderTrevor's Adventures in Deep Rock Galactic Modding

Journey 2: Let there be cube!


By the end of this journey, you'll be able to create a new actor from scratch and spawn it anywhere in the world.



For reference, you can download archives of my project files from before this journey began and after its completion.



Part 1: Creating an actor to spawn

In our last excursion, we figured out how to find the player's position in the space rig. Let's put that information to good use and add something new to the abyss bar.

First, we'll need something to add. Let's create a simple cube actor from scratch:

  1. Go to the AdventurousMod folder and create a new blueprint. Since we want to add it to the world, choose Actor as the parent. Name your new blueprint BP_AdventureCube (or, you know, whatever you want).
    New Cube blueprint
  2. Open up your new blueprint in the editor.
  3. Near the top-left, click the green button that says Add Component.
  4. In the dropdown that appears, choose Cube under Common.
    Adding cube component
  5. You can leave the default name of Cube for this new component. Unsurprisingly, you'll see a cube in the viewport for your new actor:
    Cube component added
  6. Remember to compile and save BP_AdventureCube, then you can close the blueprint editor; we're done here.

Okay, that was crazy-easy. We're bound to run into some more difficulty as we go on.

Part 2: Spawning the new actor in the Abyss Bar.

Before we can spawn anything in our world, we'll need to know where to spawn it. We could just spawn it at the origin, 0,0,0, but where's that?

Luckily, thanks to our last adventure, we have an easy way of getting world coordinates. We can just launch our mod, run around to roughly where we want to spawn something, and take note of the player position.

Do that now and pick a place in the Abyss Bar to spawn our cube. I'm going to use this empty area to the left of the bar:

New Cube coordinates

I bet from here you can figure it out all on your own. But here's the steps we'll follow to spawn the cube in this location:

  1. Open BP_AdventurousMod in the blueprint editor and go to the Event Graph.
  2. After the node which spawns our player position blueprint, drag out another Spawn Actor from Class node and set BP_AdventureCube as the class.
  3. Split the Spawn Transform struct and for Spawn Transform Location, fill in the coordinates you determined earlier.
  4. Remember to set the Collision Handling Override to always spwan, and your blueprint should now look like this:
    BP_AdventurousMod spawning BP_AdventureCube
  5. Compile and save this blueprint and launch your mod. Take a deep breath and prepare for some serious debugging, since there's no way it was this easy...

Holy crap, it worked!


Cube Spawned

Buy yourself a strong beer management-approved beverage to celebrate.

Now you know how to create totally-custom actors and spawn them into the world. Admittedly, finding coordinates manually like this isn't really practical for gameplay mods, so a later journey will explore spawning in a more dynamic way.

The end of another journey! This one was short, but I hope you're inspired to add your own actors to DRG. Modding doesn't have to be limited to changing what's there!