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.