Vandelay Posted June 20, 2017 Share Posted June 20, 2017 (edited) Is there a way to add an item directly into an equipped bag rather than the general inventory? I'm trying to add an item straight to the bag equipped on the player's back, but I think I've gotten stuck between trying to identify the back item and trying to treat it as a container. Alternatively, is it possible to create a custom bag that already contains other items? I spent a little while looking through the game lua and source code for the Starter Kit for a clue on this, but I wasn't able to find it. Any help, suggestions, or clues in either direction would be helpful. Below is a snippet I've been working with to test. if keyNum == 15 then local bag = self.character:getClothingItem_Back(); -- Returns InventoryItem -- ???? bag:AddItem("Base.Screwdriver"); -- Requires ItemContainer end Edited June 20, 2017 by Vandelay Link to comment Share on other sites More sharing options...
Svarog Posted June 20, 2017 Share Posted June 20, 2017 (edited) Have you tried this? bag:getItemContainer():AddItem("Base.Screwdriver"); Edit: This worked for me local bag = getPlayer():getClothingItem_Back() bag:getItemContainer():AddItem("Base.Screwdriver"); Edited June 20, 2017 by Svarog Vandelay 1 Link to comment Share on other sites More sharing options...
Vandelay Posted June 20, 2017 Author Share Posted June 20, 2017 That's just fantastic, and so simple. Thanks a ton, mate! Link to comment Share on other sites More sharing options...
DresdenBBQ Posted June 22, 2017 Share Posted June 22, 2017 Good picture. Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now