Hi everyone!
Just curious, is it possible to update property values through custom actions or existing scripts?
As an example, I have an inventory item called Ice Cream and the property value is called description.
At first, the description is "this is something with sprinkles." Further down the line, I'm hoping to update the description to "this is something with sprinkles that is yummy."
Thank you!
It looks like you're new here. If you want to get involved, click one of these buttons!
Comments
It's possible, yes. As you'll need to deal with the exact instance of the item you want to affect, though - i.e. not the original item itself - it will need to be done through script:
See the Manual's "Inventory scripting" chapter for details on how to get and work with the InvInstance class.
Apologies for just getting back to you -- thank you so much!
@ChrisIceBox
I'm just curious to know, might it be possible to create a custom action for this?
The reason why I was curious is because the player has a phone with "contacts" and "notes" in which these items are actually inventory, and I am using their descriptions on the side panel (screenshot attached here).
In the screenshot above, the inventory item is "Celestina," and the description is "My best friend since I was five."
After a certain event fires in the game, I would like the description to be "My best friend since I was five, who has an impeccable sense of fashion."
I'm wondering if I can create a custom action (that takes in an inventory item and a "new description") to achieve this, since there are various times through the game that descriptions would be updated.
Also, would I have to create a remember component for this?
Thank you so much!
As a preface: I should note that it an alternative approach would be to use the Inventory: Add or remove Action's "Replace" method to swap out the Celestina item for another (e.g. Celestina_Updated) that has the same interactions but a different property value. You'd have to make sure that Hotspots still react to it as they would the original item, but it wouldn't need any custom code.
As for the custom Action: yes, it's possible. This should do it:
As Inventory items are asset-based and part of AC's core, no Remember script is necessary.
Thank you so much! The alternate solution sounds like a nice thing to explore, so I might look into it if the custom action is too cumbersome on my end.
Appreciate the code snippet!
Thank you so much for writing this out!