How to replicate Payday's Loot Bag System.

Greetings All,

I’m wanting to figure out how to go about implementing the Loot Bag mechanics from Payday 2/3. In the either game there are objects that spawn on the maps that a player must get close enough to in order to interact with and then the object gets turned into a duffel bag that attaches to their back. The HUD updates with information telling the player what item they are carrying, along with their camera tilting to the left (indicating they are carrying something), and depending on what type of item they are carrying their movement speed might lower and they won’t be able to sprint. Also, when the player no longer wishes to carry said item they press a certain key and the bag gets launched from their character (like they are throwing it, in an arch) ready to be picked up off the ground by them or another connected player.

There is a lot going on with this question, but if anyone has any ideas on how to implement this I would appreciate the help. I already have an idea on how to implement the picking up and throwing of said object, but the other stuff I’m finding it hard to come across any tutorials or similar questions being answered on the forums.

Hello there,

  1. Make a base actor as LootBase
  2. Inside put a static mesh
  3. Put a sphere collider adjust its size
  4. Create a bool variable as bIsPicked. Default false
  5. Create a float variable as weight
  6. On Begin play set weight random in range float 50-100.
  7. Select collider and on details click OnComponentOverlapBegin click plus it will create an event on graph
  8. On component overlap, get overlapping actor cast to playercharacter.
  9. Optional : you can create widget diplay press E over here. If you do that wait for key event in graph.
  10. From is valid create a node with attach actor to actor.
  11. With attach actor to actor node. attach bag to player. You can specify a socket if you create on your characters skeletal mesh. Like shoulder socket etc. Now you looted object.
  12. If you want to decrease speed. Get loot object and its weight variable we created. Get a percentage from player movement component → max walking speed, and decrease from that.
  13. Now you have a loot + your character moves slowly depending on weight.
  14. If you press (E) assuming, you can drop item simply by detaching actor.
  15. But if you want to have a simple throwing move, then after pressing E detach actor(bag). Set Location infront of camera, enable physics on skeletal mesh and add impulse force with direction of camera forward vector.

First start from somewhere by creating the base bag, you get stuck ask on this forum. We help.

Don’t want to directly show you since it won’t help you in a good way. Start doing some steps then ask here.

2 Likes

I’ll test this out, thank you for the response. :slight_smile:

1 Like

You can also create a custom collision obj type that only pawns can trigger the overlap. This will negate the need to cast on the overlap event. Save some performance.

If this needs to be multiplayer ready, then there are few more steps that have to happen.

For attachment I would do Attach Actor to Component.
Loot Item is Actor, character mesh is a Component.

1 Like

Alright, I have a replicating pick up and throw system going. I’m also trying to assign and Int Value to each item that gets spawned, but at the moment the last randomly chosen Int Value gets assigned to all the spawned objects. From what I’ve gathered, it looks like I need to set up an array of all the objects I wish to be in the spawning pool and each time an item is spawned the array needs to go through a for loop in order to assign the Int Values?

Any advice on how to setup each item getting assigned its own unique Int Value on spawn?

Well shouldn’t be.. how you setting the variable can you show?

Are you setting to class or something shared?

For number 8, you should use a custom collision object channel that only pawns can overlap. No need to cast. You will automatically know the interaction is with a character.

  1. Input to interact should execute and validate on client first. Then client RPC’s server to interact.
    10-11. Server will handle attachment (Actor to Component [pickup, character mesh])

All modifications to the actor (weight etc) should be handled by the server… setting replicated variables. The Mesh/Type of item needs to be an Repnotify. Meshes do not replicate. Use the Onrep function to execute setting the mesh on each client.

I am not sure if you telling me or the thread owner, if that’s so interaction system should be another system already but thanks anyway.

Also as addition think while spawning variables can be sent already to server in the beginning however I am not sure how its being set, if its updated or class updated maybe there could be aproblem.

It was meant as a general note. Didn’t mean to reply directly.

If your doing inclusive interactions (many things can trigger), then you use an identifier such as gameplay/actor tags, then call specialized function or interface.

e.g. Automated sliding door that opens for Pawns and Drones. The door would check the tags (overlap → other actor) IF tag is Character or Drone, then open. A projectile overlapping wouldn’t trigger, nor a character attached component/actor.

If your doing exclusive interactions (1:1), you should use a custom collision. This eliminates the need for conditional check execution. is it this or that etc.

e.g. Only characters can trigger logic on hit/overlap.


I’m looking at base actor being dynamic. A single class that uses replicated customization and actor components for functionality. Item could be a duffle bag or loose money.

Server would spawn the base item, then configure the replicated vars. Item Type, Weight etc. The Onreps would set the mesh based on type and load any needed actor components for custom logic.

1 Like

Ofcourse there is multiple ways to do a collision test. I can think of many things ofcourse there is a pros and cons to everything.

  1. Do a custom channel
  2. Do use propiate channel
  3. Do cast
  4. Check tag
  5. Check a specific class exist on whatever is
  6. Does implement interface

etc etc. I generally go with tags.

