How to check in script item equipped?

Soundmartell

New member
Hello,
Is it possible to know the Item is actually equipped?
Let say I have an Assault Rifle item and an Access Code Item in the Character. I want to check by script if the Access Code is Equipped so I can let the Character to open a door only if the Access Code is active, not if the Assault Rifle.
Thanks.
 
On the inventory component you can call GetActiveItem for each slot. If there is an item returned then the character has an item equipped.
 
Thank you. I am very new in scripting is it possible to give me a brief example of calling GetActiveItem?
I have been trying to do something like:
if(Inventory.GetActiveItem(0))
{
//Do Something here.

}
But it doesn't work. :-]
Thanks
 
If you do a search within the codebase for GetActive item you'll find a few different examples of its. You'll need to first get a reference to the inventory using GetComponent.
 
Top