Accessing a palyer's Inventory item

  • 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.

BondJamesBond

New Member
Sep 23, 2001
43
0
0
Visit site
Hi Every1,

What code do I use to access an inventory item that my player has, through the player carrying it. In other words...

Code:
class Agent extends TournamentPlayer;

function TurnOnNVG()
{ 
    // Access the inventory item from here
}


Thanks in advance,
-Rainbow Six
 

Magus

New Member
Oct 7, 2001
69
0
0
Visit site
var inventory inv;
inv = Pawn(Owner).FindInventoryType(class'NightVisionGoogles');
if(inv != none)
NightVisionGoogles(inv).TurnOnNVG();
 

Shiit

Shiit
Dec 19, 2000
168
0
0
Yup.
You can access ALL inventory someone is carrying with:

local Inventory I;
for (I=Inventory;I=I.Inventory;I!=None)
{
do whatever you want to I
}

I'm sure usaar33 tutorial has a similar something. Anyway, Magus' code is probably what you were looking for.
 

Techno JF

He Who Has Powerful Words
I remember asking a similar question a while back. I was looking for a way to get a specific item in a pawn's inventory. I got two answers, but this is the one I went with.

Code:
local inventory S;
S = Pawn(thePawn).FindInventoryType(class'YourInventoryClass');
if(S != None)
DoStuff......

This will find a specific item in a pawn's inventory. If the pawn doesn't have one of these, then S=None.