Forum rules - please read before posting.

Inventory - Save actual items

Hi,
I have a scene when a thief stole all the inventory items to the player.
Then, late in the game, he can find those items in a garbage can.

Now, the player can have different items in the moment he lose them. There's a way to save the items he have so when he find in the garbage he recover the possessed items?

Tx

Comments

  • Quite a unique problem.  It can be done in two ways, depending on how coding-proficient you are / how many items are involved:
    • Create a global boolean variable for each item the player can be holding, and use it to keep track of what he should get later on
    • Write a custom script that keeps track of what items are being carried (their ID numbers are enough so long as "Can carry multiple?" option doesn't apply for any of them, then clears the inventory, and stores the IDs as a global string variable.  You can then read this variable later on to add the items back in.

    To access the player's inventory:

    AC.KickStarter.runtimeInventory.localItems;

    To set the value of a string variable 2:

    AC.GlobalVariables.SetStringValue (2, "MyText");

    To add inventory item 3 to the player's inventory:

    AC.KickStarter.runtimeInventory.Add (3);

  • Woah, thanks for the tips!

    My coding is about 1... on a scale of 1 to 1000! LOL! 
    I think I'll use the first hint, the objects are about 10/15...

    Thanks again!
Sign In or Register to comment.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Welcome to the official forum for Adventure Creator.