However (actual topic) I think @Derknomicon maybe changing variables on class level or a shared variable, or maybe something replicating to all.

I’ll share what I have set up within a few days, been pretty busy outside of game development stuff. Thanks for all the feedback, I’ll try to understand it and post what I can when I can.

Editor Note: As I was making this post I was fiddling with some nodes here and there and broke some stuff, made some stuff work, and made stuff half work. The struggle of trying to get this to work and understand it is painful, but I’m determined and I hope what I’m sharing is helpful.

To begin with I ended up finding a tutorial on a similar item/object movement mechanic I had been searching for. Here is a link to the video for reference and if anyone else is interested in checking out this gentleman’s other tutorials:
https://www.youtube.com/watch?v=03E8wwD0Iew&t=3624s

Following along with the tutorial, this was my first time working with Data Assets. It seems like a really powerful method of using data but I’m either using it incorrectly or with the mechanics I’m trying to create I’m thinking I should just stick with Structs and Data Tables. I say this because when I try to spawn my item actors within the level and try to have the Parent Actor or Item Spawning Actor set their randomly selected values, the values get selected but only the last selected value gets set as the value for all of the items. Then, when I go and pick up the items, their values either get destroyed with the object that gets destroyed on pick up or the value gets rolled again when I throw the object (it gets respawned in the level) thus setting a new value to all other objects.

After that, when I go to pick up another item it has either that new value, a completely different value, or no value? I say this because once I pick up a second item and throw it my widget that should display a name and value breaks.

Started off by creating the Primary Data Asset for the Items, which has 4 variables:

  • Object Actor which is a class reference of the Actor
  • Object Mesh which is an object reference of the Static Mesh
  • Object Image which is an object reference of the Texture 2D
  • Object Value which is an integer

Next the Item Spawning actor was created, it has two variables:

  • Item Data which is a reference to the Data Asset
  • Value which is an integer (this is where I think I was setting the value of the items)

It also has an Interface for the picking up interaction. (More on that in a bit)

On the Construction Script of the Item Spawning actor, its Static Mesh is used to set up the spawned item’s mesh and enable Simulated Physics pulled from the Item Data variable.


Then the Data Assets were created pulling information from the Primary Data Asset. These were used to create two test items.

With all the above created I was able to set them into the level.

An actor class was created as the parent class to create child actors for the two items which get assigned in the Data Assets as the Object Actor. The Item Base Actor (parent class) uses the Pickup Interface which gathers data from the Primary Data Asset. Inside its construction script the static mesh was used to set the Static Mesh and enable Simulate Physics. It has two variables, 1st for the Primary Data Asset and 2nd for an Integer Value. The actor also has Projectile Movement on it, this gets used once I decide to drop/throw the item I have picked up.


The Pickup Item Interface has two functions:

  • Pickup Object, has an Input that uses an Object Reference of the character being played.
  • Query Asset, has an Output that uses the Primary Data Asset

An Actor Component gets created to manage the inventory of the character, this can be adjusted to have many slots but for my example I am only using 1 slot. The component has 4 variables:

  • Inventory Widget, object reference for the widget that displays the inventory slot.
  • Current Slot Index, integer variable type. (this is used in case there are multiple slots that can be cycled through.)
  • Inventory Slots, an object reference of the Primary Data Asset that gets converted into an Array.
  • Owner REF, object reference of the character being played.

There are 3 functions:

  • Is Slot Free?, verifies whether or not the player has an available inventory slot open to store a picked up object.
  • Query Inventory, gathers the class reference of the filled inventory slot’s object.
  • Remove From Inventory, used to remove objects from inventory slots and update whether or not the slot is free.



Next I went and added the Inventory Component to my character, made the Pick up and Throw events, and a trace function that let the pick up event work.


Don’t know if you saw my recent post, hopefully it can help.

Client does a trace. If the client hits something that is interactive, then it RPC’s the server to do a trace.

If the Servers trace hits something that is interactive, it then queries the asset and Spawns the “REPLICATED” actor, Then Destroys the one on the ground (also a replicated actor).

Demo… Red trace is client, Purple is the server

Here’s the setup from the demo.

Trace Logic determines what type of interaction is happening. Door, Elevator, Item
Normally I do this with Gameplay tags. The Actor tag approach is for quick setup and simplicity.

If it’s client executing the trace we route out to call a srv rpc. Srv Interact

If it’s the server executing the trace we route to a switch Interaction Type which directs the logic to execute a specific event based on the type.

Item == Srv Pickup Item

Srv Pickup Item calls a BPI event in the Player States Inventory Actor Component to pickup the specific item.

AC_Inventory “Pickup Loot Item” function

This process does zero casting. It relies 100% on BP Interfaces.


For the sake of simplicity this demo only has 1 world pickup item and a single inventory slot.

Dropping the item
Note the client validates the item/slot and simply calls the server to drop.

The Server is determining “What” based on the selected slot (which there’s only one for demo). We don’t pass references, only simple data (slot 1, 2 and the like).

If the item is valid (exists), then the server calls Drop Item on the Inventory actor component.

1 Like