Jump to content

Adding cooked steak to the inventory??[Solved]


quadrinka4

Recommended Posts

getPlayer():getInventory():AddItem(InventoryItem(Cooked.Steak) );

 

isn't this the correct way to do ? or this?  what have I done wrong?

 

getPlayer():getInventory():AddItem(InventoryItem(Cooked) Base.Steak );

getPlayer():getInventory():AddItem("Base.Steak.Foods.Burnt");

 

Thank you for your help

 

Edited by quadrinka4
Link to comment
Share on other sites

Hey man, so you almost have the right code there, but this would be the correct one:

getPlayer():getInventory():AddItem('Base.Steak');

It looks like you probably know how to add steak and were just trying to troubleshoot, but what the code is saying is Add the Item Steak from the Base module. If you look at the scripts there is no actual item for cooked steak. So you'd probably have to look at code from cooking which is going to be a little more complicated than just adding items to your inventory.

 

From what I can tell, there isn't an easy way to add cooked steak directly to the inventory, at least not with AddItem();

 

EDIT

Did a quick search and found this:

newItem:setCooked(resultItemCreated:isCooked());

...which might be a way to set the food to cooked. Just gonna take some fucking around. This snippet came from ISCraftAction.lua and looks like the function used to turn food into cooked food.

Edited by tommysticks
Link to comment
Share on other sites

Alright, so setCooked should work on steak in the inventory. You'll need to add the steak to the inventory first, then set it to cooked. I don't know exactly how the code would look without fuckin with it but it would look something like this:

getPlayer():getInventory():AddItem('Base.Steak');
getPlayer():getInventory():getItem('Steak'):setCooked(true);--getItem is probably incorrect

 

Link to comment
Share on other sites

  • 7 years later...

I noticed that if you have a stack of items that you are cooking one at a time, the stack doesn't update until I click the dropdown on any item in the player inventory. Is there a way to force a refresh to the player's inventory after the food is changed to a cooked state?

Link to comment
Share on other sites

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...