How can I reset a player's inventory when they leave the session in Fortnite UEFN, without saving it between sessions?

I am trying to implement a system where a player’s inventory is only reset when they leave the session in Fortnite UEFN, but not during gameplay. Specifically, I want weapons, coins, and other resources to be reset (so empty inventory upon map entry) only when the player leaves the map or session. During gameplay, if a player dies, the inventory should not be reset, but should remain intact (so weapons and coins should remain). Currently, the autosave and autoload data system causes data to persist between sessions, but that is not what I want.

What I have tried so far:

  1. I have explored using the Save Point device with autosave and autoload, but this causes data to persist between sessions.
  2. I have attempted to use the clear data when a player leaves the session feature, but I have not been able to implement it properly to clear the inventory without affecting other player stats.
  3. I’ve considered using events like PlayerRemovedEvent to trigger the data wipe, but I’m not sure how to integrate it properly.

Question: Is there a way to reset a player’s inventory only when they leave the session, without it being reset during gameplay (e.g. after death)? How can I make it so that the inventory is reset when a player leaves the session, but is kept intact during gameplay?

thanks for the answers

The island settings has an “Eliminated Player’s Items” option. Set that to Keep, and by default they will keep their items through respawn.

Then simply remove any code that persists their inventory through verse persistence.
image

@PROGABBOMALA_YT Make sure to also disable saving of the loadout from the save point device if you do plan to keep using that device. To keep loadouts through rounds but not different sessions you could also utilize the round settings device which should have a keep items setting

You could use an item_remover_device from Verse to clear their inventory.

Here’s what it looks like in my code.

    @editable IN_Remove_All : item_remover_device = item_remover_device{}

    # Clear inventory.
    Clear_Inventory(Agent : agent) : void =
        IN_Remove_All.Remove(Agent)

And the item remover config.

1 Like