Adding a Random Amount of Souls Per Kill

Going over how to award the player a random amount of souls for each vanquished enemy.

Choose your operating system:




On this page

When playing Action RPG (ARPG), the player is awarded with one Soul per enemy that is vanquished. The player can then use the Souls they have collected to purchase potions and weapons in the store. While this system works exactly as it should, getting one Soul per vanquished enemy makes progressing feel like a chore instead of something that is fun. In the following How-To, we will take a look at setting up our enemies so that when they are vanquished by a player a random amount of Souls will be awarded.


The latest version of Action RPG will already have the following setup up and working.

  1. First, in the Content Browser, locate the BP_EnemyCharacter Blueprint and double - click on it to open it up.

    Click for full image.

  2. Once the BP_EnemyCharacter Blueprint is open, click on the Plus Sign (+) button in the Functions list to add a new function and name it SpawnLoot.

  3. Select the SpawnLoot node in the graph and in the Details panel, under Inputs section, add a new Integer input named Quantity


  4. Add the following nodes to the graph. These nodes will allow us to spawn a random amount of souls in a random location with in  a box.


    Blueprint Node Name

    Default Value

    For Loop


    Get Actor Location


    Random Point in Bounding Box

    Box Extent X: 40, Box Extent Y: 40, Box Extent Z: 40

    Spawn Actor From Class


  5. Click on the Select Class input on the Spawn Actor From Class node and from the displayed list, search for and select the BP_SoulItem Blueprint. Blah


  6. Next, connect the Return Value of the GetActorLocation node to the Origin input on the Random Point in Bounding Box node. This will make sure that when the souls are spawned, they are not all spawned on top of one another.


  7. Connect the output of the For Loop, LoopBody, to the input on the SpawnActor node and the connect the Return Value output on the Random Point in Bounding Box node to the Spawn Transform input on the SpawnActor node. 


  8. To finish up this function, connect the Output of the SpawnLoot node to the input on the ForLoop node and then connect the Quantity output on the SpawnLoot node to the Last Index input on the ForLoop node. When all of this has been completed, your Blueprint should look like the following image.

    Click for full image.

  9. Now, go to the Event Graph and locate the EventDestroyed event.


  10. Go to the end of the EventDestroyed and add the following nodes to the Event Graph:


    Node Type

    Node Name

    Default Value

    Instance Editable









    Spawn Loot




    To make the SoulMIN and SoulMAX Instance Editable, go to the Variables panel and click on the eye icon next to the variable name.

  11. With the above nodes, we are now going to set them up so that when a player vanquishes an enemy, a random amount of Souls between the SoulMIN and SoulMAX will be spawned in the level. To get this working, set up the node to match the following image.


  12. Once the random amount of Souls per kill has been set up, connect the output of the Set Collision Object Type to the input on the Add Souls node like in the image below. 

    Click for full image.

    Don't forget to reconnect the "Parent: Destroyed" node after our new logic.

  13. With that completed, press the Compile and Save buttons and then close down the BP_EnemyCharacter Blueprint and open the NPC_GoblinBP_Level_01 Blueprint.


  14. With the NPC_GoblinBP_Level_01 Blueprint open, go to the Details panel and under the Default section, look for the SoulMIN and SoulMAX inputs.


  15. With the SoulMIN and SoulMAX inputs located, input a value of 1.0 in SoulMIN and a value of 3.0 in SoulMAX.


  16. Now open up the rest of the NPC Goblin Blueprints and input the following SoulMIN and SoulMAX numbers. When that is completed, make sure that you Compile and Save each Blueprint.

    Blueprint Name



    NPC Goblin Level 01



    Goblin NPC Level 02



    NPC Goblin Level 03



    What we are doing above is setting up our Goblins NPC's to award different amount of souls based on the level the NPC is. A Level 01 Goblin awards the smallest amount of souls while a level 03 Goblin awards the most amount of souls.

End Result:

Now when you launch ARPG, the player will now receive a random amount of souls for each of the enemies that you vanquish like in the following video.

Help shape the future of Unreal Engine documentation! Tell us how we're doing so we can serve you better.
Take our survey