Forum rules - please read before posting.

Pick random item from a category

I want my containers to contain some random items that are selected on runtime, eg one item from the category "Weapons" and two items from the category "Powerups". For categories with many items, doing this via ActionList (get random number, then skip to action) seems a bad idea, so I'm trying to do it via script.

I am going through the script reference and I've already found the InventoryManager.items and InventoryManager.bins lists, but what about a list of the items that belong to a specific category? Does a thing like this exist, or I should create it myself?

(or, is there another way to do what I want to do?)

Comments

  • There is not - an item's category is recorded in the item itself: see this entry in the scripting guide.  However, it would be useful to have a function in InventoryManager that returns all items from a category - I shall add one in the next release.
  • Yes, that would be good.

    Now that I think about it, is there a guide on how to create custom Actions to be used in ActionLists?
  • See the "Custom Actions" section of the Manual - as well as this tutorial.
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.