Author Topic: Random Loot  (Read 666 times)

Offline Nol Drek

  • Dungeon Craft Tester
  • Hero Member
  • ***
  • Posts: 2177
    • Nol Drek's Web Site
Random Loot
« on: May 25, 2016, 06:52:50 PM »
You can create random loot in FRUA.

You will probably need to use up a Quest Item for each random loot drop. Let's say there are "N" items that could randomly drop.

Code: [Select]
CHAIN (if party doesn't have special item: Quest 1)
    SPECIAL ITEM (give item to party: Quest 1)
    GIVE TREASURE ( random percent chance: 100%/N ) Item #1
    chain if event doesn't happen
        GIVE TREASURE ( random percent chance: 100%/(N-1) ) Item #2
        chain if event doesn't happen
        ...
            GIVE TREASURE ( random percent chance: 50% ) Item #N-1
            chain if event doesn't happen
                GIVE TREASURE ( always happens ) Item #N

You can replace each of the GIVE TREASURE events above with COMBAT TREASURE events instead. This would put the random loot in a temporary storage location, and it would appear as the treasure reward after the next COMBAT event.

For an equal probability of receiving each of 5 items, it would look like this:

20% chance - Item 1
25% chance - Item 2
33.3333% chance - Item 3
50% chance - Item 4
100% chance - Item 5

Where each link in the chain only triggers if the previous event did NOT occur.

The probability of receiving Item 2 = 0.80 * 0.25 = 0.20
The probability of receiving Item 3 = 0.80 * 0.75 * 0.3333 = 0.20
The probability of receiving Item 4 = 0.80 * 0.75 * 0.6667 * 0.50 = 0.2
The probability of receiving Item 5 = 0.80 * 0.75 * 0.6667 * 0.50 * 1.00 = 0.2

With N items, it would look like this:

100%/N chance - Item 1
100%/(N-1) chance - Item 2
100%/(N-2) chance - Item 3
...
100%/2 chance - Item N-1
100%/1 chance - Item N
"Into the Drachensgrab Mountains!"

http://www.noldrek.com

Offline Null Null

  • Maker of excessively difficult vanilla mods
  • Hero Member
  • *****
  • Posts: 567
Re: Random Loot
« Reply #1 on: May 30, 2016, 01:44:14 PM »
This was partially implemented in Vanilla Dungeon on the last level, though there was no quest check to make sure only 1 item is dropped. </self-promotion>

A consideration is that it uses an awful lot of events, so you may want to have 'treasure dungeons' just like we have 'text dungeons' now where the party gets teleported to get the item (and then teleported back).

Also note you can only drop 1 item or 1 set of items at a time. (This was actually done in Death Knights of Krynn, where you could try to go into the pit and you'd get a different set of random items each time, but they always went together--they had the longsword +3 with the banded mail +4 if I remember right.)
« Last Edit: May 30, 2016, 01:47:39 PM by Null Null »