Forum rules - please read before posting.

Inventory Feature Request: Formulas (or alternate solution)

Would it be possible to get new formula actions for adding and removing set amounts of inventory items, like we can for checking and setting variables?
Or alternatively, is there a way to "sync" variables and inventory item amounts, or get them to "talk" to each other?

The reason I ask is (as discussed in an earlier thread) because I have an ammo variable in my game and I would like to also (or) have the ammo as an inventory item, like in Resident Evil. Currently the only way to count the ammo item amount when reloading though, is through the use of formulas. As an example, here is my action list for reloading a weapon, using variables as ammo:

https://imgur.com/a/NxwOSgN

I welcome other ideas as to how to tackle this too, I appreciate AC is not overtly designed for such a scenario, but there's usually a way to get it to do what you want.

Comments

  • It's possible to manipulate both variables and inventory items through script. For example, you could sync the amount of inventory item "2" with the value of Global Integer "5" with:

    InvItem item = KickStarter.runtimeInventory.GetItem (2);
    GVar variable = GlobalVariables.GetVariable (5);
    item.count = variable.IntegerValue;
    

    See the "Variable scripting" and "Inventory scripting" chapters for more, as well as the Scripting Guide.

    For an entirely Action-based approach, you could consider the use of ActionList parameters to transfer one to the other.

    For example, if your ActionList has an Integer parameter, you could then set this parameter's value to the Global Variable's value with the ActionList: Set parameter Action.

    In the Inventory: Add or remove Action, you could then use this parameter to override the Reduce count by / Increase count by field value to manipulate the item count by that variable's value.

  • Excellent, thanks for the detailed reply Chris, I'm going to try these over the weekend.

  • If inventory properties stack, I think you could also give the ammo inventory item a value of 1, and use the Inventory: Property to Variable action to set the variable once the amount has been deducted each time you reload.

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.