question

brendan avatar image
brendan asked

Can I make a randomized item drop where items are grouped by an attribute which is itself randomly chosen?

Brendan Vanous
started a topic on Sat, 09 August 2014 at 2:17 PM

I want to have a drop from an special enemy in my game which gives the player a group of items which are randomly determined, but I want all the items to be "themed" - all having an attribute in common, which is randomly selected.

10 |1200

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

1 Answer

·
brendan avatar image
brendan answered

Best Answer
Brendan Vanous said on Sat, 09 August 2014 at 2:17 PM

If you've read this post on the RandomResultTable, you'll notice that a RandomResultTable can contain another RandomResultTable. This allows you to nest them in such a way as to produce exactly this type of random drop.

Let's say you have three attributes, each with three options: Frequency (Common, Uncommon, Rare), Element (Earth, Fire, Water), and Type (Weapon, Armor, Enhancement). First, create a RandomResultTable for the specific items in the 27 combinations of item categories this defines (Common/Earth/Weapon, Rare/Water/Enchantment, etc.). The JSON data for one example might look like this:

{
  "TableId":"Uncommon Fire Weapon",
  "Nodes":[
  {
    "ResultItemType":"ItemId",
    "ResultItem":"Uncommon Fire Weapon 1",
    "Weight":20
  },

  {
    "ResultItemType":"ItemId",
    "ResultItem":"Uncommon Fire Weapon 2",
    "Weight":20
  },

  {
    "ResultItemType":"ItemId",
    "ResultItem":"Uncommon Fire Weapon 3",
    "Weight":20
  }

  ]
}

Next, create a RandomResultTable for each first-tier combination of these tables. As an example (again, using the JSON data for the table):

{
  "TableId":"Fire Weapon",
  "Nodes":[
  {
    "ResultItemType":"TableId",
    "ResultItem":"Uncommon Fire Weapon",
    "Weight":40
  },

  {
    "ResultItemType":"TableId",
    "ResultItem":"Common Fire Weapon",
    "Weight":20
  },

  {
    "ResultItemType":"TableId",
    "ResultItem":"Rare Fire Weapon",
    "Weight":10
  }

  ]
}

A possible second-tier combination then would be:

{
  "TableId":"Weapon",
  "Nodes":[
  {
    "ResultItemType":"TableId",
    "ResultItem":"Fire Weapon",
    "Weight":20
  },

  {
    "ResultItemType":"TableId",
    "ResultItem":"Earth Weapon",
    "Weight":20
  },

  {
    "ResultItemType":"TableId",
    "ResultItem":"Water Weapon",
    "Weight":20
  }

  ]
}

A Bundle (or Container) could then be defined to generate a group of items from any combination of these tables. As items are added to the catalog, the only necessary step would be to add the items to the appropriate first-tier RandomResultTable, and they would automatically become part of the logic for all derived tables.


1 Comment
Brendan Vanous said on Sat, 09 August 2014 at 2:17 PM

If you've read this post on the RandomResultTable, you'll notice that a RandomResultTable can contain another RandomResultTable. This allows you to nest them in such a way as to produce exactly this type of random drop.

Let's say you have three attributes, each with three options: Frequency (Common, Uncommon, Rare), Element (Earth, Fire, Water), and Type (Weapon, Armor, Enhancement). First, create a RandomResultTable for the specific items in the 27 combinations of item categories this defines (Common/Earth/Weapon, Rare/Water/Enchantment, etc.). The JSON data for one example might look like this:

{
  "TableId":"Uncommon Fire Weapon",
  "Nodes":[
  {
    "ResultItemType":"ItemId",
    "ResultItem":"Uncommon Fire Weapon 1",
    "Weight":20
  },

  {
    "ResultItemType":"ItemId",
    "ResultItem":"Uncommon Fire Weapon 2",
    "Weight":20
  },

  {
    "ResultItemType":"ItemId",
    "ResultItem":"Uncommon Fire Weapon 3",
    "Weight":20
  }

  ]
}

Next, create a RandomResultTable for each first-tier combination of these tables. As an example (again, using the JSON data for the table):

{
  "TableId":"Fire Weapon",
  "Nodes":[
  {
    "ResultItemType":"TableId",
    "ResultItem":"Uncommon Fire Weapon",
    "Weight":40
  },

  {
    "ResultItemType":"TableId",
    "ResultItem":"Common Fire Weapon",
    "Weight":20
  },

  {
    "ResultItemType":"TableId",
    "ResultItem":"Rare Fire Weapon",
    "Weight":10
  }

  ]
}

A possible second-tier combination then would be:

{
  "TableId":"Weapon",
  "Nodes":[
  {
    "ResultItemType":"TableId",
    "ResultItem":"Fire Weapon",
    "Weight":20
  },

  {
    "ResultItemType":"TableId",
    "ResultItem":"Earth Weapon",
    "Weight":20
  },

  {
    "ResultItemType":"TableId",
    "ResultItem":"Water Weapon",
    "Weight":20
  }

  ]
}

A Bundle (or Container) could then be defined to generate a group of items from any combination of these tables. As items are added to the catalog, the only necessary step would be to add the items to the appropriate first-tier RandomResultTable, and they would automatically become part of the logic for all derived tables.

10 |1200

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

Write an Answer

Hint: Notify or tag a user in this post by typing @username.

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.