Persistent inventory items.

  • Two Factor Authentication is now available on BeyondUnreal Forums. To configure it, visit your Profile and look for the "Two Step Verification" option on the left side. We can send codes via email (may be slower) or you can set up any TOTP Authenticator app on your phone (Authy, Google Authenticator, etc) to deliver codes. It is highly recommended that you configure this to keep your account safe.

Techno JF

He Who Has Powerful Words
I have a particular inventory item that I'm working with. However, I want to make it persistent. What I mean is that if the player carrying it dies, then the item (and NOT just a copy of it, because of the nature of the item) is still in the player's inventory when he respawns. I keep thinking that there must an easy way to do this, but I don't know what it is.
 

Raeled

Feuer Frei!
Jul 1, 2001
161
0
0
40
Dordrecht, The Netherlands
Visit site
this is the code that removes someones inventory (normally when they die)

PHP:
  // Destroy the inventory list.
  Inv = Other.Inventory;
  while (Inv != None)
  {
    NextInv = Inv.Inventory;
    if (!Inv.IsA('LadderInventory'))
    {
      Inv.DropInventory();
      Inv.Destroy();
    } else
      MainLadderInventory = LadderInventory(Inv);
    Inv = NextInv;
  }
  if (MainLadderInventory != None)
  {
    Other.Inventory = MainLadderInventory;
    MainLadderInventory = None;
  }

It shows that all inventory is removed, but 1 exeption is made. however, only the last LadderInventory to be found in inventory is safe.
 

Techno JF

He Who Has Powerful Words
Hmmm. That's a little discouraging. I was hoping that the code to delete inventory items of dying pawns would have been found in the Inventory script. Oh well.

I have two other ideas now:
  1. I can cause the item to spawn a temporary actor to hold all of the data it's carrying, including a reference to the item's owner. Then when the player respawns, the actor creates a copy of the item, copies the data into it, and puts it back into the player's inventory.
  2. I can cause the item to become a pickup again if its owner dies. That way, there is no need to destroy the item, since it is no longer an inventory item of a dying player. When the player respawns, the item finds him and adds itself back into his inventory.
What do you guys think? Does one of these ideas sound like it would work? Either way, I need to be able to detect the death and respawning of a specific player. The Relics of Redemption and Vengeance seem to be inventory items that can detect their owner's deaths; I might check there for half of my answer.
 

Shiit

Shiit
Dec 19, 2000
168
0
0
I'm afraid the Relics aren't inventory items, but mutators. They can make stuff like that happen. However, there's a slim chance the "Killed" function is called before inventory is removed. I believe this function is called on all actors in the map. If that's true, you can probably exclude your item from the Inv list in that function.
(BTW, I'm on my dads PC ATM, so I can't check that)